home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tads2os2.zip / TADS.DOC < prev    next >
Text File  |  1992-11-09  |  62KB  |  1,511 lines

  1.  
  2.  
  3.  
  4.  
  5.          TADS: The Text Adventure Development System
  6.         Software for implementing text adventure games
  7.             by Michael J. Roberts
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.             Overview Documentation
  15.  
  16.  
  17.  
  18.  
  19.           Copyright (c) 1992 by Michael J. Roberts.
  20.              All Rights Reserved.
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30. ------------------------------------------------------------------------------
  31. Introduction
  32.  
  33. This is a brief overview of TADS, a program that makes it easier to
  34. write your own text adventure games.  TADS is offered as shareware,
  35. which means that you can try the software for free, but you must
  36. pay for the software if you decide you like it and want to continue
  37. using it.  Registering your copy of TADS gives you many benefits:
  38.  
  39.    - You get the full TADS Author's Manual -- over 200 pages of
  40.      detailed information about how to use TADS, including many
  41.      programming examples.  The TADS Author's Manual describes
  42.      all of the features of TADS in detail.
  43.  
  44.    - You get TDB, the TADS Debugger -- a full-featured source-level
  45.      debugger that lets you examine the internal workings of your
  46.      game while it runs.  With TDB, you can single-step through
  47.      your program's source code, set breakpoints at specific lines
  48.      of code, and examine and change the values of variables in
  49.      your program.
  50.  
  51.    - You'll be notified of future upgrades to TADS, and of other
  52.      products that we develop.
  53.  
  54.    - Your support helps ensure that we can continue to enhance
  55.      and support TADS.
  56.  
  57. Of course, we want you to be able to determine if TADS is useful
  58. to you, so we've provided this overview of the system.  This
  59. overview is intended to help you get started with TADS; the
  60. TADS Author's Manual has full details of the topics described
  61. in this summary.
  62.  
  63.  
  64. ------------------------------------------------------------------------------
  65. Ditch Day Drifter
  66.  
  67. We've included a large sample game, Ditch Day Drifter, with TADS.
  68. The source for the game is in the file DITCH.T.  We included Ditch Day
  69. Drifter as a sample of what TADS can do, and to help you see how you
  70. can go about writing your own game with TADS.  After reading through
  71. this description of TADS, you may find it helpful to look at DITCH.T
  72. to see more examples of how to write TADS code.
  73.  
  74. If you want to play Ditch Day Drifter, you need to compile it first.
  75. On MS-DOS machines, go to the TADS directory and type this:
  76.  
  77.    tc ditch
  78.  
  79. The "tc" command runs the TADS Compiler, which converts the game
  80. source file into a binary executable format.  Run the game with
  81. this command:
  82.  
  83.    tr ditch
  84.  
  85.  
  86. On Macintosh systems, start the compiler by double-clicking on the
  87. application named "TADS Compiler".  The compiler will display a dialog
  88. box with several parameters.  Click on the "Select" button next to the
  89. "Filename" box, then select the file DITCH.T using the normal file
  90. selector dialog that appears.  Then, click on the "Compile" button.
  91. When the compiler finishes, click on the "Quit" button.  Now you
  92. can run the game either by double-clicking on the new document
  93. DITCH.GAM, or by double-clicking on the application "TADS Run-Time",
  94. then selecting DITCH.GAM from the file selector dialog.
  95.  
  96.  
  97.  
  98. ------------------------------------------------------------------------------
  99. What is TADS?
  100.  
  101. TADS is a tool that makes it easier to write text adventure games.
  102. The system consists of a compiler, which reads source code written
  103. in the TADS language, checks it for errors, and converts it to an
  104. internal representation; and a run-time system, which reads commands
  105. typed by the player, and controls the interaction between the player
  106. and your game program.
  107.  
  108. It's easier to write an adventure using TADS than with a general
  109. purpose language for several reasons.
  110.  
  111.    - The TADS language is specially designed for text adventure
  112.      games, so the things you do most frequently in programming
  113.      an adventure are easy to do.
  114.  
  115.    - The run-time system provides an excellent player command
  116.      parser -- you don't need to worry about parsing player
  117.      commands at all.
  118.  
  119.    - All of the work of saving and restoring games, undoing
  120.      commands, controlling the on-screen display, and many
  121.      other low-level tasks, is done automatically by the system.
  122.  
  123.    - TADS includes a large set of common adventure objects,
  124.      implemented using the TADS language.  You can use these
  125.      objects as they are, or make your own customizations.
  126.  
  127.    - Games written with TADS are instantly portable to every
  128.      system on which the TADS run-time system is available --
  129.      you don't even need to recompile your game!
  130.  
  131.  
  132.  
  133. ------------------------------------------------------------------------------
  134. Writing games with TADS
  135.  
  136. To write a game with TADS, you start off by writing your game's
  137. source file with a text editor; you can use any editor that can
  138. produce a plain text file.  Once you've written your source file,
  139. you compile it using the TADS compiler.  If the game had no errors,
  140. you can run the game using the TADS run-time system.  As you write
  141. your game, you'll probably write a little, compile it, try it out,
  142. then go back and add more, compile and try that, and so on.
  143.  
  144.  
  145.  
  146. ------------------------------------------------------------------------------
  147. Getting Started - A Sample Game
  148.  
  149. To help you get started writing your own games with TADS, we'll go
  150. through the implementation of a sample game.  This example is similar
  151. to the one used in chapter one of the TADS Author's Manual.
  152.  
  153. We'll start with about the simplest game possible:  two rooms, and
  154. no items.  We could start with only one room, but then there wouldn't
  155. be anything to do while playing the game; with two rooms, at least
  156. the player can move between the rooms.
  157.  
  158. If you want to try running this game, create a file containing the
  159. program text shown below using your text editor or word processor.
  160. The TADS compiler will accept an ASCII file saved by any text editor.
  161. If you're using a word processor, you may have to choose a special
  162. option to save the file as plain text, without any formatting codes;
  163. refer to your word processor's documentation for details.
  164.  
  165. Note that the lines of equal signs are just borders to show where the
  166. example starts and ends; use only the part between the lines of equal
  167. signs when creating the file.
  168.  
  169. ==============================================================================
  170. /* This is a comment, just like in C */
  171. #include <adv.t>              /* read basic adventure game definitions file */
  172. #include <std.t>                   /* read starting standard functions file */
  173.  
  174. startroom: room                      /* the game always starts in startroom */
  175.    sdesc = "Outside cave"              /* the Short DESCription of the room */
  176.    ldesc = "You're standing in the bright sunlight just
  177.             outside of a large, dark, forboding cave, which
  178.             lies to the north."
  179.    north = cave                 /* the room called "cave" lies to the north */
  180. ;
  181.  
  182. cave: room
  183.    sdesc = "Cave"
  184.    ldesc = "You're inside a dark and musty cave.  Sunlight
  185.             pours in from a passage to the south."
  186.    south = startroom
  187. ;
  188. ==============================================================================
  189.  
  190. To run this example, all you have to do is compile it with TC, the TADS
  191. Compiler, then run it with TR, the TADS Run-time system.  If you named
  192. your sample program file "mygame.t", on most operating systems you can
  193. compile it with this command:
  194.  
  195.    tc mygame
  196.  
  197. and you can run it with this command:
  198.  
  199.    tr mygame
  200.  
  201. Let's look at the sample program line by line.
  202.  
  203. The first line is a #include command.  This command inserts another
  204. source file into your program.  The file "adv.t" (included with the
  205. TADS package) is a set of basic definitions that can be used by most
  206. adventure games.  By including adv.t in your game, you don't need to
  207. worry about defining words such as "the", a large set of verbs (such
  208. as "take", "north", and other common verbs), and many "object classes"
  209. (described later).
  210.  
  211. The next line includes the file "std.t" (which is also included with
  212. the TADS package), which contains additional definitions.  The reason
  213. for placing some definitions in the separate file std.t is that you
  214. will almost always want to change most of the definitions in std.t in
  215. a finished game, whereas the definitions in adv.t can be used unchanged
  216. by many games.  (Even though most finished games will customize the
  217. definitions in std.t, the definitions are good enough to get us started
  218. with this sample game.)
  219.  
  220. The next line says "startroom: room".  This tells the compiler that
  221. you're defining a room named "startroom".  A room is nothing special
  222. to TADS, but adv.t, which we previously included, defines what a room
  223. is.  A room is one of the object classes that we mentioned earlier.
  224.  
  225. The next line defines the "sdesc" for this room.  The sdesc is a
  226. short description; for a room, it is displayed whenever a player
  227. enters the room.  The next line is the "ldesc", or long description;
  228. it is displayed when the player enters the room for the first time,
  229. or asks for the full description with the "look" command.  Finally,
  230. the "north" definition says that another room, called "cave", is
  231. reached when the player types "north" while in startroom.
  232.  
  233. Now let's add a few items that can be manipulated by the player.
  234. We'll add a solid gold skull, and a pedestal for it to sit on.
  235. Add these definitions at the end of the source you've already
  236. created.
  237.  
  238. ==============================================================================
  239. pedestal: surface, fixeditem
  240.    sdesc = "pedestal"
  241.    noun = 'pedestal'
  242.    location = cave
  243. ;
  244.  
  245. goldSkull: item
  246.    sdesc = "gold skull"
  247.    noun = 'skull' 'head'
  248.    adjective = 'gold'
  249.    location = pedestal
  250. ;
  251. ==============================================================================
  252.  
  253. As with the "room" class, the "surface", "fixeditem", and "item" classes
  254. are not built in to TADS, but are defined in adv.t.  Note that you can
  255. create an object using more than one class; in the example, the pedestal
  256. object is both a surface and a fixeditem.  A surface is an object that
  257. can have other objects placed upon it; a fixeditem is an object that can't
  258. be picked up and carried by the player.  The goldSkull object is simply
  259. an item, which is an object that the player can pick up and carry around.
  260.  
  261. As with a room, the sdesc property gives a short description of the object;
  262. it should simply be the name of the object.  There is no ldesc property
  263. defined for these objects, so they get the default long descriptions
  264. defined by their classes.  The ldesc for an item simply says, for
  265. example, "It looks like an ordinary gold skull"; for a surface, it
  266. lists the objects sitting on the surface.
  267.  
  268. Since these objects can be manipulated by the player, they must be
  269. associated with vocabulary words.  The noun and adjective definitions
  270. specify the words the player can use to refer to the objects.  Note that
  271. the sdesc and ldesc properties are enclosed in double quotes, but the
  272. vocabulary words are enclosed in single quotes.  Note also that a noun
  273. or adjective can have multiple vocabulary words.
  274.  
  275. The objects have another new property as well:  location.  This simply
  276. defines the object that contains the object being defined.  In the case
  277. of the pedestal, its location is the room "cave"; since the goldSkull
  278. is on the pedestal, its location is the object "pedestal".
  279.  
  280. Now let's add another feature to the game:  let's add a trap, so that
  281. the player can't take the gold skull without getting killed.  To do
  282. this, we'll replace the goldSkull definition shown above with the new
  283. definition below.
  284.  
  285. ==============================================================================
  286. goldSkull: item
  287.    sdesc = "gold skull"
  288.    noun = 'skull' 'head'
  289.    adjective = 'gold'
  290.    location = pedestal
  291.    doTake(actor) =
  292.    {
  293.      "As you lift the skull, a volley of poisonous
  294.      arrows is shot from the walls!  You try to
  295.      dodge the arrows, but they take you by surprise!";
  296.      die();
  297.    }
  298. ;
  299. ==============================================================================
  300.  
  301. The definition of doTake (which stands for Direct Object Take) has an
  302. argument specifying the character who is trying to take the object
  303. (since we have no characters besides the player, the actor will be
  304. the player's character, named "Me").  The system calls doTake whenever
  305. the player attempts to take the object.  Note that this definition of
  306. doTake is associated with the object itself; another object could have
  307. a different doTake that does something entirely different.  In this
  308. case, we simply display a message (since the message is enclosed in
  309. double quotes, it is simply displayed when this statement is executed),
  310. then call the "die" function, which is defined in std.t.
  311.  
  312. You might wonder why we've waited until now to define doTake in the
  313. goldSkull object, or you might have just assumed that the system
  314. automatically knows what to do if doTake is not defined for an object.
  315. In fact, all objects do need a doTake definition, and the system has
  316. no default behavior if the definition is missing.  However, since
  317. most objects will have a very similar doTake definition, it would be
  318. extremely tedious to have to type the whole definition for every
  319. normal object.  Instead, we use something called "inheritance": by
  320. defining the goldSkull to be a member of the "item" class, you tell
  321. TADS that the goldSkull object inherits all of the definitions from
  322. the item class, in addition to any definitions it makes on its own.
  323. The item class (in adv.t) has a definition for doTake that is suitable
  324. for most objects.  However, if an object of class "item" has its
  325. own definition of doTake, the one in the object takes precedence --
  326. it "overrides" the default definition from the class.
  327.  
  328. We don't have a very good puzzle at this point, because there's no
  329. way the player can get the gold skull without getting killed.  So,
  330. let's make it possible for the player to get the skull.  We'll assume
  331. that the mechanism that the pedestal uses to set off the poisoned
  332. arrow trap is a weight sensor:  when the pedestal has too little
  333. weight on it, the trap is set off.  So, we'll create a rock that
  334. the player can use to keep the trap from going off:  the player puts
  335. the rock on the pedestal, then can take the skull.  Add the new
  336. definition below to the end of your source file.
  337.  
  338. ==============================================================================
  339. smallRock: item
  340.    sdesc = "small rock"
  341.    noun = 'rock'
  342.    adjective = 'small'
  343.    location = cave
  344. ;
  345. ==============================================================================
  346.  
  347. Now, we'll change the definition of doTake in the goldSkull object.
  348. Replace the old definition of doTake with the one below.
  349.  
  350. ==============================================================================
  351.    doTake(actor) =
  352.    {
  353.       if (self.location <> pedestal or smallRock.location = pedestal)
  354.       {
  355.          pass doTake;
  356.       }
  357.       else
  358.       {
  359.          "As you lift the skull, a volley of poisonous
  360.          arrows is shot from the walls!  You try to dodge
  361.          the arrows, but they take you by surprise!";
  362.          die();
  363.       }
  364.    }
  365. ==============================================================================
  366.  
  367. This new doTake definition first checks to see if the object being taken
  368. (the special object "self", which is the object whose doTake definition
  369. is being executed), in this case, the gold skull, is already off the
  370. pedestal; if it is, we don't want anything to happen, so we "pass"
  371. doTake.  We also pass doTake if the small rock is on the pedestal.  When
  372. we pass doTake, the doTake definition that we inherited from our parent
  373. class (in this case, item) is invoked.  This allows us to override a
  374. definition only under certain special circumstances, but otherwise
  375. use the default behavior.  If the rock isn't on the pedestal, and the
  376. skull is being removed from the pedestal, the poisoned arrows are
  377. released as before.
  378.  
  379. We've included a file named GOLDSKUL.T that includes this sample
  380. game, with the complete puzzle involving the gold skull and the
  381. pedestal.  You can compile and run that file by typing these
  382. commands:
  383.  
  384.    tc goldskul
  385.    tr goldskul
  386.  
  387.  
  388. ------------------------------------------------------------------------------
  389. The TADS Language
  390.  
  391. If you know how to program in a "procedural" language like C or
  392. Pascal, most of the TADS language will probably look very familiar.
  393. However, the overall structure of a TADS program will probably seem
  394. a little strange at first.
  395.  
  396. In particular, you'll probably wonder where the program begins.
  397. The answer is that a TADS game doesn't have a beginning in the same
  398. sense that a C or Pascal program does.
  399.  
  400. A C program, like a program written in any procedural language,
  401. is a sequence of instructions.  The program starts running at
  402. the main() function, and carries out the instructions listed
  403. there in the order they appear.  The program may call subroutines
  404. or iterate through loops along the way, but control flows
  405. essentially sequentially through the program.
  406.  
  407. A TADS program, in contrast, is simply a series of object definitions.
  408. Each definition specifies the behavior of a single object in the game.
  409. An object definition consists of a series of "properties", which are
  410. attributes of the object.  A property can contain some simple
  411. information, such as the name of the object, or its weight, or can
  412. contain programming language code that defines the object's behavior.
  413.  
  414. Obviously, the information you specify in your object definitions
  415. has to be used somehow -- something has to call the program code that
  416. you write.  In TADS, it's the player command parser that does the work
  417. of deciding which properties to use in which objects in response to
  418. the player's commands.
  419.  
  420. Later on, we'll describe in detail how the parser decides which properties
  421. to evaluate.  In order to take full advantage of the power of TADS by
  422. creating your own types of objects, you'll need to understand how the
  423. parser works.  However, one of the advantages of using TADS is that
  424. you can define objects using existing types without having to know
  425. everything about how those types work.  So, we'll start off by showing
  426. you how to create some simple objects that you'll find in almost every
  427. adventure game.
  428.  
  429.  
  430. ------------------------------------------------------------------------------
  431. Creating a Room
  432.  
  433. The first type of object you'll want to create in an adventure game
  434. is a room, which is simply a location in the game.  The attributes of
  435. a room are typically its name, its description, and links to other
  436. rooms.
  437.  
  438. The first thing you'll need to do in defining a room, or any TADS
  439. object, is to choose its object name.  This is not a name that is
  440. ever displayed to or used by the player -- it is a purely internal
  441. name that you use to refer to the object within the TADS program.
  442. It is similar to the name of a variable in C or Pascal.  In TADS,
  443. the name of an object must start with a letter, and can consist of
  444. letters, numbers, and underscores.
  445.  
  446. Here's a sample room definition.
  447.  
  448.    nsCrawl:  room
  449.       sdesc = "North-South Crawl"
  450.       ldesc = "You're in a narrow, low passage connecting
  451.               caves to the north and south.  A cold, damp
  452.               breeze comes from the north."
  453.       north = iceRoom
  454.       south = roundRoom
  455.    ;
  456.  
  457. The first line of the object definition gives the object its name,
  458. "nsCrawl", and specifies the type of the object.  Note that the case
  459. of the letters in the name is significant -- "nsCrawl" is a different
  460. name than "NSCrawl" or "nscrawl".
  461.  
  462. The next line specifies a property of the object -- the sdesc, or
  463. short description.  It says that the property sdesc is the string
  464. "North-South Crawl".  The sdesc is displayed whenever the player
  465. enters the room, and is also used on the status line.
  466.  
  467. In TADS, double-quoted strings are special:  they mean that the
  468. string is to be displayed whenever the property is evaluated.
  469. Double-quoted strings are similar to using a PRINT statement in
  470. other languages.  So, whenever the sdesc property of the nsCrawl
  471. object is evaluated, the string "North-South Crawl" will be displayed
  472. to the player.
  473.  
  474. The next line defines the ldesc, or long description, property.
  475. This is the full description of the room that is displayed when
  476. the player enters the room for the first time, or whenever the player
  477. uses the "look" command to ask for a full description.  Note that
  478. this property's value is a double-quoted string, just like the sdesc,
  479. to indicate that the string is displayed whenever the ldesc is
  480. evaluated.
  481.  
  482. The next two lines specify the directional properties north and south.
  483. These properties are set to refer to other room objects.  They specify
  484. that the player will end up in the room defined by the object
  485. iceRoom by going north, and in roundRoom by going south.  Note that
  486. other directions are not specified -- this simply means that the player
  487. can't go in any other directions.  The other possible direction properties
  488. are east, west, up, down, in, out, ne, se, nw, and sw (the last four
  489. stand for northeast, southeast, northwest, and southwest, respectively).
  490.  
  491. The final line of the room definition is a semicolon, which tells TADS
  492. that the object definition is finished.
  493.  
  494.  
  495. ------------------------------------------------------------------------------
  496. Creating Items
  497.  
  498. In addition to rooms, you'll want to create objects that the player
  499. can pick up and carry around.  These are objects of type "item".
  500. When you define an item, you'll need to specify another set of
  501. properties:  its short and long descriptions (just like rooms),
  502. its location (which says where the object is originally situated),
  503. and vocabulary words that specify how the player can refer to the
  504. object.  Here are a couple of item definitions.
  505.  
  506.    dollar: item
  507.       location = nsCrawl
  508.       sdesc = "one-dollar bill"
  509.       noun = 'dollar' 'bill'
  510.       adjective = 'one' 'one-dollar' '1' 'dollar'
  511.    ;
  512.  
  513.    rope: item
  514.       noun = 'rope'
  515.       sdesc = "rope"
  516.       ldesc = "It's about 50 feet long, and seems quite strong; it's
  517.               probably capable of handling several hundred pounds."
  518.       location = backpack
  519.    ;
  520.  
  521. The first thing to notice here is that vocabulary words are enclosed
  522. in single quotes, not double quotes.  Recall that double-quoted strings
  523. are displayed whenever evaluated; this is obviously not desirable for
  524. vocabulary words.  So, always specify vocabulary words with single quotes.
  525.  
  526. You may also notice that more than one single-quoted string can be
  527. used with a vocabulary property.  This is a unique feature of vocabulary
  528. properties (the vocabulary properties are noun, adjective, plural,
  529. verb, preposition, and article).  When you use more than one word
  530. in a vocabulary property, it simply creates multiple synonyms that can
  531. be used to refer to the object.
  532.  
  533. Note that the properties can be defined in any order.  Note also that
  534. you don't need to specify every property; for example, if the ldesc
  535. property is not specified with an item, a default message ("It looks
  536. like an ordinary one-dollar bill") is displayed.  However, practically
  537. every item will define the properties sdesc, location, and noun.
  538.  
  539. The location property specifies the original location of the object.
  540. In many cases, the location will refer to a room object.  However, it
  541. can also refer to another game item; in these cases, the item should
  542. be a container, as described below.
  543.  
  544.  
  545. ------------------------------------------------------------------------------
  546. Containers
  547.  
  548. You will often want to create items that can contain other items.
  549. To do this, simply create an item of type "container" rather than
  550. "item".  In other respects, a "container" object is the same as
  551. an "item", and you specify the same set of properties.  Here's an
  552. example.
  553.  
  554.    backpack: container
  555.       sdesc = "backpack"
  556.       location = maintenanceRoom
  557.       noun = 'backpack' 'pack' 'bag'
  558.       adjective = 'back'
  559.    ;
  560.  
  561. In addition to container objects, you can create "openable" objects.
  562. These are the same as containers, except that they can be opened and
  563. closed.  When you create a container, there's a new property,
  564. "isopen", that specifies whether the object is open or closed.
  565. If you want the object to be closed initially, set isopen = nil.
  566. Here's an example.
  567.  
  568.    toolbox: openable
  569.       sdesc = "tool box"
  570.       location = maintenanceRoom
  571.       noun = 'toolbox' 'box'
  572.       adjective = 'tool'
  573.       isopen = nil
  574.    ;
  575.  
  576.  
  577. ------------------------------------------------------------------------------
  578. Fixed Items
  579.  
  580. You will frequently want to create items in the game that the player
  581. can't pick up and carry around, but that are permanent features of
  582. a room.  For example, if you create a bedroom, you'll probably want
  583. to have a bed and maybe a dresser in the room.  It doesn't make sense
  584. for the player to be able to carry off the furniture.
  585.  
  586. To create an item that the player can't carry, create an object of
  587. type "fixeditem".  You define fixeditem objects that same way that
  588. you define item objects; the only difference is that fixeditem objects
  589. can't be carried off by the player.
  590.  
  591. Here's an example.
  592.  
  593.    bed: fixeditem
  594.       location = bedroom
  595.       noun = 'bed'
  596.       sdesc = "Bed"
  597.    ;
  598.  
  599.  
  600. ------------------------------------------------------------------------------
  601. Inheritance and ADV.T
  602.  
  603. Up to now, we've been describing the various types of objects that
  604. you can create, and the properties that you have to define when
  605. creating those objects.  It may appear that these object types are
  606. somehow built in to TADS.  In fact, none of these types are special;
  607. they're all defined using the TADS language.
  608.  
  609. The objects we've seen so far -- room, item, container, openable,
  610. fixeditem -- are defined in the file ADV.T.  This file is a set of
  611. object type definitions that are suitable for most games, but they're
  612. not at all special, so you can take them or leave them as you choose.
  613. You could even completely rewrite ADV.T if you want your game to
  614. behave differently.
  615.  
  616. Note that you can create objects using the types defined in ADV.T
  617. (or in your own program) very easily -- as though the types were
  618. somehow built in to TADS.  The trick that makes this possible is
  619. called "inheritance".  The TADS language allows you to define an
  620. object so that it inherits all of the properties of another object.
  621. This is what you're doing when you create an object of type room:
  622. you're telling TADS that it should create a new object exactly like
  623. the object "room" that it's already seen, except that you want to
  624. add some new properties of your own.  If you look at ADV.T, you'll
  625. see that the definition of the room object is very complex; however,
  626. you can create objects of type room without having to know very
  627. much about the room object itself -- all you need to know is what
  628. properties you need to add to the new object.
  629.  
  630. ADV.T defines many more objects than we've talked about so far.
  631. You should refer to ADV.T for complete information on the
  632. standard adventure objects, and how to use them.  Here's a brief
  633. list.
  634.  
  635.    nestedroom    -- a room within another room
  636.    chairitem     -- a chair (something the player can sit on)
  637.    beditem       -- a bed (something the player can lie down on)
  638.    thing         -- low-level item class (not normally used directly)
  639.    item          -- a simple item the player can pick up and carry
  640.    lightsource   -- something that provides light
  641.    hiddenItem    -- an object that starts off hidden within another object
  642.    hider         -- low-level hider class (not used directly)
  643.    underHider    -- an object that can have objects hidden under it
  644.    behindHider   -- an object that can have objects hidden behind it
  645.    searchHider   -- an object that can have objects hidden within it
  646.    fixeditem     -- an immovable item
  647.    readable      -- something the player can read
  648.    fooditem      -- something the player can eat
  649.    dialItem      -- something the player can turn to various values
  650.    switchItem    -- something the player can turn on and off
  651.    room          -- a location in the game
  652.    darkroom      -- a location without any lighting of its own
  653.    Actor         -- a character in the game
  654.    moveableActor -- a character that the player can pick up and carry
  655.    follower      -- a psuedo-object that can be used to follow actors
  656.    basicMe       -- a set of definitions suitable for most player actors
  657.    decoration    -- an item that serves no purpose other than decoration
  658.    buttonItem    -- something the player can push
  659.    clothingItem  -- something the player can wear
  660.    obstacle      -- something that blocks travel
  661.    doorway       -- one side of a door
  662.    lockableDoorway -- a door that can be locked
  663.    vehicle       -- an item that can be used for travel
  664.    surface       -- an item that can have objects placed upon it
  665.    container     -- an item that can have objects placed within it
  666.    openable      -- a container that can be opened and closed
  667.    qcontainer    -- a container that doesn't list its contents automatically
  668.    lockable      -- an openable that can be locked and unlocked
  669.    keyedLockable -- a lockable that needs a key to be locked and unlocked
  670.    keyItem       -- an item that can lock and unlock a keyedLockable
  671.    transparentItem -- an object whose contents are visible
  672.    basicNumObj   -- definition suitable for numObj in most games
  673.    basicStrObj   -- definition suitable for strObj in most games
  674.    deepverb      -- a verb object
  675.    travelVerb    -- a verb object for travel verbs
  676.    sysverb       -- a "system" verb
  677.    Prep          -- a preposition object
  678.  
  679. Each object in ADV.T is fully described in a comment preceding its
  680. definition.  The comments tell what properties you need to define
  681. when creating an object of each type, and how the object will behave.
  682.  
  683.  
  684. ------------------------------------------------------------------------------
  685. Methods
  686.  
  687. We mentioned earlier that a property can contain a simple value,
  688. such as a string or a number, or programming code that defines its
  689. behavior.  When a property contains code, it is called a "method".
  690. With the exception of vocabulary properties, any property can
  691. contain programming code instead of a simple value.
  692.  
  693. Programming code starts with a left brace ("{"), and ends with
  694. a matching right brace ("}").  Within the braces, you can use
  695. programming language statements that create local variables,
  696. call functions and methods, assign values to properties and
  697. variables, and control flow with loops and conditionals.  The
  698. programming code used in TADS methods looks similar to the C
  699. language, but there are some differences.
  700.  
  701. Here's an example of an object incorporating a method.  In this
  702. case, the object defines its ldesc property using a method,
  703. rather than a simple double-quoted string value, so that the
  704. property can be sensitive to the state of a window.
  705.  
  706.    attic: room
  707.       sdesc = "Attic"
  708.       ldesc =
  709.       {
  710.          "You're in a large, dusty attic.  Old cobwebs hang
  711.          from the rafters.  At the north end of the room is
  712.          a window, which is ";
  713.          if (atticWindow.isopen)
  714.             "open";
  715.          else
  716.             "closed";
  717.          ". A ladder leads down.";
  718.       }
  719.       down = hallway
  720.    ;
  721.  
  722. The ldesc property displays a message that depends on whether the
  723. window is open or closed.  For example, if the window is open, the
  724. room's long description would look like this:
  725.  
  726.    You're in a large, dusty attic.  Old cobwebs hang from the
  727.    rafters.  At the north end of the room is a window, which
  728.    is open.  A ladder leads down.
  729.  
  730.  
  731. ------------------------------------------------------------------------------
  732. Expressions
  733.  
  734. TADS expressions are entered in algebraic notation.  For example,
  735. to add two numbers, you would code an expression like this:
  736.  
  737.    3 + 4
  738.  
  739. You can use parentheses to change the order of evaluation of the
  740. parts of an expression.  For example, since multiplication has higher
  741. precedence than addition, the expression 3 + 4 * 5 evaluates to 23;
  742. however, if you write this as (3 + 4) * 5, its value is 60, because
  743. the addition is performed before the multiplication.
  744.  
  745. If you want to assign a value, you use the operator ":=" (a colon
  746. followed immediately by an equals sign, without any intervening spaces).
  747. For example, to assign the value nil to the isopen property of the
  748. object atticWindow, you'd code this:
  749.  
  750.    atticWindow.isopen := nil;
  751.  
  752. The period (or "dot") operator, ".", is used to take a property of
  753. an object.  In the example above, it specifies the isopen property of
  754. the object atticWindow.  You can use the value of a property in an
  755. expression, or assign a new value to a property, using this operator.
  756.  
  757. Here are the TADS operators, shown in the order of evaluation.
  758.  
  759.    &      Takes the "address" of a function or property.
  760.  
  761.    .      Takes a property of an object:  obj.prop evaluates property
  762.           prop of object obj.
  763.  
  764.    []     List indexing.  If var contains the list [5 4 3 2 1], then
  765.           var[2] is 4, var[4] is 2, var[5] is 1, and so on.
  766.  
  767.    ++     Increment a variable that contains a number, assigning the
  768.           incremented value back to the variable.  If var contains
  769.           5, it will contain 6 after var++ is evaluated.
  770.  
  771.    --     Decrement.
  772.  
  773.    not    Logical negation.  not true is nil, and not nil is true.
  774.  
  775.    -      Arithmetic negation (when used as a unary prefix operator).
  776.  
  777.    *      Numeric multiplication:  5 * 6 is 30.
  778.  
  779.    /      Numeric integer division:  30 / 5 is 6.  Note that any
  780.           fractional part of the division is discarded, so 5 / 2 is 2.
  781.  
  782.    +      Numeric addition:   3 + 4 is 7.
  783.           String concatenation:  'hello' + 'goodbye' yields 'hellogoodbye'.
  784.           List concatenation:  [1 2] + [3 4] yields [1 2 3 4].
  785.           List extension:  [1 2] + 3 yields [1 2 3].
  786.  
  787.    -      Numeric subtraction:  10 - 3 is 7.
  788.           List removal:  [1 2 3] - 2 yields [1 3].
  789.  
  790.    =      Equality comparison; a = b yields true if the value of a
  791.           is the same as the value of b, nil otherwise.  Note that
  792.           the types of a and b must be suitable for comparison; you
  793.           can compare two numbers, strings, lists, objects, or
  794.           truth values (true and nil); but comparing a number to a
  795.           string is meaningless, and results in a run-time error.
  796.  
  797.    <>     Inequality comparison; a <> b is true if a is not equal
  798.           to b, nil otherwise.
  799.  
  800.    >      Greater than comparison.  You can compare the magnitude
  801.           of two numbers or two strings.
  802.  
  803.    <      Less than comparison.
  804.  
  805.    >=     Greater than or equal.
  806.  
  807.    <=     Less than or equal.
  808.  
  809.    and    Logical product:  a and b is true if both a and b are true,
  810.           nil otherwise.  Note that if a is nil, b is not evaluated,
  811.           because the expression's result is nil regardless of the value
  812.           of b.
  813.  
  814.    or     Logical sum:  a or b is true if either a or b is true, or
  815.           if both are true.  Note that if a is true, b is not evaluated.
  816.  
  817.    ? :    Conditional operator:  cond ? a : b yields the value of a
  818.           if cond is true, b if cond is nil.  Note that only one of
  819.           a or b is evaluated.
  820.  
  821.    :=     Assignment.
  822.  
  823.    +=     Add and assign:  the value of the variable or property on
  824.           the left has the value of the expression on the right added
  825.           to it.  a += b is equivalent to a := a + b.
  826.  
  827.    -=     Subtract and assign.
  828.  
  829.    *=     Multiply and assign.
  830.  
  831.    /=     Divide and assign.
  832.  
  833.    ,      Conjunction:  the expression on the left of the comma is
  834.           evaluated, then the expression on the right is evaluated
  835.           and used as the value of the entire conjunction expression.
  836.           So, the value of (a, b) is b.
  837.  
  838.  
  839. ------------------------------------------------------------------------------
  840. Self
  841.  
  842. Within a method, there's a special pseudo-object called "self" that
  843. lets you determine the object whose method is being evaluated.  This
  844. may sound pretty useless, but consider a situation in which you're
  845. defining an object that inherits from another object.
  846.  
  847.    book: item
  848.       sdesc =
  849.       {
  850.         "The book is "; self.color; ". ";
  851.       }
  852.    ;
  853.  
  854.    redbook: book
  855.       color = "red"
  856.    ;
  857.  
  858.    bluebook: book
  859.       color = "blue"
  860.    ;
  861.  
  862. Here, the superclass object, book, can define a generic sdesc method
  863. which automatically adjusts to the individual subclass objects.
  864. When redbook.sdesc is evaluated, the actual sdesc code that is
  865. executed is inherited from book; however, since it is redbook.sdesc
  866. that is being evaluated, self is set to redbook, so when book.sdesc
  867. evaluated self.color, "red" is displayed.  Likewise, when bluebook.sdesc
  868. is evaluated, self is set to bluebook, so self.color displays "blue".
  869. The classes defined in ADV.T make extensive use of this mechanism
  870. to allow them to define generic attributes of the classes which
  871. automatically customize themselves to the objects you create in
  872. your game, even though the authors of ADV.T couldn't possibly
  873. have known anything about your objects beforehand.
  874.  
  875.  
  876. ------------------------------------------------------------------------------
  877. When do Methods Run?
  878.  
  879. Before we talk about how to write TADS methods in any more detail, we
  880. should look at how the TADS parser works, because it's the parser that
  881. decides what methods to call.
  882.  
  883. When the player types a command to TADS, the parser breaks the command
  884. into a series of words.  The parser then looks through its tables of
  885. vocabulary words to see what objects are associated with those words;
  886. remember that the special properties verb, noun, plural, adjective,
  887. article, and preposition associate an object with a set of vocabulary
  888. words.  Once the parser has determined which objects are involved in
  889. the command, it calls a series of methods in those objects; these
  890. methods do all the work of processing the command.  Since the methods
  891. are defined in the objects, you can change almost any aspect of the
  892. behavior of a TADS game; however, thanks to inheritance, you don't
  893. have to change anything if you don't want to -- you can use the
  894. definitions from ADV.T as they are, filling in only the necessary
  895. descriptive text and properties.
  896.  
  897. The command is associated with a set of objects; each object is
  898. classified according to its function in the command.  The objects
  899. are the actor, the verb, an optional set of direct objects, and
  900. an optional preposition and indirect object.  If the player didn't
  901. direct the command to a different character (for example:  "floyd,
  902. give me the ball"), the player-actor, Me, is assumed.
  903.  
  904. The sequence of method calls is shown below.  The actual objects
  905. making up the command are substituted for the items in <angle
  906. brackets>.  If one of the objects is not used in the command,
  907. the corresponding object parameter will be nil (for example,
  908. if there is no direct object, <dobj> will be replaced by nil).
  909.  
  910. In the list below, you'll also see something named <verb-prefix>.
  911. This is a special string that is defined in the deepverb objects;
  912. we'll discuss this below.  If the <verb-prefix> is, for example,
  913. 'Take', then the method meant by do<verb-prefix> is doTake.
  914.  
  915.    <actor> . roomCheck( <verb> )
  916.    <actor> . actorAction( <verb>, <dobj>, <prep>, <iobj> )
  917.    <actor> . location . roomAction( <actor>, <verb>, <dobj>, <prep>, <iobj> )
  918.  
  919.    If an indirect object was specified:
  920.       <dobj> . verDo<verb-prefix>( <actor>, <iobj> )
  921.       If no output resulted from verDo<verb-prefix>:
  922.          <iobj> . verIo<verb-prefix>( <actor> )
  923.          If no output resulted from verIo<verb-prefix>:
  924.             <iobj> . io<verb-prefix>( <actor>, <dobj> )
  925.    Else if a direct object was specified:
  926.       <dobj> . verDo<verb-prefix>( <actor> )
  927.       If no output resulted from verDo<verb-prefix>:
  928.          <dobj> . do<verb-prefix>( <actor> )
  929.    Else:
  930.       <verb> . action( <actor> )
  931.  
  932.    Run each daemon that is currently active
  933.    Run and remove each fuse that has burned down to zero turns
  934.  
  935. The <verb-prefix> is read from the verb object when a direct or
  936. indirect object is present.  The <verb-prefix> is a string specified
  937. by the property doAction when only a direct object is present, or
  938. from the appropriate ioAction when both a direct and an indirect object
  939. are present.  For example, consider this verb object:
  940.  
  941.    takeVerb: deepverb
  942.       verb = 'take'
  943.       sdesc = "take"
  944.       doAction = 'Take'
  945.       ioAction(outofPrep) = 'TakeOut'
  946.       ioAction(awayPrep) = 'TakeAway'
  947.    ;
  948.  
  949. If the command is "take ball", only a direct object is present, so
  950. the doAction property is used, and hence the <verb-prefix> is 'Take'.
  951. This means that the methods called in the direct object will be
  952. verDoTake and doTake.  In this case, the sequence of methods that
  953. the parser calls would be:
  954.  
  955.    Me.roomCheck(takeVerb)
  956.    Me.actorAction(takeVerb, ball, nil, nil)
  957.    Me.location.roomAction(Me, takeVerb, ball, nil, nil)
  958.    ball.verDoTake(Me)
  959.    if no ouput resulted from verDoTake:
  960.       ball.doTake(Me)
  961.  
  962. If the command is "take ball out of box", the ioAction property
  963. matching the preposition "out of" is used; this is 'TakeOut'.  So,
  964. the properties called in the objects are verDoTakeOut, verIoTakeOut,
  965. and ioTakeOut.  In this case, the sequence of methods called by
  966. the parser would be:
  967.  
  968.    Me.roomCheck(takeVerb)
  969.    Me.actorAction(takeVerb, ball, box, outofPrep)
  970.    Me.location.roomAction(Me, takeVerb, ball, box, outofPrep)
  971.    ball.verDoTakeOut(Me, box)
  972.    If no output resulted from verDoTakeOut:
  973.       box.verIoTakeOut(Me)
  974.       If no output resulted from verIoTakeOut:
  975.          box.ioTakeOut(Me, ball)
  976.  
  977. This sequence may look terribly complicated, but generally you won't
  978. have to customize or even think about very much of it.  In almost
  979. every case, you'll be able to achieve the effect you want by customizing
  980. the verDo<prefix>, do<prefix>, verIo<prefix>, and io<prefix> methods.
  981.  
  982. Note that the verDo<prefix> and verIo<prefix> methods are intended
  983. to be used to verify that the object can be used in this command,
  984. and the do<prefix> and io<prefix> methods are supposed to actually
  985. carry out the command.  The way this works is that the verDo<prefix>
  986. and verIo<prefix> methods should display an error message if the
  987. object cannot be used for this command, and should do nothing at
  988. all if the object is usable.  This may sound like a strange way
  989. to decide whether the object is valid, but it makes it extremely
  990. convenient to write these methods -- all you have to do is display
  991. an error message if appropriate during verification.
  992.  
  993.  
  994. ------------------------------------------------------------------------------
  995. Programming Statements
  996.  
  997. Within a method, or within a function, you can use a number of
  998. statements that control execution.
  999.  
  1000.  
  1001. local <variable-list> ;
  1002.  
  1003.    This statement can be used only at the very start of a block
  1004.    of code (that is, immediately following an open brace).  The
  1005.    "local" statement defines a list of variables that are private
  1006.    to the block of code; these variables cannot be used outside
  1007.    of the block.  Variable names follow the same rules as other
  1008.    identifiers, such as object and property names:  they must
  1009.    start with a letter, and consist of letters, numbers, and
  1010.    underscores.
  1011.  
  1012.    Example:
  1013.  
  1014.        ldesc =
  1015.     {
  1016.        local cnt, loc;
  1017.  
  1018.            cnt := 0;
  1019.            loc := nil;
  1020.     }
  1021.  
  1022.  
  1023. return <expression> ;
  1024.  
  1025.    Return to the caller.  The <expression> is evaluated, and the result
  1026.    is supplied to the caller as the value of the method or function.
  1027.    Control is returned to the caller at the point immediately following
  1028.    the call to the current method or function; no further statements
  1029.    in the current method or function are executed.
  1030.  
  1031. return ;
  1032.  
  1033.    Return to the caller without providing a value.
  1034.  
  1035. if ( <expression> ) <statement1> else <statement2>
  1036.  
  1037.    Evaluate the <expression>; if the value is not nil or 0, execute
  1038.    <statement1>.  Otherwise, execute <statement2>.  Note that the
  1039.    entire "else" clause is optional; if it is not provided, and the
  1040.    value of <expression> is nil or 0, execution resumes following
  1041.    <statement1>.
  1042.  
  1043.    Note that <statement1> and <statement2> can either be a single
  1044.    statement, or can be a series of statements enclosed in braces.
  1045.  
  1046.    Example:
  1047.  
  1048.        if (torch.islit)
  1049.         {
  1050.            "You suddenly realize that the odor was coal gas,
  1051.             and that you're carrying a burning torch.  You
  1052.             try to retreat, but it's too late; the torch
  1053.             ignites the gas, resulting in a terrible explosion.";
  1054.             die();
  1055.         }
  1056.         else
  1057.             "You realize that the odor was coal gas.
  1058.              Fortunately, there's no open flame here.";
  1059.  
  1060.  
  1061. switch ( <expression> )
  1062. {
  1063. case <constant1>:   <statements1>; 
  1064. case <constant2>:   <statements2>;
  1065. default:  <statements3>;
  1066. }
  1067.  
  1068.    This statement allows you to choose a number of execution
  1069.    paths, based on the value of an expression.  The <expression>
  1070.    is evaluated, then compared to the various constants at the case
  1071.    labels.  If a case label matches the value of the expression,
  1072.    execution resumes at the statement following that case label.
  1073.    If no case label matches the value, and a default label is
  1074.    present, execution resumes following the default.  The default
  1075.    label is optional.
  1076.  
  1077.    Note that execution is not interrupted by hitting another
  1078.    case label, but just continues into the statements following it.
  1079.    Note also that a case label need not have any statements at all
  1080.    following it.  If you want to exit the switch statement, you
  1081.    must explicitly code a break statement; this causes execution
  1082.    to resume following the end of the switch statement.
  1083.  
  1084.    Example:
  1085.  
  1086.        switch(x)
  1087.         {
  1088.     case 1:
  1089.     case 2:
  1090.        "x is 1 or 2";
  1091.        break;
  1092.  
  1093.     case 3:
  1094.        "x is 3";
  1095.            /* note the lack of a break, so we fall through to next case */
  1096.  
  1097.     case 4:
  1098.        "x is 3 or 4";
  1099.        break;
  1100.  
  1101.     default:
  1102.        "x is 5 or more";
  1103.         }
  1104.  
  1105.  
  1106. while ( <expression> ) <statement>
  1107.  
  1108.    Execute <statement> repeatedly as long as the value <expression>
  1109.    is not nil or 0.  The <expression> is evaluated before each
  1110.    execution of <statement>, so if the value of <expression> is
  1111.    nil or 0 before the first execution of the loop, the <statement>
  1112.    is not executed at all.  As with the if statement, the <statement>
  1113.    can be either a single statement, or a block of statements enclosed
  1114.    in braces.
  1115.  
  1116.    Example:
  1117.  
  1118.        while (cnt < length(lst))
  1119.         {
  1120.        "The next item is: "; say(lst[cnt]); "\n";
  1121.            ++cnt;
  1122.         }
  1123.  
  1124. do <statement> while ( <expression> );
  1125.  
  1126.    This statement is similar to the while statement, but evaluates
  1127.    <expression> after each iteration of the loop.  Thus, the <statement>
  1128.    is always executed at least once, since the <expression> is not
  1129.    tested for the first time until after the first iteration of the
  1130.    loop.
  1131.  
  1132.    Example:
  1133.  
  1134.        do
  1135.         {
  1136.        "cnt = "; say(cnt); "\n";
  1137.            --cnt;
  1138.     } while (cnt > 0);
  1139.  
  1140. for ( <init-expr> ; <cond-expr> ; <reinit-expr> ) <statement>
  1141.  
  1142.    This is a more general form of loop.  First, the <init-expr> is
  1143.    evaluated; this is done only once, before the loop starts iterating.
  1144.    For each iteration of the loop, TADS first evaluates the <cond-expr>.
  1145.    If it is nil or 0, the loop terminates; otherwise, <statement> is
  1146.    executed.  Finally, <reinit-expr> is evaluted.  Note that any
  1147.    of the expressions may be omitted; if the <cond-expr> is not
  1148.    present, it is as though the expression were always true.
  1149.  
  1150.    The for statement is often more convenient to code, but it
  1151.    is always possible to write an equivalent loop using the
  1152.    while statement.
  1153.  
  1154.    Example:
  1155.  
  1156.        for (cnt := 1 ; cnt < length(lst) ; ++cnt)
  1157.         {
  1158.            "the next element is: "; say(lst[cnt]); "\n";
  1159.         }
  1160.  
  1161. break;
  1162.  
  1163.    Exits from a while, do-while, or for loop, or from a switch
  1164.    statement.  Control immediately resumes following the end of
  1165.    the loop or switch.  The break statement is useful when the
  1166.    condition for exiting a loop is most conveniently calculated
  1167.    somewhere in the middle of the loop's processing.
  1168.  
  1169. continue;
  1170.  
  1171.    Returns to the beginning of a while, do-while, or for loop.
  1172.    The statements following the continue statement are skipped
  1173.    for this iteration of the loop.  In a for loop, the <reinit-expr>
  1174.    is evaluated after a continue statement.
  1175.  
  1176. pass <property-name>;
  1177.  
  1178.    When a method is executing, and the method has overridden a
  1179.    method in a superclass object, the pass statement will cause
  1180.    control to be passed to the superclass method that the current
  1181.    method overrides.  Note that execution never returns to the
  1182.    current method after a pass statement.  Note also that the
  1183.    <property-name> must match the name of the current property.
  1184.  
  1185. exit;
  1186.  
  1187.    Terminate all processing for the current player command,
  1188.    and skip everything up to the daemons and fuses.  This
  1189.    statement is used when the current method has done everything
  1190.    necessary to finish the command, and no further processing
  1191.    is desirable.
  1192.  
  1193. abort;
  1194.  
  1195.    Terminate all processing for the current player command,
  1196.    skip the daemons and fuses, and go on to the next command.
  1197.    This statement is normally used by "system" verbs, such as
  1198.    "save" and "restore", to prevent any time from passing (time
  1199.    in the game is handled by the fuses and daemons).
  1200.  
  1201. askdo;
  1202.  
  1203.    Abort the current command, and ask the player to specify a
  1204.    direct object.
  1205.  
  1206. askio( <prep-object> );
  1207.  
  1208.    Abort the current command, supply <prep-object> as the preposition
  1209.    for the command, and ask the player to specify an indirect object.
  1210.  
  1211.  
  1212. ------------------------------------------------------------------------------
  1213. Built-in Functions
  1214.  
  1215. TADS has a number of built-in functions that you can call from
  1216. your game program.  Some of these functions simply provide useful
  1217. utility functions, while others affect execution of the game.
  1218. A brief description of each function is shown below.
  1219.  
  1220. askfile(prompt) - asks the player for a filename; "prompt" is a
  1221. string (single-quoted) that specifies a prompt to display to the
  1222. player.  Where appropriate, the standard system file selector is
  1223. used to ask the player for the file.
  1224.  
  1225. caps() - forces the next character displayed to be capitalized.
  1226.  
  1227. car(list) - returns the first element of a list.  For
  1228. example:  car([1 2 3]) returns 1.
  1229.  
  1230. cdr(list) - returns a list with its first element removed.  For
  1231. example:  cdr([1 2 3]) returns [2 3].
  1232.  
  1233. cvtnum(str) - converts a (single-quoted) string containing the
  1234. textual representation of a number to a numeric value.  For
  1235. example, cvtnum('1234') returns 1234.
  1236.  
  1237. cvtstr(num) - converts a number to a string containing a textual
  1238. representation of the number.  For example, cvtstr(100) returns '100'.
  1239.  
  1240. datatype(val) - returns the datatype of the "val" (after evaluating
  1241. the value).  The return values are:
  1242.  
  1243.    1 - number
  1244.    2 - object
  1245.    3 - string
  1246.    5 - nil
  1247.    7 - list
  1248.    8 - true
  1249.    10 - function pointer
  1250.    13 - property pointer
  1251.  
  1252. defined(obj, &prop) - returns true if the object "obj" defines or
  1253. inherits property "prop", nil otherwise.
  1254.  
  1255. find(value, target) - returns the offset of "target" within "value".
  1256. If "value" is a list, this function returns the index of the "target"
  1257. within the list, or nil if it does not occur in the list.  For
  1258. example, find([5 4 3], 4) returns 2.  If "value" is a string,
  1259. this function returns the offset of the substring "target", or
  1260. nil if there is no such substring.  For example, find('abcdef', 'cde')
  1261. returns 3.
  1262.  
  1263. firstobj() - begins a loop over all non-class objects in a game.
  1264. Returns an object.  See nextobj(obj).
  1265.  
  1266. firstobj(cls) - begins a loop over all non-class objects with
  1267. superclass "cls".  See nextobj(obj, cls).
  1268.  
  1269. getarg(num) - return the value of argument number "num" to the current
  1270. method or function.
  1271.  
  1272. incturn() - increments the turn counter, which moves all fuses
  1273. one turn closer to firing.  Normally, this function is called
  1274. by a daemon function once per turn.
  1275.  
  1276. input() - allows the user to enter a line of text, and returns
  1277. the value as a string.
  1278.  
  1279. isclass(obj, cls) - returns true if "obj" inherits from superclass
  1280. "cls", nil otherwise.
  1281.  
  1282. length(val) - returns the number of characters in a string, or
  1283. the number of elements in a list.
  1284.  
  1285. logging(val) - if "val" is a string, creates the file named by
  1286. the string, and logs all text displayed on the screen to the file.
  1287. If "val" is nil, closes the current log file and stops logging.
  1288.  
  1289. lower(str) - returns a string consisting of all of the characters
  1290. of "str" converted to lower case.
  1291.  
  1292. nextobj(obj) - returns the object following "obj", in an arbitrary
  1293. order, or nil if the last object has been reached.  Every non-class
  1294. object in the game will be returned exactly once by a loop such as
  1295. this:
  1296.  
  1297.    local obj;
  1298.    for (obj := firstobj() ; obj ; obj := nextobj(obj)) /* ... */;
  1299.  
  1300. nextobj(obj, cls) - returns the next object following "obj"
  1301. with superclass "cls", or nil if the last such object has been
  1302. reached.  Every non-class object in the game with superclass cls
  1303. will be returned by a loop such as this:
  1304.  
  1305.    local obj;
  1306.    for (obj := firstobj(cls) ; obj ; obj := nextobj(obj, cls)) /* ... */;
  1307.  
  1308. notify(obj, &prop, turns) - establish a notifier.  The property "prop"
  1309. of object "obj" (i.e., obj.prop) is called once after the number of turns
  1310. specified by "turns" has elapsed.  If "turns" is zero, obj.prop is called
  1311. after every turn.
  1312.  
  1313. proptype(obj, &prop) - returns the type of property "prop" in object
  1314. "obj", without evaluating the property.  If the property contains
  1315. method code, the code is not called by this function, so the return
  1316. type of the property cannot be determined; instead, proptype simply
  1317. returns 6, to indicate that the property contains method code.  The
  1318. return values are:
  1319.  
  1320.    1 - number
  1321.    2 - object
  1322.    3 - single-quoted string
  1323.    5 - nil
  1324.    6 - code
  1325.    7 - list
  1326.    8 - true
  1327.    9 - double-quoted string
  1328.    10 - function pointer
  1329.    13 - property pointer
  1330.  
  1331. quit() - end the game.
  1332.  
  1333. rand(lim) - return a random number from 0 to "lim", inclusive.
  1334.  
  1335. randomize() - seed the random number generator with a value chosen
  1336. by the system.  This function is called only once, at the beginning
  1337. of the game, to choose a random number seed.  If this function is
  1338. not called, the sequence of numbers returned by rand() is the same
  1339. each time the game is played.
  1340.  
  1341. remdaemon(function, value) - remove a daemon previously set by
  1342. the setdaemon() built-in function.  The daemon set with the same
  1343. values of "function" and "value" will be removed; if no such daemon
  1344. is found, a run-time error is reported.
  1345.  
  1346. remfuse(function, value) - remove a fuse previously set
  1347. by the setfuse() built-in function.
  1348.  
  1349. restart() - start the game over from the beginning.
  1350.  
  1351. restore(filename) - restore the game position stored in the file
  1352. named by the string "filename".
  1353.  
  1354. save(filename) - save the current game position to the file
  1355. named by the string "filename".
  1356.  
  1357. say(value) - display the value, which can be a single-quoted string
  1358. or a number.
  1359.  
  1360. setdaemon(function, value) - set a daemon.  "function" will be
  1361. called once after every turn, with "value" as its argument.  "value"
  1362. is an arbitrary value that is provided to allow you to pass
  1363. any information to the daemon that it may need.  The daemon
  1364. function should be defined prior to its use in setdaemon().
  1365.  
  1366. setfuse(function, time, value) - set a fuse.  "function" will be
  1367. called after the number of turns specified in "time" has elapsed.
  1368. "value" is an arbitrary value that is passed to the function as
  1369. its argument; you can specify any value that you find useful here.
  1370.  
  1371. setit(obj) - set "it" to the specified object.  This changes the
  1372. object that the player refers to with the word "it".
  1373.  
  1374. setscore(score, turns) - set the score displayed on the status line.
  1375. "score" and "turns" are numbers.
  1376.  
  1377. setscore(str) - specify an arbitrary single-quoted string that will
  1378. be displayed on the status line in place of the normal score/turns
  1379. indicator.
  1380.  
  1381. substr(str, ofs, len) - returns the substring of "str" starting
  1382. at offset "ofs" and going for "len" characters.  For example,
  1383. substr('abcdef', 3, 2) returns 'cd'.
  1384.  
  1385. undo() - undoes one turn.
  1386.  
  1387. unnotify(obj, &prop) - remove the notifier previously set on obj.prop.
  1388. If there is no such notifier, a run-time error is reported.
  1389.  
  1390. upper(str) - returns the string "str" with its characters converted
  1391. to upper-case.
  1392.  
  1393. yorn() - waits for the player to answer YES or NO.  Returns
  1394. 1 if the player typed YES, 0 if the player typed NO, and -1 if
  1395. the player typed anything else.  Note that only the first
  1396. character of the player's response is checked, and the response
  1397. can be upper- or lower-case.
  1398.  
  1399.  
  1400. ------------------------------------------------------------------------------
  1401. Where to go from Here
  1402.  
  1403. There's a lot more to TADS than we are able to describe here.
  1404. To learn more, you can start by looking at the example game
  1405. "Ditch Day Drifter" that we've included with the TADS shareware
  1406. distribution.  While this game doesn't do everything that you can
  1407. do with TADS (in fact, since TADS is so flexible, it doesn't even
  1408. really scratch the surface), it does contain examples of many
  1409. common adventure game situations that may help you in designing
  1410. your own game.
  1411.  
  1412. For full details on TADS, you should obtain the TADS Author's
  1413. Manual.  When you register your copy of TADS, we'll send you the
  1414. complete printed TADS Author's Manual, which contains over 200
  1415. pages of detailed information on the language and the system.
  1416. Some of the topics covered in the TADS Author's Manual:
  1417.  
  1418.   - An overview of the concepts used in the TADS programming
  1419.     language.
  1420.  
  1421.   - A detailed description of the TADS programming language,
  1422.     including how to define functions and objects, how to write
  1423.     procedural code, and how to write expressions.
  1424.  
  1425.   - How to use the TADS Debugger, a powerful source-level
  1426.     debugger that you get when you register your copy of TADS.
  1427.  
  1428.   - Descriptions of all of the built-in functions.
  1429.  
  1430.   - Descriptions of the objects in ADV.T, and how to use them.
  1431.  
  1432.   - An introduction to object-oriented programming.
  1433.  
  1434.   - How the player command parser works:  how it reads commands,
  1435.     disambiguates nouns, and calls your program to carry out
  1436.     commands.
  1437.  
  1438.   - Descriptions of the special properties that the system
  1439.     calls in your game objects.
  1440.  
  1441.   - Descriptions of the special objects that your game
  1442.     program must provide.
  1443.  
  1444.   - Explanations of system error messages.
  1445.  
  1446.   - Details on how to write and use external functions written
  1447.     in a language such as C.
  1448.  
  1449.   - How to use the compiler and run-time system.
  1450.  
  1451.   - Advice on the what to do (and what not to do) when designing
  1452.     a game to make your game more fun to play.
  1453.  
  1454.  
  1455. In addition, the TADS Author's Manual contains a large number
  1456. of detailed examples that show you how to write your own games.
  1457. The chapter "Getting Started with TADS" shows you how to design
  1458. a game, and how to turn your design into a TADS program.  The
  1459. chapter "Advanced TADS Techniques" provides 40 pages of examples
  1460. with full explanations, showing how to implement a wide variety
  1461. of game situations, such as:
  1462.  
  1463.   - Creating your own verbs
  1464.  
  1465.   - Using doors and other obstacles
  1466.  
  1467.   - Creating vehicles
  1468.  
  1469.   - Hiding objects
  1470.  
  1471.   - Creating non-player characters
  1472.  
  1473. If that's not enough to convince you to register, remember that
  1474. only registered users get the TADS Debugger, a full-featured source-
  1475. level debugger that can make it much easier to get your games
  1476. working.  You'll also receive the latest version of the TADS
  1477. software on disk.  In addition, you'll be helping to ensure that
  1478. we can continue to develop and improve TADS in the future.
  1479.  
  1480.  
  1481. ------------------------------------------------------------------------------
  1482. Contacting High Energy Software
  1483.  
  1484. If you have any questions or comments about TADS, please feel free
  1485. to contact us.  We're interested in hearing your ideas for improving
  1486. TADS, and for how we can improve this overview user's guide.  We'd
  1487. also be happy to try to answer any questions you have about our
  1488. system's capabilities.
  1489.  
  1490. High Energy Software BBS:  The best way to reach us is our on-line
  1491. support bulletin board system.  You can call our BBS at (415)493-2420
  1492. any time (set your modem to 9600-N-8-1), and send mail to the Sysop.
  1493. Feel free to browse through the conferences on the system -- you may
  1494. be able to find the answer to your question without having to wait
  1495. for a reply.
  1496.  
  1497. Electronic Mail:  We can be reached by CompuServe, GEnie, and Internet
  1498. users.  Send mail to the appropriate address listed below.  Electronic
  1499. mail is usually the fastest way of reaching us.
  1500.  
  1501.     CompuServe:   73737,417
  1502.     GENie:        M.ROBERTS10
  1503.     Internet:     73737.417@compuserve.com
  1504.  
  1505. Postal Mail:  Our US Mail address is:
  1506.  
  1507.     High Energy Software
  1508.     PO Box 50422
  1509.     Palo Alto, CA 94303
  1510.  
  1511.