The Language | Table of Contents | Execution of an Adventure |
Comments may be placed anywhere in the Alan source. A comment is opened by double hyphens ('--') and extends to the end of the line.
-- This is a comment
Words used as identifiers in an Alan source may only be composed of letters, digits and underscores. The first character must be a letter.
identifier = letter ( letter | digit | underscore )*
In order to be able to use reserved words as identifiers (e.g. for verbs) there is also a second kind of identifier, namely the quoted identifier.
quoted_identifier = single_quote any_character+ single_quote
A quoted identifier starts and ends with single quotes and may contain any character except quotes (including spaces). It may be used to make an identifier out of a reserved word such as LOOK . This may be useful in the definition of the verb LOOK which then would look like:
VERB 'look' DOES LOOK. END VERB 'look'.
Note that normal identifiers are always translated to lower case before making any comparisons so it does not matter how you (or the player) write them (although it is easier to read if the same kind of editing is used for the same kind of words). Quoted identifiers are not changed at all, so they must always be written identically. They may also contain spaces which make them useful as long names for locations as in
LOCATION pluto NAME 'At the Rim of Pluto Crater' DESCRIPTION ...
One single quoted identifier is used as the whole name of the location so as to preserve editing and avoiding clashes with the reserved words AT and OF .
Some of the identifiers in an Alan description are by default used as player words. This is for example the case with verb names (unless a SYNTAX statement has been declared for the VERB) and object names (unless a NAME clause has been used). If these contain special characters the player can not enter them.
The string is the main lexical component in an Alan source. This is how you describe the surroundings and events to the player. Strings, therefore, are easy to enter and consist simply of a pair of double quotes surrounding any number of characters. The text may include newline characters and thus may cover multiple lines in the source.
string = '"' any_character+ '"'
When processed by the Alan compiler, any multiple spaces, newlines and tabs will be compressed to one single space as the formatting to fit the screen is done automatically during execution of the game (except for embedded formatting information, as specified in Output Statements ). You may therefore write your strings any way you like, they will always be neatly formatted on the players screen.
It is possible to write one adventure using many files, having different parts in different files, thus giving an opportunity for some rudimentary kind of modularisation. The method for this is the $include construct.
include = '$INCLUDE' quoted_identifier
where the quoted identifier is the name of the file to include. The $include may be placed anywhere in a file and the effect will be the same as if the contents of the named file had been inserted at that position in the file. Includes may be nested.
An included file is searched for first in the current directory and then in any of the directories indicated using the include switch as described in Compiler Switches , this search is performed in the same order as the include switches occured on the command line.
The Language | Table of Contents | Execution of an Adventure |