map and produce a data statement for each location similar to the
ones in Castle Rathbone.
OBJECTS AND TREASURES
We now come to the important list of objects and artefacts that
are to appear in your adventure. First, decide what you want -
gold doubloons, swords, half-eaten sarnies, an alien's toe-nail,
you name it, you can include it. Now choose where it's going to
be placed and you're ready to put them into your program.
The Data statement for each object comprises of a description
of the object followed by a number. This number corresponds to
the location where the object first appeared. If you don't want
the object to appear straight away, simply make the number equal 0.
When you want the object to make its appearance, then use
action codes J or K in an action table entry. If an object is
being carried the number will be -1. The program changes that
automatically when you pick up or drop an object.
It's very important that when you come to write the dictionary
of words that the program will recognise, you include a word or
words for each object. If you don't the player's going to have a
tricky time telling the program to pick it up! Also don't forget
to count up your objects and change the variable TNOBS at line
9020.
RATHBONE REVISITED
To help clarify how to use objects type the following program
into Castle Rathbone, then type GOTO 5200 and press enter. |
5200 RESTORE 9000: GO SUB 9000
5210 FOR n=1 TO tnobs
5220 PRINT: PRINT "OBJECT No.";n;" is:-": PRINT
5230 PRINT O$(n): PRINT
5240 IF O(n)>0 THEN PRINT "and it's initial position is location No.";O(n): GO TO 5290
5250 IF O(n)=0 THEN PRINT "and it's not been created yet.": GO TO 5290
5260 PRINT "and it is being carried."
5290 PRINT : NEXT n: STOP
|
Lines 5200-5290 These lines print a list of objects in Castle
Rathbone and the start location of each one. |
MESSAGES AND RESPONSES
An adventure, if it's good, has got to give you the impression that
it knows what you're up to all the time. That means it'll often
have to respond to the actions and inputs of the player with
something a trifle more intelligent than the normal "You can't do
that!" or "I don't understand". These responses will also take the
form of hints and warnings to the player about what they are
doing (or not doing).
Now, you'd have to be a pretty good planner to know all your
messages from the beginning. But fortunately, it doesn't matter
as you can add new responses as fresh ideas occur to you.
But what Sort of messages do I put in? I hear you ask. To show
you how flexible it is, here's an example. Say the player has 'A
LAMP' and 'A BOX OF MATCHES'. Rather than respond to
'LIGHT LAMP' with just an OK, the message could read "The
room is now brightly illuminated" or "Don't be a Wally. You
can't light an electric lamp with matches". As always, you're in
control and you decide what you want to happen.
When you're ready to add your messages, delete lines 3000-
3305. Now write your messages and then enter them in the
program at lines 3000, 3005, 3010 and so on. These lines
correspond to message numbers 1,2,3 ... and must go here as
they're called by the program at line 2605. Take a look at Castle Rathbone lines 3000 to 3305 if you're not sure what sort of
messages you'll need.
FLAGS AND COUNTERS
The primary function of flags is to let the program keep track of
what's going on. They are held in the array F(). They record all
the important happenings. Perhaps you can think of them as on/off,
true and false switches. For example, if you're in the attic in
Castle Rathbone, the program has to know whether the skylight
is open. So, there is an entry in the Status table that checks if
F(12) is set. If it is, then the program prints the message at line
3135. In the same way, there is another entry in the Status table
that'll print the message "There is a rope fixed to the battlements"
when F(18) is set ON, that is to 1.
|
If you want to see how the Flags were used in Castle Rathbone,
use the program that decodes the Action table from Rathbone
Revisited. You'll then see where the tests on the Flags occur.
Here's a full list of the Flags that were used in Castle Rathbone.
It should help you to see how many Flags you'll need in your
adventure. When you've decided how many you want, change
the DIM F(21) statement at line 9065.
F(1)=1 | Means the current location is dark |
F(2)=1 | Unused |
F(3)=1 | The player has read the HELPLINE message |
F(4)=1 | Unused |
F(5)=1 | Unused |
F(6)=1 | Unused |
F(7)=1 | The player has read the Blue Peter book |
F(8)=1 | The player's standing on the chair at location 17 |
F(9)=1 | The player has searched the kitchen and found the cornflakes |
F(10)=1 | The tyres on the motorbike have been pumped up (that means the
motorbike with flat tyres has been swapped for the other one) |
F(11)=1 | The secret attic door is open |
F(12)=1 | The attic skylight is open |
F(13)=1 | Roger has escaped |
F(14)=1 | Tony has escaped |
F(15)=1 | Pete has escaped |
F(16)=1 | The hole at location 15 has been dug |
F(17)=1 | The ramp made of earth has been built |
F(18)=1 | The rope of sheets is fixed to the battlements |
F(19)=1 | Peter is giving his grand performance |
F(20)=1 | The dragon is dead |
F(21)=1 | The first help message for location has been printed |
THE DICTIONARY
This is where your program becomes word perfect. The
dictionary must contain all the words that it recognises. You'll see
from the one in Castle Rathbone (Lines 9400-9474) that its
dictionary is quite large but yours needn't be this big. In fact, the
smaller the vocabulary, the faster the program. (Is this why Troubleshootin' Pete talks so fast? Ed). Just remember to keep
the direction commands identical to those in Castle Rathbone
(North, South, East, West, Up, Down). As for the rest, well, you
have a whole language to choose from!
You'll notice that each of the words in the dictionary data
statements is preceded by a two digit number. This is the code
used by the rest of the program. If two words have the same
meaning, you should assign them the same code number and
treat them as one word. When the player enters something, the
routine at line 2000 searches through the dictionary until it finds
a match for the words entered. When a match is found, the
program then tries to match the prefixed code to an entry in the
Action table.
But before we look at that, don't forget to count up the total
number of words and then change the value assigned to the
variable WORDS at line 9015.
ACTION TABLE
Prepare for action. Take a look at Castle Rathbone lines 9086-
9199 and you'll see a series of strange looking Data statements.
These are the action table entries. When the player types in a
command like 'TAKE ROPE', the program finds the code for
each word from the dictionary. It then searches for an entry in the
action table where the first four characters are the same as the
two codes for the words input. When it finds the right entry, it
carries out the tests in the entry, such as 'is the rope here?' You
couldn't take it, after all, if it wasn't in that location. If all the tests
prove positive, the appropriate action is performed - 'get the
rope' and then 'print the message OK, YOU'VE GOT THE
ROPE'.
Now you can construct a series of actions for your own
adventure using the Test and Action tables. The sequence for
each entry is as follows: two codes for the input - the numbers at
the front of each word in the dictionary. This is followed by a
series of tests from the Test table. Then an asterisk to signify the
end of the tests. Then a series of actions (from the Action table).
Finally, don't forget to put an asterisk at the end of the entry
as well.
|