Lexical Definitions | Table of Contents | Hints and Tips |
The player in a way controls the execution of an Alan adventure. Each of his inputs are taken care of and acted upon by the run-time system. The execution of an Alan adventure starts by executing the start section. Then the player is prompted for a command.
The player input is analysed according to the explicit and implicit syntax rules and converted to an execution of verb bodies (global and in possible parameters) or exits (in case of directional commands).
After the players command has been taken care of all rules are evaluated and possibly executed. Then each of the other actors execute one step (if active) and for each actor the rules are evaluated again. Finally any events that are scheduled are fired before prompting the player again.
get and execute a player command evaluate all rules for each actor execute one step (if active) evaluate all rules as above end check for and execute any pending events
Then the user is prompted for another command and everything is repeated.
A player command may be either a verb or a direction. A verb is executed by checking the syntax of the input, performing any preconditions (checks) and then executing the verb bodies (as described in Verbs ). A directional command is executed by finding any exit in that direction, evaluating the checks and the body (if any) of that exit and locating the hero at the new location.
The syntax defined in the Alan source is the basis for what the player is allowed to input. Commands with these formats form the basic statements available to the player. In addition the following combinations and variations are possible:
The reference to multiple objects (or actors) in a position is, of course, only allowed if the adventure author has allowed it by using a multiple indicator in the syntax definition (see Syntax Definitions ). The variations above are built in and handled automatically by the run-time system.
The interpreter also automatically restricts parameter references to objects and actors at the current location. I.e. the player can only refer to objects and actors that are present in his input. The one single exception is if the syntax for the command uses the omnipotent '!' indicator, see Syntax Definitions for details. For hints on other ways to allow references to objects and actors that are not at the current location, refer to Distant & Imaginary Objects .
The use of ALL results in the execution of the appropriate verb for all objects at the current location, except the ones that does not pass all checks for the verb (see Verbs for further details on this).
Another restriction placed on the player input by the interpreter is that the words the player is allowed to use can only contain alphabetic characters. This must be kept in mind when naming verbs that use the default syntax (an explicit SYNTAX statement can always specify other player words to trigger the verb).
When the player enters a command the Alan run-time system evaluates the various constructs from the adventure description (source) as described above. Depending on the player's command evaluation of different parts of the adventure may be triggered. These parts all have different conditions under which they are evaluated and also have different contexts. Four different execution contexts can be identified:
So the execution of various parts of the adventure source can also be said to have a number of different focuses, meaning where the action is considered to take place:
The main way to move actors are the exits (see Locations ). They, of course, only apply to the hero, but are executed if the player inputs a directional command, i.e. a word defined as the name for an exit in any location. First the current location is investigated for an exit in the indicated direction, if there is none an error message is output. Otherwise that exit is examined for CHECK s which are run according to normal rules (see Verbs ). If no CHECK was present or if the check passed the statements in the body (the DOES -part) is executed. The hero is then located at the location indicated in the exit header, which will result in the description of the location (by executing the DESCRIPTION -clause of the location) and any objects or actors present (by executing their DESCRIPTION s).
When any actor (including the hero) is located at a location, the DOES -clause of that location is executed as if the actor had moved into that LOCATION . The actor which was moved will be the ACTOR even though the movement was not caused by himself (but the result of an event, for example). So this is also the last step in the sequence of events caused by locating the hero somewhere.
Lexical Definitions | Table of Contents | Hints and Tips |