Gardenquest

By Margaret Stanger

Originally published in EUG #45

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
AValue of numerical DATA just READ in
ASKASCII value of letter in string
CARRYNumber of items carried
DESTDestination room
HOURSTime in hours
ITEMCurrent object number
MMessage number
NVNumber of verbs
MNNumber of messages
NONumber of objects
OBCurrent object
PLACEPosition of letter in string
ROOMCurrent room or area
SCOREThe score
SPPosition of space in string
SNAG The number of the hazard in that room, if any
VVerb number
VERBVerb number
X, YUsed to position the border motif
Y2Saved 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-&5DFFThe 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-&5CFFThe messages
&5E00-&5EF0The location above &5000 of the start of each message

Procedures

Line 
280PROCSNAG. Some rooms require special subroutines before the game continues
460PROCINIT
470You lose control of the cursor keys
480Sets the number of messages, verbs and objects used in the program
490-500Dimensions arrays
510Sets initial values
520-540READS room DATA into a byte array
550-590READS message DATA, and stores the start address of each message
600-640READS verb DATA into arrays
650-700READS object data into arrays
710PROCTITLE. The title sequence. This procedure is self-contained and can be omitted if preferred
980PROCTEXT. Prints the message and any additional information
1060PROCHEADER. Prints program name and scores
1110PROCINPUT. The command is INPUT and processed
1220PROCLEAD. Removes leading spaces
1260PROCCASE. Reduces command to upper case only
1330PROCVERB. Calculates verb number
1360PROCMOVE. Moves in chosen direction
1440PROCINV. Lists items carried
1500PROCGET. Takes an object
1650PROCDROP. Drops an object
1760PROCWEAR. Wears an item of protective gear
1840PROCDIG. The planting procedure
1900PROCHELP. Prints the last instructions
1930PROCSAY. Says the chosen phrase
1960PROCLOAD. Loads a file from disk or tape
2060PROCSAVE. Saves the information from the game. This includes the score, time, items carried, current room as well as the object data in the arrays
2150PROCFILENAME
2190Clears eight bytes for the filename
2210-2220Sets up a parameter block from &70
2230The filename is entered using OSWORD 0
2270PROCTHROW. Throws the object, preferably to the north
2370PROCEAT. Eating and drinking procedure
2450PROCSCORE. Prints the score
2550PROCCLOCK. 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
2620PROCQUIT. Finishes the game. It is called on failure, victory or as a command

Main Program

Line 
30Sets the MODE and removes the cursor
40Runs the title sequence
50Accesses the initialisation procedure and displays the score
60Describes the room
70Prints the first instructions
80Diverts 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
90The 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
100The verb number determines which subroutine will follow
110This loop never officially finishes, the program takes care of the END and reRUN
120If the verb in the command is not in the program a suitable message is printed
130-270The appropriate subroutines are followed

Margaret Stanger, EUG #45