home *** CD-ROM | disk | FTP | other *** search
-
- TRELLIS - The Adventure Interpreter
- (c) copyright 1991-9 Soft Rock Software
-
- Storing Data
- ------------
-
- In any computer program that performs any useful task there will be a need
- to store and access data. You provide a lot of data for Trellis in the files
- described in the previous section of these instructions. Most of this data
- is put into special variables that you can access from your TScript program.
- In addition to these variables there is a set of variables for you to store
- numbers in, which can represent whatever you want them to.
-
- The complete range of variables you have available are as follows:-
-
- Store%(n)
- ---------
-
- This is the set of variables for storing numbers in. There are 101 of these,
- numbered from 0 to 100, so the n in the brackets can be anything in that
- range. It can also be a formula that results in a number in that range. The
- first 21 of these are set aside for special purposes, but the remaining 80
- (numbers 21 to 100) can be used for whatever you want.
-
- Store%(0) is used to tell Trellis if the player can see in the dark or not.
- If a room (see the description of the Rooms file) is not set up as being a
- light room (if it doesn't have an L as part of its third line) Trellis will
- look at this store to decide what to do. If it contains -1 (which is often
- called TRUE) that means the player is able to see. You could set this to -1,
- for example, if the player picks up a torch and switches it on. If it
- contains 0 (or FALSE) that means the player can't see if the room is dark.
- (In a dark room, if Store%(0) contains 0, Trellis will say "It is too dark to
- see anything here.")
-
- Store%(1) is used to tell Trellis how much weight the player can carry.
- Each object in the game has a weight, and the total weight of the objects
- carried can't be higher than the number in Store%(1). You can give an object
- a weight higher than this limit if you don't want the player to be able to
- pick it up at all. You put the weight limit into this store near the start
- of the game.
-
- Store%(2) is related to Store%(1) because it contains the total weights of
- all the objects carried. You can find out what is in this store, but I would
- advise against changing it directly until you are a more experienced Trellis
- user because it can have confusing results.
-
- Store%(3) contains the number of the location the player is in. Under normal
- circumstances you would not need to change this, but there are times when
- you might want to - perhaps your game is based around Star Trek and the
- player can use the transporter to change locations, or it starts off with a
- ship wreck and the player is washed up on a section of beach which is chosen
- at random.
-
- Store%(4) to Store%(20) do not have specific uses as yet, but they might be
- used in future versions of Trellis. In theory you can use these, because
- once you have a game up and running there will be no need to alter it to
- work in new versions of Trellis - you can carry on supplying it in the
- version it was written - so any use Soft Rock Software puts these stores to
- in future versions won't affect your game. However, habits are easily
- formed: if you start using them you might forget to stop using them when the
- software is updated, so it's best to avoid them.
-
- Store%(21) to Store%(100) are yours to use freely.
-
- The Store%(n) variable is an integer variable. That means it can contain
- whole numbers only. The smallest number you can put in one of these
- variables is -2147483648 and the biggest is 2147483647. That should be a
- big enough range for most games :-)
-
- Object Variables
- ----------------
-
- The variables Object$, List$, Location%, Weight% and Examine$ are all to do
- with objects. They are each described below. In each case, the n in the
- brackets can be in the range 1 to whatever value you put at the start of
- your object definitions (ie. the number of objects). Again, the brackets can
- contain a formula that results in a number in this range.
-
- Those with a % in the name are integer variables, which can hold a number in
- the range given above for stores, though you should be sensible about what
- numbers you put in them. Those with a $ in the name are called string
- variables, and can hold words and so on.
-
- Object$(n)
- ----------
-
- This is a variable that holds the names of the objects you have defined in
- the Objects file. The object name should always be one word, in capitals,
- that must be a keyword in the words file (this is explained in the previous
- section).
-
- List$(n)
- --------
-
- This variable holds the short descriptions of objects you have defined - the
- text that appears when Trellis says 'You can see....' or 'You have....' This
- would normally be a two or three word description, such as 'a sword' or 'an
- enchanted sword'
-
- Examine$(n)
- -----------
-
- This variable holds a longer description of the object - the text that
- appears when the player types EXAMINE .....
-
- Location%(n)
- ------------
-
- This variable tells Trellis where the object is to be found in the game. As
- a general rule, it should hold a number from -1 to the number of rooms. -1
- is used to 'hide' the object, so that it is not in play. The player can't
- find it, or use it, or whatever. If the player is carrying the object, the
- Location%(n) variable should contain the value 0.
-
- Weight%(n)
- ----------
-
- This variable holds the weight of the object. This is used in conjunction
- with Store%(1) and Store%(2) to see if the player can carry it.
-
- Room Variables
- --------------
-
- The variables Room$, Light%, North%, East%, South%, West%, Up% and Down% are
- all to do with descriptions of locations and are described below. In each
- case the n in brackets can be from 1 to the number of rooms (and can be a
- formula). Again % means integer and $ means string.
-
- Room$(n)
- --------
-
- This contains the description of the location. It is usually displayed on
- the screen when the player enters the room, or types LOOK while in that
- room - subject to whether or not the room is light and, if not, whether or not
- the player can see in the dark.
-
- Light%(n)
- ---------
-
- This is the variable that tells Trellis if a room is light or dark. If it is
- light the variable should contain -1, and if it is dark the variable should
- contain 0. Trellis will not stop you from using a number outside this range,
- but doing so may stop your game from working correctly.
-
- You might change this variable to -1 if, for example, the player switches on
- the lights and back to 0 if the lights are switched off again.
-
- North%(n), East%(n), South%(n), West%(n) Up%(n) and Down%(n)
- ------------------------------------------------------------
-
- Each of these variables contains the number of the room the player can get
- to by moving in the direction given by the name. In other words if
- North%(14) contains 52 that means the player can move North from room 14 to
- room 52. The variable South%(52) should therefore contain 14 (except in
- special circumstances - such as a room being a trap; the player can get in
- but not out.)
-
- If one of these direction variables contains 0, that means that there isn't
- an exit in that direction. You can use this to help include doors in your
- game.
-