Creating Libraries and Modules

From ADRIFT 5 Manual Wiki
Revision as of 10:19, 24 August 2013 by Saabie (Talk | contribs) (Using Properties)

Jump to: navigation, search

ADRIFT 5 lets you create your own libraries to replace or add features to the standard library, and export it as a .AMF file that you can use in all of your own games, or publish on the ADRIFT web site for other people to use.

Construction.gif

Libraries and Modules

The same .AMF file can be used as both a library and as a module, the only difference is in the way you use it.

A module can be manually imported into a game at any time, simply by choosing "Import" from the main menu and selecting "Module":

MenuImport.jpg

A Library is just a module which is automatically imported whenever you begin a new game, and is automatically re-imported if a new version of the library has replaced the old one.

A new library is added to ADRIFT by going to the Libraries page of Settings and pressing the "Add New Library" button.

LibrarySettings.jpg

Reserving a key prefix

If you think you might ever share your module with anyone else then you should go to the bottom of the Options page to check which prefix codes are being used by other people, decide what prefix you want to use (your initials followed by an underscore "_" character for example) then add it to the list so that nobody else uses the same one.

Creating a Module

Create a NEW file in the developer for your module, then go to the Advanced page of the Options and enter your prefix code into the "Key Prefix" field.

Even if you are only making a module for your own use, you still need to specify a key prefix so that none of the keys in your module will be the same as any of the keys in the game files that you load it into.

Exporting your Module

A copy of the module can be exported as a .AMF file at any time, simply by choosing "Export" from the main menu and selecting "Module":

MenuExport.jpg

Player perspective

One of the Options for a game developer is to set the player perspective. That is, whether the player's character should be refered to in the first person ("I am"), second person ("You are") or third person ("Simon is").

Our module needs to change ALL of its output and restriction message to conform to this setting.

ADRIFT provides a special syntax to help us do this. We only need to place the words that need to change inside of square brackets "[ ]", providing the 3 different perspectives separated by slashes like this:

%CharacterName% [am/are/is] wearing %ListWorn[%Player%]%.

The three sections are in order, [1st person/2nd person/3rd person] and ADRIFT will always display whichever one has been selected in the game options.

One or two of the sections can be left blank, which is very useful because many words have an "s" placed at the end only when in third person.

%CharacterName% close[1] the door

The above example will print "I close the door", "you close the door" or "he closes the door" depending on the perspective setting.

The CharacterName function should always be used in any text that refers to a character.

Most tasks that you write will output a message that describes the player doing something, so if you make a "squash %object%" task then the message might be something like "You squash the %object%.Name". But that does not account for the player perspective setting in the game options.

The task output should be "%CharacterName% squash[2] the %object%.Name". This will automatically insert the correct subjective pronoun for the current perspective.

This function can also be used to insert objective (me, you, him, her, it) and possessive (my, your, his, her, its) pronouns by using the correct parameters, and can take a %character% reference or key to perform a similar substitution in a task that operates on a character.

Point of View

Someone using your module to create a game may wish to change the point of view and play as more than one character during the game.

This means that we cannot use the "Player" key directly in our module, we must always use the %Player% function to get the key of the character that the player is currently using.

Past, Present and Future Tense

ADRIFT does not currently support switching the tense of the game between past, present and future. The standard library is written in the present tense.

The only way to support a different tense, for example to make your interactive fiction sound more like reading a normal book (which usually use past tense), is to make your own version of the standard library by making a copy of it and rewriting all of its text.

Using Properties

When you create new properties you can use the "This property will only appear if the following are true:" settings to make them dependant on another property.

It is important to only use this feature for properties that are selected in the developer.

If your module uses an action to enable/disable a selection property, or to change the state of a state property, then you must never make another property dependant on it.


<<< Choose Your Own AdventureMain PageADRIFT Reference: Locations >>>