home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume2 / advsys / part01 / advsys.doc < prev    next >
Text File  |  1987-10-23  |  29KB  |  1,193 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.                       ADVSYS - An Adventure Writing System
  9.  
  10.                                   Version 1.2
  11.  
  12.                                  by David Betz
  13.                               114 Davenport Avenue
  14.                               Manchester, NH 03103
  15.                              (603) 625-4691 (home)
  16.  
  17.                                  July 14, 1986
  18.  
  19.                        Copyright (c) 1986, by David Betz
  20.                               All Rights Reserved
  21.         Permission is hereby granted for unrestricted non-commercial use
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.         ADVSYS            An Adventure Writing System             Page 2
  72.  
  73.  
  74.         INTRODUCTION
  75.  
  76.         ADVSYS is a special purpose programming language that was
  77.         specifically designed to be used to write computer text
  78.         adventure games.  It includes a facility for defining the kinds
  79.         of objects that are common in adventures.  Some objects
  80.         represent locations on the game map, some objects represent
  81.         things that the player can find while exploring the adventure
  82.         world, and some objects represent other characters that the
  83.         adventurer can encounter during his or her journeys.  The
  84.         adventure language also provides a facility to define actions.
  85.         Actions are short sections of code that determine what happens
  86.         in response to a command from the player.  These two concepts,
  87.         "objects" and "actions" form the basis for the adventure
  88.         language.
  89.  
  90.  
  91.         ACKNOWLEDGEMENTS
  92.  
  93.         Although I have written all of the code associated with this
  94.         adventure writing system, I must acknowledge the assistance of
  95.         one individual without whom this project would probably never
  96.         have reached completion.  That person is Gary McGath.  Gary was
  97.         interested in writing a commercial quality adventure game and I
  98.         convinced him to write it using my system (which was as yet
  99.         almost completely unspecified) instead of using a traditional
  100.         programming language.  The input that Gary provided during the
  101.         development of his game contributed significantly to the overall
  102.         design of the system.  I would like to thank Gary for that
  103.         contribution.
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.         ADVSYS            An Adventure Writing System             Page 3
  138.  
  139.  
  140.         USING THE SYSTEM TO WRITE AN ADVENTURE
  141.  
  142.         In order to write an adventure using this system, you need to
  143.         write an adventure description.  This is an ordinary ASCII text
  144.         file containing definitions for all of the objects and actions
  145.         in your adventure game.  This file is used as input to the
  146.         adventure compiler.  The compiler takes the adventure
  147.         description and compiles it into a set of data structures.
  148.  
  149.         In order to play an adventure written using this system, you
  150.         need the data structure file that was produced by the compiler
  151.         and the adventure interpreter program.  The interpreter uses the
  152.         information produced by the adventure compiler to allow a player
  153.         to play the adventure game.  Notice that it is not necessary for
  154.         the player to have access to the original adventure description
  155.         file.  All of the information that is necessary to play the
  156.         adventure game is contained within the data structure file that
  157.         is produced by the compiler.  This file is a binary file that
  158.         cannot be simply "listed" to reveal the internal workings of the
  159.         adventure.
  160.  
  161.         The adventure compiler is called ADVCOM and the interpreter is
  162.         called ADVINT.  These two programs in conjunction with this
  163.         documentation are all that is required to write and play
  164.         adventure games using this system.
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.         ADVSYS            An Adventure Writing System             Page 4
  204.  
  205.  
  206.         RUNNING THE COMPILER
  207.  
  208.         If you have created an adventure definition file called
  209.         "MYADV.ADV", you can compile it with the command:
  210.  
  211.                 A>advcom myadv
  212.  
  213.         Typing this command will invoke the adventure compiler and cause
  214.         it to compile the file named "MYADV.ADV".  The ".ADV" extension
  215.         is added to the file name by the compiler.  During the process
  216.         of compiling the file, many messages will be printed telling
  217.         about the progress of the compiler.  At the end of the
  218.         compilation process, the compiler prints a set of statistics
  219.         describing the resulting data structure file.  This file will be
  220.         called "MYADV.DAT".  It contains the data structures needed by
  221.         the adventure interpreter to allow a player to play the
  222.         adventure game.
  223.  
  224.         Note: The "A>" in the line above is the MS-DOS prompt and should
  225.         not be typed as part of the command.
  226.  
  227.  
  228.         RUNNING THE INTERPRETER
  229.  
  230.         Assuming that you have a compiled adventure data file called
  231.         "MYADV.DAT", you can play the adventure by typing the command:
  232.  
  233.                 A>advint myadv
  234.  
  235.         This command will start the adventure.  There will probably be
  236.         some text printed at this point describing the adventure and the
  237.         initial situation.  You will then be prompted to type a command.
  238.         The prompt is the colon character.  The format for commands is
  239.         described under the section about the parser.  After typing a
  240.         command, you will be told what happened as a result of your
  241.         command, your new situation will be described and you will begin
  242.         the loop again.
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.         ADVSYS            An Adventure Writing System             Page 5
  270.  
  271.  
  272.         ADVENTURE DESCRIPTION FILE FORMAT
  273.  
  274.             All adventure description files contain a collection of
  275.             statements.  These statements must be formed according to
  276.             the following rules:
  277.  
  278.  
  279.         The adventure definition statement:
  280.  
  281.             All adventure definitions should have an ADVENTURE
  282.             statement.  This statement gives the name of the adventure
  283.             and the version number of the definition file.  Each
  284.             adventure should have a unique name.  This name is used to
  285.             identify "saved position" files and insure that only files
  286.             that correspond to the current adventure are restored.  The
  287.             version number allows the author to have many versions of
  288.             the same adventure during development and guarantee that
  289.             "save" files from one version aren't restored into another
  290.             version.
  291.  
  292.               (ADVENTURE name version)
  293.  
  294.           Example:
  295.  
  296.               (ADVENTURE sample 1)
  297.  
  298.  
  299.         Vocabulary statements:
  300.  
  301.             These statements add words to the adventure vocabulary.
  302.  
  303.               (ADJECTIVE word*)
  304.               (PREPOSITION word*)
  305.               (CONJUNCTION word*)
  306.               (ARTICLE word*)
  307.               (SYNONYM word synonym*)
  308.  
  309.           Examples:
  310.  
  311.               (ADJECTIVE red blue)
  312.               (CONJUNCTION and)
  313.               (SYNONYM big large)
  314.  
  315.           Note:
  316.  
  317.               Words are also added to the vocabulary by the object
  318.               and action definitions using the NOUN, ADJECTIVE, VERB
  319.               and PREPOSITION statements.
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.         ADVSYS            An Adventure Writing System             Page 6
  336.  
  337.  
  338.         Constant definition statement:
  339.  
  340.               (DEFINE name value)
  341.  
  342.           Examples:
  343.  
  344.               (DEFINE what "I don't understand what you're saying!\\n")
  345.               (DEFINE max-load 100)
  346.  
  347.  
  348.         Function definition statement:
  349.  
  350.               (DEFINE (function-name [arg-name]* [&aux tmp-name*]) expr*)
  351.  
  352.           Example:
  353.  
  354.               (DEFINE (factorial n)
  355.                 (IF (< n 2)
  356.                   1
  357.                   (* n (factorial (- n 1)))))
  358.  
  359.  
  360.         Variable definition statement:
  361.  
  362.               (VARIABLE variable-name*)
  363.  
  364.           Example:
  365.  
  366.               (VARIABLE score i j)
  367.  
  368.  
  369.         Property name definition statement:
  370.  
  371.               (PROPERTY property-name*)
  372.  
  373.           Example:
  374.  
  375.               (PROPERTY weight value)
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.         ADVSYS            An Adventure Writing System             Page 7
  402.  
  403.  
  404.         Comments:
  405.  
  406.             Comments begin with a semi-colon and end with the end of the
  407.             line.
  408.  
  409.           Example:
  410.  
  411.               ; this is a comment
  412.  
  413.  
  414.         Include files:
  415.  
  416.             Any line that begins with a "@" causes the inclusion of
  417.             another file.  The file name immediately follows the at-sign
  418.             and extends to the end of the line.  Only one level of
  419.             include is supported.
  420.  
  421.           Example:
  422.  
  423.               @basic.adv
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.         ADVSYS            An Adventure Writing System             Page 8
  468.  
  469.  
  470.         Handler definition statements:
  471.  
  472.               (INIT expr*)
  473.               (UPDATE expr*)
  474.               (BEFORE expr*)
  475.               (AFTER expr*)
  476.               (ERROR expr*)
  477.  
  478.           Example:
  479.  
  480.               (INIT
  481.                 (print "Welcome to the sample adventure!\\n"))
  482.  
  483.  
  484.         Handlers:
  485.  
  486.             All activity within an adventure game is controlled by a
  487.             built-in handler loop.  Each of the handlers in the loop
  488.             contains code that is provided by the adventure author.  The
  489.             sequencing from handler to handler is provided by the
  490.             adventure system itself.
  491.  
  492.             The first handler that is called in an adventure game is the
  493.             INIT handler.  It prints some sort of introductory text and
  494.             initializes all global variables in order to start the
  495.             adventure game.
  496.  
  497.             After the INIT handler has completed, the normal loop is
  498.             entered.  It starts with the UPDATE handler.  The UPDATE
  499.             handler prepares for the player's next turn.  It should
  500.             describe the player's location if it has changed since the
  501.             last turn.  After the UPDATE handler completes, the parser
  502.             is called.  It prompts the player for a command, parses the
  503.             command, sets the built-in parser varaibles and exits.  Then
  504.             the BEFORE handler is called.  It is called before the
  505.             action associated with the command to allow the adventure
  506.             author to inspect the parser variables before proceeding to
  507.             the action itself.  After the BEFORE handler completes, the
  508.             action itself is called (or whatever action is stored in the
  509.             built-in variable $ACTION when the BEFORE handler
  510.             completes).  When the action completes, the AFTER handler is
  511.             called to give the author a chance to handle events that
  512.             happen only at the end of a successful turn.  The ERROR
  513.             handler is called when the parser detects an error.
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.         ADVSYS            An Adventure Writing System             Page 9
  534.  
  535.  
  536.         The handler loop:
  537.  
  538.             INIT
  539.              |
  540.              v
  541.             UPDATE<----------+
  542.              |               |
  543.              v               |
  544.             parse--->ERROR---+
  545.              |               |
  546.              v               |
  547.             BEFORE           |
  548.              |               |
  549.              v               |
  550.             action           |
  551.              |               |
  552.              v               |
  553.             AFTER------------+
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.         ADVSYS            An Adventure Writing System            Page 10
  600.  
  601.  
  602.         The parser:
  603.  
  604.             The parser handles all commands from the player.  It prompts
  605.             the player when it is ready for a new command.  The prompt
  606.             is the colon character.  When the player has typed a
  607.             command, the parser breaks the command into phrases.  The
  608.             parser recognizes the following command forms:
  609.  
  610.               [actor,] verb
  611.               [actor,] verb dobjects
  612.               [actor,] verb dobjects preposition iobject
  613.               [actor,] verb iobject dobjects
  614.  
  615.             Where:
  616.  
  617.               actor             ==> a noun phrase
  618.               verb              ==> the verb phrase (1 or 2 words)
  619.               dobjects          ==> dobject [conjunction dobject]*
  620.               dobject           ==> a noun phrase
  621.               preposition       ==> a preposition
  622.               iobject           ==> a noun phrase
  623.               noun phrase       ==> [article] [adjective]* noun
  624.  
  625.            Examples:
  626.  
  627.               Look
  628.               Take the red magic sword
  629.               Take the red sword and the blue bottle
  630.               Give the troll the red sword
  631.               Give the red sword to the troll
  632.               Troll, give me the sword
  633.  
  634.            Notes:
  635.  
  636.               Square brackets enclose optional phrases.  An asterisk
  637.               indicates zero or more of the preceeding element.
  638.  
  639.               The fourth form above is treated as if the player had
  640.               typed:
  641.  
  642.                 [actor,] verb dobject "to" iobject
  643.  
  644.             Once the parser has broken the command into phrases, it
  645.             assigns each noun phrase a number.  It stores the number of
  646.             the actor noun phrase in the built-in variable $ACTOR.  It
  647.             stores the first direct object noun phrase number in the
  648.             variable $DOBJECT.  It stores the number of direct objects
  649.             in the variable $NDOBJECTS.  It stores the indirect object
  650.             noun phrase number in the variable $IOBJECT.  If any of the
  651.             noun phrases is missing from the command, the corresponding
  652.             variable is set to NIL.  The parser saves the verb phrase
  653.             and preposition to use when determining which action to use
  654.             to handle the command.
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.         ADVSYS            An Adventure Writing System            Page 11
  666.  
  667.  
  668.         Action definition statement:
  669.  
  670.             Actions are used to handle player commands.  Each time the
  671.             parser finishes parsing a new command, it uses the verb
  672.             phrase and the preposition to locate an action to handle the
  673.             command.  Each action specifies a kind of template that must
  674.             match the command in order for the action to be called.  The
  675.             template consists of the words used in the verb phrase and
  676.             preposition and the existance of the actor, direct object
  677.             and indirect object noun phrases.  Once the parser finds an
  678.             action that matches the command, it stores the action in the
  679.             built-in variable $ACTION and exits.
  680.  
  681.               (ACTION action-name astat*)
  682.                   astat:
  683.                       (ACTOR [flag])
  684.                       (VERB verb*)
  685.                       (DIRECT-OBJECT [flag])
  686.                       (PREPOSITION word*)
  687.                       (INDIRECT-OBJECT [flag])
  688.                   flag:
  689.                       REQUIRED  must have the corresponding np
  690.                       OPTIONAL  may have the corresponding np
  691.                       FORBIDDEN must not have the corresponding np
  692.                   verb:
  693.                       word
  694.                       (word word)
  695.  
  696.           Example:
  697.  
  698.               (ACTION take
  699.                 (VERB take (pick up))
  700.                 (DIRECT-OBJECT)
  701.                 (CODE
  702.                   (print "You can't take the ")
  703.                   (print-noun $dobject)
  704.                   (print "!\\n")))
  705.  
  706.             If the ACTOR, DIRECT-OBJECT or INDIRECT-OBJECT statements
  707.             are left out entirely, the settings of the corresponding
  708.             flags are taken from the action default definitions.  If
  709.             there is no action default definition, the value FORBIDDEN
  710.             is assumed.  If any of these statements is present, but no
  711.             flag is specified, it is treated as if the flag REQUIRED was
  712.             specified.
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.         ADVSYS            An Adventure Writing System            Page 12
  732.  
  733.  
  734.         Action default definition statement:
  735.  
  736.             This statement defines default values for the ACTOR, DIRECT-
  737.             OBJECT and INDIRECT-OBJECT flags.
  738.  
  739.               (DEFAULT dstat*)
  740.                   dstat:
  741.                       (ACTOR [flag])
  742.                       (DIRECT-OBJECT [flag])
  743.                       (INDIRECT-OBJECT [flag])
  744.                   flag:
  745.                       REQUIRED
  746.                       OPTIONAL
  747.                       FORBIDDEN
  748.  
  749.           Example:
  750.  
  751.               (DEFAULT
  752.                 (ACTOR OPTIONAL))
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.         ADVSYS            An Adventure Writing System            Page 13
  798.  
  799.  
  800.         Object definition statements:
  801.  
  802.             The object definition statements are used to define
  803.             individual objects and classes of objects.  The most basic
  804.             way of defining an object is using the (OBJECT ...)
  805.             statement.  This defines an object which has no parent
  806.             class.
  807.  
  808.             It is also possible to create a class of objects that share
  809.             information.  A class is defined just like a normal object.
  810.             It is given nouns, adjectives and properties.  In addition,
  811.             a class may have class properties.  These are properties
  812.             that are shared amongst all instances of the class.  In
  813.             order to create an instance of a class, the (class-name ...)
  814.             form is used.  This creates an instance of the named class.
  815.             An instance will inherit all nouns and adjectives from its
  816.             parent class.  It will also inherit all class properties
  817.             defined in the parent (and its parents).  Any normal
  818.             properties defined in the parent class will be copied to the
  819.             new object.  The copies will have the same values that the
  820.             parent has, but it is possible for the instance to have
  821.             property definitions that override these values.  Instances
  822.             may also have additional nouns, adjectives and properties.
  823.  
  824.               (OBJECT object-name ostat*)
  825.               (class-name object-name ostat*)
  826.                   ostat:
  827.                       (NOUN word*)
  828.                       (ADJECTIVE word*)
  829.                       (PROPERTY [property-name value]*)
  830.                       (CLASS-PROPERTY [property-name value]*)
  831.                       (METHOD (selector [arg-name]* [&aux tmp-name*])
  832.                           expr*)
  833.                   class-name:
  834.                       the name of a previously defined object
  835.  
  836.           Examples:
  837.  
  838.               (OBJECT sword
  839.                 (NOUN sword weapon)
  840.                 (CLASS-PROPERTY
  841.                   is-weapon T)
  842.                 (PROPERTY
  843.                   weight 10
  844.                   value 5
  845.                   damage 20))
  846.  
  847.               (sword red-sword
  848.                 (ADJECTIVE red)
  849.                 (PROPERTY
  850.                   damage 25))
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.         ADVSYS            An Adventure Writing System            Page 14
  864.  
  865.  
  866.         Expressions:
  867.  
  868.               (+ expr expr)     add
  869.               (- expr expr)     subtract
  870.               (* expr expr)     multiply
  871.               (/ expr expr)     divide
  872.               (% expr expr)     remainder
  873.  
  874.               (& expr expr)     bit-wise and
  875.               (| expr expr)     bit-wise or
  876.               (~ expr)          bit-wise complement
  877.  
  878.             These arithmetic functions operate on integers.  As it turns
  879.             out, every data type in the system is represented by an
  880.             integer, so these functions will work with any type of
  881.             arguments.  They are probably only useful with integers,
  882.             however.
  883.  
  884.               (RANDOMIZE)       reset the random number generator
  885.               (RAND expr)       generate a random number
  886.  
  887.             These functions enable the generation of pseudo-random
  888.             numbers.  The (RAND n) function takes a single argument and
  889.             generates a random number between zero and n-1.  (RANDOMIZE)
  890.             resets the seed used by the random number function so that
  891.             each invocation of a program results in a new sequence of
  892.             random numbers.
  893.  
  894.               (AND expr*)       logical and (short circuits)
  895.               (OR expr*)        logical or (short circuits)
  896.               (NOT expr)        logical not
  897.  
  898.             These functions operate on logical values.  In this system,
  899.             any value that is not equal to NIL (or zero) is considered
  900.             true.  NIL and zero are considered false.  AND and OR
  901.             evaluate their arguments from left to right and stop as soon
  902.             as the value of the entire expression can be determined.  In
  903.             other words, AND stops when it encounters a false value, OR
  904.             stops when it encounters a true value.
  905.  
  906.               (< expr expr)     less than
  907.               (= expr expr)     equal to
  908.               (> expr expr)     greater than
  909.  
  910.             These functions compare integers.  They cannot be used to
  911.             compare strings.
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.         ADVSYS            An Adventure Writing System            Page 15
  930.  
  931.  
  932.               (GETP obj property-name)          get the value of a property
  933.               (SETP obj property-name value)    set the value of a property
  934.  
  935.             These functions manipulate object properties.  They are used
  936.             to find the value of a property or to set the value of a
  937.             property.  They will also find and set the values of
  938.             inherited properties.  If GETP is used to find the value of
  939.             a property that doesn't exist for the specified object, NIL
  940.             is returned.  If SETP is used to set the value of a property
  941.             that doesn't exist, the operation is ignored.
  942.  
  943.               (CLASS obj)
  944.  
  945.             This function returns the class of an object.  If the object
  946.             was defined with an (OBJECT ...) statement, NIL will be
  947.             returned.  If the object was defined with the (class-name
  948.             ...) statement, the class object will be returned.
  949.  
  950.               (MATCH obj noun-phrase-number)
  951.  
  952.             This function matches an object with a noun phrase.  An
  953.             object matches a noun phrase if it includes all of the
  954.             adjectives specified in the noun phrase and also includes
  955.             the noun mentioned.  Both nouns and adjectives can be
  956.             inherited.
  957.  
  958.               (YES-OR-NO)       get a yes or no answer from the player
  959.  
  960.             This function waits for the player to type a line.  If the
  961.             line begins with a 'Y' or a 'y', the function returns T.  If
  962.             the line begins with anything else, the function returns
  963.             NIL.
  964.  
  965.               (PRINT expr)                      print a string
  966.               (PRINT-NUMBER expr)               print a number
  967.               (PRINT-NOUN noun-phrase-number)   print a noun phrase
  968.               (TERPRI)                          terminate the print line
  969.  
  970.             These functions perform various sorts of output.  PRINT
  971.             prints strings, PRINT-NUMBER prints numbers and PRINT-NOUN
  972.             prints a noun phrase.
  973.  
  974.               (FINISH)          exit and continue with the AFTER handler
  975.               (CHAIN)           exit and continue with the next handler
  976.               (ABORT)           exit and continue with the UPDATE handler
  977.               (RESTART)         exit and restart the current game
  978.               (EXIT)            exit to the operating system
  979.  
  980.             These functions cause the immediate termination of the
  981.             current handler.  FINISH causes execution to proceed with
  982.             the AFTER handler, CHAIN causes execution to proceed with
  983.             the next handler in the normal sequence, ABORT causes
  984.             execution to proceed with the UPDATE handler (effectively
  985.             aborting the current turn), RESTART restores the game to its
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.         ADVSYS            An Adventure Writing System            Page 16
  996.  
  997.  
  998.             original state and starts over with the INIT handler and
  999.             EXIT causes an immediate exit back to the operating system.
  1000.  
  1001.               (SAVE)            save the current game position
  1002.               (RESTORE)         restore a saved game position
  1003.  
  1004.             These functions allow the player to save and restore
  1005.             positions in the game.  They prompt the player for a file
  1006.             name and either read a saved game position from the file or
  1007.             write the current game position to the file.
  1008.  
  1009.               (function-name expr*)
  1010.  
  1011.             This expression invokes a user defined function.  There
  1012.             should be one expression for each of the formal arguments of
  1013.             the user function.  The value of the expression is the value
  1014.             of the last expression in the body of the user function or
  1015.             the value passed to a RETURN statement within the function.
  1016.  
  1017.               (SEND object selector [expr]*)
  1018.  
  1019.             This expression sends a message to an object.  The "object"
  1020.             expression should evaluate to an object.  The selector
  1021.             should match a method selector for that object or one of its
  1022.             super-classes.  The matching method is invoked with the
  1023.             specified expressions as arguments.  Also, the implied
  1024.             argument SELF will refer to the object receiving the
  1025.             message.
  1026.  
  1027.               (SEND-SUPER selector [expr]*)
  1028.  
  1029.             This expression sends a message to the super-class of the
  1030.             current object.  It can only be used within a method and it
  1031.             will cause the message to be passed up the class heirarchy
  1032.             to the super-class of the object refered to by SELF.
  1033.  
  1034.               (SETQ variable value)
  1035.  
  1036.             This expression sets the value of a user variable.
  1037.  
  1038.               (COND [(test expr*)]*)            execute conditionally
  1039.               (IF test then-expr [else-expr])   traditional if-then-else
  1040.               (WHILE test expr*)                conditional iteration
  1041.               (PROGN expr*)                     block construct
  1042.               (RETURN [expr])                   return from a function
  1043.  
  1044.             These statements are control constructs.
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.         ADVSYS            An Adventure Writing System            Page 17
  1062.  
  1063.  
  1064.         Primary expressions:
  1065.  
  1066.             integer             (digits preceeded by an optional sign)
  1067.             string              (characters enclosed in double quotes)
  1068.             action-name         (an action name)
  1069.             object-name         (an object or class name)
  1070.             property-name       (a property name)
  1071.             constant-name       (a defined constant or function)
  1072.             variable-name       (a variable name)
  1073.  
  1074.             Since an adventure description contains a large quantity of
  1075.             running text, the format for specifying string constants is
  1076.             somewhat extended from normal programming languages.  In
  1077.             this system, a string is enclosed in double quotes.  If the
  1078.             end of line occurs before the closing quote within a string,
  1079.             it is treated as if it were a space.  Any number of
  1080.             consecutive spaces is collapsed into a single space.  Also,
  1081.             the character pair "\\n" is used to represent the "end of
  1082.             line" character, the pair "\\t" is used to represent the tab
  1083.             character and the pair "\\\\" is used to represent the
  1084.             backslash character.
  1085.  
  1086.           Examples:
  1087.  
  1088.                 "This is a string.\\n"
  1089.                 "This
  1090.                  is
  1091.                  a
  1092.                  string.\\n"
  1093.  
  1094.             Both of the examples above represent the same string.
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.         ADVSYS            An Adventure Writing System            Page 18
  1128.  
  1129.  
  1130.         Definitions of symbols used above:
  1131.  
  1132.             expr                an expression
  1133.             value               an expression
  1134.             test                an expression (NIL means false, anything
  1135. else is true)
  1136.             then-expr           an expression
  1137.             else-expr           an expression
  1138.             obj                 an expression that evaluates to an object
  1139.             property-name       an expression that evaluates to a property
  1140. name
  1141.             noun-phrase-number  an expression that evaluates to a noun
  1142. phrase number
  1143.             variable            a variable name
  1144.             T                   true
  1145.             NIL                 false
  1146.  
  1147.  
  1148.         Built-in variables set by the parser:
  1149.  
  1150.             $ACTOR              (actor noun phrase number)
  1151.             $ACTION             (action)
  1152.             $DOBJECT            (first direct object noun phrase number)
  1153.             $NDOBJECTS          (number of direct object noun phrases)
  1154.             $IOBJECT            (indirect object noun phrase number)
  1155.  
  1156.  
  1157.         Other built-in variables:
  1158.  
  1159.             $OCOUNT             (total number of objects in the system)
  1160.  
  1161.  
  1162.         CURRENT COMPILER LIMITS
  1163.  
  1164.             500         words
  1165.             500         objects
  1166.             20          properties per object
  1167.             200         actions or functions
  1168.             16384       bytes of code
  1169.             16384       bytes of data
  1170.             262144      bytes of text
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.