Introduction
You arrive at the Job Centre looking for a challenging job. The lads are busy discussing a vacancy for a farm labourer at Southern Comfort Farm in Surbiton. Many people have been sent there but only a few returned, sacked for incompetence. No one knows what happened to the others. Someone is running a book on how long the next person will last, as no-one has worked there for a whole day yet. You are overheard rashly boasting that it would be easy to keep out of trouble for one day!
You find yourself standing in the kitchen of a suburban house that has been turned into a smallholding. A lady is stirring a large cauldron containing a seething mass of grey porridge. (You hope it is not for lunch!) Your employer (for it is she) says, "How nice to find yet one more volunteer. I have four tasks for you to finish before five o'clock. On no account must you lose or damage equipment, or upset the posh lady next door. You may find that the garden has one or two surprises for you."
Program Description
A program description has been included in the hope that it may be useful without giving away too much of the plot. (For anyone about to write their own adventure game, I would recommend reading How To Write Adventure Games by Peter Killworth, published by the Penguin Acorn Computer Library.)
Variables
F% | Code to distinguish between eating and drinking |
I%, J% | Loop variables |
A | Value of numerical DATA just READ in |
ASK | ASCII value of letter in string |
CARRY | Number of items carried |
DEST | Destination room |
HOURS | Time in hours |
ITEM | Current object number |
M | Message number |
NV | Number of verbs |
MN | Number of messages |
NO | Number of objects |
OB | Current object |
PLACE | Position of letter in string |
ROOM | Current room or area |
SCORE | The score |
SP | Position of space in string |
SNAG | The number of the hazard in that room, if any |
V | Verb number |
VERB | Verb number |
X, Y | Used to position the border motif |
Y2 | Saved value of VPOS, so that the text will be in the right place after the score and time are displayed |
A$ | The string DATA being READ in |
BORDER$ | The border motif |
B$ | The command |
C$ | Either the whole command or the object |
D$ | The command in upper case only |
OB$ | The first four letters of the object |
V$ | The first four letters of the verb |
Arrays
FLAG(OB) | The information on an object's state and whether an object is edible, wearable, etc |
LONG$(OB) | The long name of each object |
ROOM$(OB) | The room where the object is |
SHORT$(OB) | The short name of each object |
TRANS(V) | Whether the verb takes an object |
VERB$(V) | The first four letters of each verb |
VERB(B) | The number of each verb |
The Byte Arrays
&5D00-&5DFF | The room data. The first byte contains the message number, the next four the north east south and west exits if any. The last byte contains the snag number and is zero if there is no snag |
&5000-&5CFF | The messages |
&5E00-&5EF0 | The location above &5000 of the start of each message |
Procedures
Line | |
280 | PROCSNAG. Some rooms require special subroutines before the game continues |
460 | PROCINIT |
470 | You lose control of the cursor keys |
480 | Sets the number of messages, verbs and objects used in the program |
490-500 | Dimensions arrays |
510 | Sets initial values |
520-540 | READS room DATA into a byte array |
550-590 | READS message DATA, and stores the start address of each message |
600-640 | READS verb DATA into arrays |
650-700 | READS object data into arrays |
710 | PROCTITLE. The title sequence. This procedure is self-contained and can be omitted if preferred |
980 | PROCTEXT. Prints the message and any additional information |
1060 | PROCHEADER. Prints program name and scores |
1110 | PROCINPUT. The command is INPUT and processed |
1220 | PROCLEAD. Removes leading spaces |
1260 | PROCCASE. Reduces command to upper case only |
1330 | PROCVERB. Calculates verb number |
1360 | PROCMOVE. Moves in chosen direction |
1440 | PROCINV. Lists items carried |
1500 | PROCGET. Takes an object |
1650 | PROCDROP. Drops an object |
1760 | PROCWEAR. Wears an item of protective gear |
1840 | PROCDIG. The planting procedure |
1900 | PROCHELP. Prints the last instructions |
1930 | PROCSAY. Says the chosen phrase |
1960 | PROCLOAD. Loads a file from disk or tape |
2060 | PROCSAVE. Saves the information from the game. This includes the score, time, items carried, current room as well as the object data in the arrays |
2150 | PROCFILENAME |
2190 | Clears eight bytes for the filename |
2210-2220 | Sets up a parameter block from &70 |
2230 | The filename is entered using OSWORD 0 |
2270 | PROCTHROW. Throws the object, preferably to the north |
2370 | PROCEAT. Eating and drinking procedure |
2450 | PROCSCORE. Prints the score |
2550 | PROCCLOCK. Prints the time. The game starts at 9am, five minutes are added per move, and rather longer for planting. Time is up at 5pm but this could be adjusted if preferred |
2620 | PROCQUIT. Finishes the game. It is called on failure, victory or as a command |
Main Program
Line | |
30 | Sets the MODE and removes the cursor |
40 | Runs the title sequence |
50 | Accesses the initialisation procedure and displays the score |
60 | Describes the room |
70 | Prints the first instructions |
80 | Diverts to the error routine if necessary. I found it useful to be able to continue the program if a disk error occurs, or ESCAPE is inadvertantly pressed. This line is best omitted until the program is running correctly |
90 | The start of the main program loop. I have used an INPUT command rather than a series of GET$ here. Even if a block of nonsense is typed in the display will not be disturbed unduly, and there are procedures to try and make sense of the INPUT |
100 | The verb number determines which subroutine will follow |
110 | This loop never officially finishes, the program takes care of the END and reRUN |
120 | If the verb in the command is not in the program a suitable message is printed |
130-270 | The appropriate subroutines are followed |
Margaret Stanger, EUG #45