home *** CD-ROM | disk | FTP | other *** search
/ APDL Soft Rock Games / APDL_SOFTROCK.iso / trellis / docs / part03 < prev    next >
Encoding:
Text File  |  1999-04-02  |  7.0 KB  |  162 lines

  1.  
  2.                         TRELLIS - The Adventure Interpreter
  3.                       (c) copyright 1991-9 Soft Rock Software
  4.  
  5.                                    Storing Data
  6.                                    ------------
  7.  
  8. In any computer program that performs any useful task there will be a need
  9. to store and access data. You provide a lot of data for Trellis in the files
  10. described in the previous section of these instructions. Most of this data
  11. is put into special variables that you can access from your TScript program.
  12. In addition to these variables there is a set of variables for you to store
  13. numbers in, which can represent whatever you want them to.
  14.  
  15. The complete range of variables you have available are as follows:-
  16.  
  17. Store%(n)
  18. ---------
  19.  
  20. This is the set of variables for storing numbers in. There are 101 of these,
  21. numbered from 0 to 100, so the n in the brackets can be anything in that
  22. range. It can also be a formula that results in a number in that range. The
  23. first 21 of these are set aside for special purposes, but the remaining 80
  24. (numbers 21 to 100) can be used for whatever you want.
  25.  
  26. Store%(0) is used to tell Trellis if the player can see in the dark or not.
  27. If a room (see the description of the Rooms file) is not set up as being a
  28. light room (if it doesn't have an L as part of its third line) Trellis will
  29. look at this store to decide what to do. If it contains -1 (which is often
  30. called TRUE) that means the player is able to see. You could set this to -1,
  31. for example, if the player picks up a torch and switches it on. If it
  32. contains 0 (or FALSE) that means the player can't see if the room is dark.
  33. (In a dark room, if Store%(0) contains 0, Trellis will say "It is too dark to
  34. see anything here.")
  35.  
  36. Store%(1) is used to tell Trellis how much weight the player can carry.
  37. Each object in the game has a weight, and the total weight of the objects
  38. carried can't be higher than the number in Store%(1). You can give an object
  39. a weight higher than this limit if you don't want the player to be able to
  40. pick it up at all. You put the weight limit into this store near the start
  41. of the game.
  42.  
  43. Store%(2) is related to Store%(1) because it contains the total weights of
  44. all the objects carried. You can find out what is in this store, but I would
  45. advise against changing it directly until you are a more experienced Trellis
  46. user because it can have confusing results.
  47.  
  48. Store%(3) contains the number of the location the player is in. Under normal
  49. circumstances you would not need to change this, but there are times when
  50. you might want to - perhaps your game is based around Star Trek and the
  51. player can use the transporter to change locations, or it starts off with a
  52. ship wreck and the player is washed up on a section of beach which is chosen
  53. at random.
  54.  
  55. Store%(4) to Store%(20) do not have specific uses as yet, but they might be
  56. used in future versions of Trellis. In theory you can use these, because
  57. once you have a game up and running there will be no need to alter it to
  58. work in new versions of Trellis - you can carry on supplying it in the
  59. version it was written - so any use Soft Rock Software puts these stores to
  60. in future versions won't affect your game. However, habits are easily
  61. formed: if you start using them you might forget to stop using them when the
  62. software is updated, so it's best to avoid them.
  63.  
  64. Store%(21) to Store%(100) are yours to use freely.
  65.  
  66. The Store%(n) variable is an integer variable. That means it can contain
  67. whole numbers only. The smallest number you can put in one of these
  68. variables is -2147483648 and the biggest is 2147483647. That should be a
  69. big enough range for most games :-)
  70.  
  71. Object Variables
  72. ----------------
  73.  
  74. The variables Object$, List$, Location%, Weight% and Examine$ are all to do
  75. with objects. They are each described below. In each case, the n in the
  76. brackets can be in the range 1 to whatever value you put at the start of
  77. your object definitions (ie. the number of objects). Again, the brackets can
  78. contain a formula that results in a number in this range.
  79.  
  80. Those with a % in the name are integer variables, which can hold a number in
  81. the range given above for stores, though you should be sensible about what
  82. numbers you put in them. Those with a $ in the name are called string
  83. variables, and can hold words and so on.
  84.  
  85. Object$(n)
  86. ----------
  87.  
  88. This is a variable that holds the names of the objects you have defined in
  89. the Objects file. The object name should always be one word, in capitals,
  90. that must be a keyword in the words file (this is explained in the previous
  91. section).
  92.  
  93. List$(n)
  94. --------
  95.  
  96. This variable holds the short descriptions of objects you have defined - the
  97. text that appears when Trellis says 'You can see....' or 'You have....' This
  98. would normally be a two or three word description, such as 'a sword' or 'an
  99. enchanted sword'
  100.  
  101. Examine$(n)
  102. -----------
  103.  
  104. This variable holds a longer description of the object - the text that
  105. appears when the player types EXAMINE .....
  106.  
  107. Location%(n)
  108. ------------
  109.  
  110. This variable tells Trellis where the object is to be found in the game. As
  111. a general rule, it should hold a number from -1 to the number of rooms. -1
  112. is used to 'hide' the object, so that it is not in play. The player can't
  113. find it, or use it, or whatever. If the player is carrying the object, the
  114. Location%(n) variable should contain the value 0.
  115.  
  116. Weight%(n)
  117. ----------
  118.  
  119. This variable holds the weight of the object. This is used in conjunction
  120. with Store%(1) and Store%(2) to see if the player can carry it.
  121.  
  122. Room Variables
  123. --------------
  124.  
  125. The variables Room$, Light%, North%, East%, South%, West%, Up% and Down% are
  126. all to do with descriptions of locations and are described below. In each
  127. case the n in brackets can be from 1 to the number of rooms (and can be a
  128. formula). Again % means integer and $ means string.
  129.  
  130. Room$(n)
  131. --------
  132.  
  133. This contains the description of the location. It is usually displayed on
  134. the screen when the player enters the room, or types LOOK while in that
  135. room - subject to whether or not the room is light and, if not, whether or not
  136. the player can see in the dark.
  137.  
  138. Light%(n)
  139. ---------
  140.  
  141. This is the variable that tells Trellis if a room is light or dark. If it is
  142. light the variable should contain -1, and if it is dark the variable should
  143. contain 0. Trellis will not stop you from using a number outside this range,
  144. but doing so may stop your game from working correctly.
  145.  
  146. You might change this variable to -1 if, for example, the player switches on
  147. the lights and back to 0 if the lights are switched off again.
  148.  
  149. North%(n), East%(n), South%(n), West%(n) Up%(n) and Down%(n)
  150. ------------------------------------------------------------
  151.  
  152. Each of these variables contains the number of the room the player can get
  153. to by moving in the direction given by the name. In other words if
  154. North%(14) contains 52 that means the player can move North from room 14 to
  155. room 52. The variable South%(52) should therefore contain 14 (except in
  156. special circumstances - such as a room being a trap; the player can get in
  157. but not out.)
  158.  
  159. If one of these direction variables contains 0, that means that there isn't
  160. an exit in that direction. You can use this to help include doors in your
  161. game.
  162.