|Chapter 3.6 - ADRIFT Language Resource files|
It is possible to change any of the text in ADRIFT, ie. any of the default text can be changed to anything else. This is very useful if writing a game in a different language, or just to customise your adventure.
To create an ADRIFT Language Resource (*.ALR) file, simply create a blank text file, and save it with the extension alr. ADRIFT should have pre-registered this file type, so to edit the file, all you need to do is double-click the file, and it will be opened in Notepad.
The format of the file is very simple. All you do is write the text you want replaced, add a separator bar (usually the character to the right of the L-Shift key) then write the new text. Separate each replacement with a newline, and you should be able to import the file by selecting File > Import > Language Resource from the menu. Comments and blank lines are also allowed.
Example of file format;
# Comments have to start with the hash character
Also here is|You can also see
You are holding|You are carrying
You can only move|Exits are
If an adventure has had a language resource added to it, you can extract this information and create a new Language Resource file by selecting File > Export > Language Resource from the menu.
You can greatly increase the flexibility of descriptions in ADRIFT, using a combination of variables and ALR files, simulating string variables. If you have a description which you want changed depending on the state of a particular variable, eg. you had a dial which had values "Low", "Medium" and "High", you would want to store this state in a variable and simply replace the text in the description. You would do this as follows;
Create a variable, say "dial_value" with initial value "1".
In the description for the dial, put something like;
"The dial has a needle, currently pointing to [DIAL=%dial_value%]."
Then, in the ALR file, add the lines;
# Current position of dial
The extra characters "[DIAL= ]" are used only to prevent the ALR file from inadvertently changing other numbers.
What this does, when ADRIFT evaluates the description, it replaces %dial_value% with the current value for that variable. Initially this is the value "1", ie, the description becomes;
"The dial has a needle, currently pointing to [DIAL=1]."
The ALR will then replace "[DIAL=1]" with "Low", thus giving the final output;
"The dial has a needle, currently pointing to Low."
|Back to top||
Previous : Next