Difference between revisions of "Creating Libraries and Modules"

From ADRIFT 5 Manual Wiki
Jump to: navigation, search
(Exporting your Module)
(added file extension)
 
Line 35: Line 35:
 
   
 
   
 
However, before doing so it is necessary to remove a few sections, otherwise they will interfere with your adventure.
 
However, before doing so it is necessary to remove a few sections, otherwise they will interfere with your adventure.
To do so, open the file with microsoft WordPad ('''NOT''' Notepad), delete the sections indicated, and save the file.
+
To do so, open the .AMF file with microsoft WordPad ('''NOT''' Notepad), delete the sections indicated, and save the file.
 
* Delete everything after the '''<nowiki><</nowiki>LastUpdated<nowiki>></nowiki>''' line and before the first '''<nowiki><</nowiki>Folder<nowiki>></nowiki>''' line at the start of the file:
 
* Delete everything after the '''<nowiki><</nowiki>LastUpdated<nowiki>></nowiki>''' line and before the first '''<nowiki><</nowiki>Folder<nowiki>></nowiki>''' line at the start of the file:
 
  <?xml version="1.0" encoding="utf-8"?>
 
  <?xml version="1.0" encoding="utf-8"?>

Latest revision as of 06:00, 12 November 2016

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

An AMF file contains everything that is in the game (.TAF) file, but in a human readable XML format that can be edited with a simple text editor such as Wordpad.

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 click on this link and go to the list at the bottom of the 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. Right-click on the folder that contains your module and choose the "Export Folder" option:

FolderMenuExport.jpg

Preparing the Module

Modules can can either be imported manually from the main menu, or used as ADRIFT Libraries by adding them to the Libraries list in Settings and selecting them.

However, before doing so it is necessary to remove a few sections, otherwise they will interfere with your adventure. To do so, open the .AMF file with microsoft WordPad (NOT Notepad), delete the sections indicated, and save the file.

  • Delete everything after the <LastUpdated> line and before the first <Folder> line at the start of the file:
<?xml version="1.0" encoding="utf-8"?>
<Adventure>
   <Version>5.0000314</Version>
   <LastUpdated>2014-02-24 21:42:45</LastUpdated>
   <Title>SAA Enhanced Library</Title>          <---- Remove this line
   <Author>saabie</Author>                      <---- and all these lines...
   <ShowFirstLocation>1</ShowFirstLocation>     <----
   <ShowExits>0</ShowExits>                     <---- 
   <EnableMenu>1</EnableMenu>                   <----
   <KeyPrefix>s_</KeyPrefix>                    <---- up to and including this line 
   <Folder>
       <Key>ROOT</Key>

It should now look something like this:

<?xml version="1.0" encoding="utf-8"?>
<Adventure>
   <Version>5.0000314</Version>
   <LastUpdated>2013-11-28 19:25:36</LastUpdated>
   <Folder>
       <Key>ROOT</Key>

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").

Any module you might use with different player perspectives, or which you intend to upload for other people to use, needs to change ALL of its output and restriction messages to give the correct output for all three player perspective settings.

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, or the more versatile %character%.Name( Pronoun_type, Article ) item 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 >>>