|★ CODING ★ 6. ACTIONS IN AKS ★|
|Writing Adventure Games on the Amstrad - 00 - Contents||Writing Adventure Games on the Amstrad - 07 - Actions in AKS?|
The AKS actions are the parts of the vocabulary which cause an action to take place, there are nineteen separate commands, each of which is represented by a two letter abbreviation. A command line starts with an A, to indicate an action. The actions are only performed:
a) as the result of a trigger
We'll take a look at each of the Actions in turn, together with an explanation of the effect of using each one. Later chapters will show how these commands are actually incorporated within an AKS database, as well as expressions and triggers.
Assign Flag (AF)
AKS provides a number of flags, which may be set to TRUE or FALSE by the user, and then tested in later operations. The assignflag command will set the specified flag to the specified state, and takes the form of:
AF,< fnum > , < flagstatus >
e.g. AF, 11 ,T
where < fnum > is the specified flag and flagstatus is T or F.
NOTE: If flagstatus has a value other than T, then the flag will be set to FALSE, without an error being reported.
This will result in the object mentioned in the player's command line being dropped, providing it is being carried, and that it can be dropped. Otherwise, a suitable error message is produced.
The object in the player's command line is tested, and if it is present and may be examined, the description is then printed.
As with the drop command, the object to be taken is checked for suitability, and to see if it is present. If all the conditions are met, the object is added to his inventory.
This command causes the player to move in the direction given, moving him to a new location if a connection exists from the player's current location; otherwise printing "You cannot go that way". The command takes the form:
GO,< direction >
where is usually one of N, S, E, W, U or D — indicating north, south, east, west, up or down respectively. The direction may be any word, providing it has been used in both the action and location definition.
The AKS system provides a number of counters, which are decremented each move. The HC command will stop the specified counter from counting. The command's form is:
HC, < cnum > e.g. HC, 11
A scoring facility is provided by AKS and the IS command will add the score increment to the score. The command format is:
IS, < int >
The increment can be positive or negative.
This will initialise the counter indicated to < int >, and starts the countdown of moves. When 0 is reached, the event < cnum > will fire. The command format is:
IC, < cnum >, < int >
Displays the objects which the player is currently carrying or wearing.
This reloads a SAved game from tape.
This will move the object specified to the location number specified. It takes the format of:
This changes the status of the object referred to in the command line to show that it is now being worn by the player.
Prints the following string onto the screen. The print command takes the form of:
PR < string >
This will quit the game (note: without requesting a confirmation from the player), and then prompts “Another Game?".
This saves all the variables associated with the game to tape, so that the game can be reloaded later on.
Prints the player's current score on the screen.
The opposite of PutOn, fairly naturally, this changes the status of the object referred to in the command line from being worn, to being carried by the player.
This takes an object from whatever location it is currently at, and brings it to the player's current location. The command form is:
ZI, < obj >
This takes an object and changes its location to “nowhere”, effectively destroying it. It takes the form of:
ZO, < obj >
The parameters to the above actions have maximum and minimum values, which cannot be exceeded; an Amstrad Basic error "Subscript out of range" will occur if you do exceed the values. These are defined as follows:
< int > = BASIC integer (signed).
The upper limits to some of these ranges are set within the program, by the constants at the start of AKS. The initial (and arbitrary) values are:
maxflag = 30
Their values can easily be changed using the normal BASIC editor.