Академический Документы
Профессиональный Документы
Культура Документы
Version 1.2
by David Betz
114 Davenport Avenue
Manchester, NH 03103
(603) 625-4691 (home)
INTRODUCTION
ACKNOWLEDGEMENTS
A>advcom myadv
Typing this command will invoke the adventure compiler and cause
it to compile the file named "MYADV.ADV". The ".ADV" extension
is added to the file name by the compiler. During the process
of compiling the file, many messages will be printed telling
about the progress of the compiler. At the end of the
compilation process, the compiler prints a set of statistics
describing the resulting data structure file. This file will be
called "MYADV.DAT". It contains the data structures needed by
the adventure interpreter to allow a player to play the
adventure game.
Note: The "A>" in the line above is the MS-DOS prompt and should
not be typed as part of the command.
A>advint myadv
Example:
(ADVENTURE sample 1)
Vocabulary statements:
(ADJECTIVE word*)
(PREPOSITION word*)
(CONJUNCTION word*)
(ARTICLE word*)
(SYNONYM word synonym*)
Examples:
Note:
Examples:
Example:
(DEFINE (factorial n)
(IF (< n 2)
1
(* n (factorial (- n 1)))))
(VARIABLE variable-name*)
Example:
(VARIABLE score i j)
(PROPERTY property-name*)
Example:
Comments:
Comments begin with a semi-colon and end with the end of the
line.
Example:
; this is a comment
Include files:
Example:
@basic.adv
(INIT expr*)
(UPDATE expr*)
(BEFORE expr*)
(AFTER expr*)
(ERROR expr*)
Example:
(INIT
(print "Welcome to the sample adventure!\\n"))
Handlers:
INIT
|
v
UPDATE<----------+
| |
v |
parse--->ERROR---+
| |
v |
BEFORE |
| |
v |
action |
| |
v |
AFTER------------+
ADVSYS An Adventure Writing System Page 10
The parser:
[actor,] verb
[actor,] verb dobjects
[actor,] verb dobjects preposition iobject
[actor,] verb iobject dobjects
Where:
Examples:
Look
Take the red magic sword
Take the red sword and the blue bottle
Give the troll the red sword
Give the red sword to the troll
Troll, give me the sword
Notes:
Example:
(ACTION take
(VERB take (pick up))
(DIRECT-OBJECT)
(CODE
(print "You can't take the ")
(print-noun $dobject)
(print "!\\n")))
(DEFAULT dstat*)
dstat:
(ACTOR [flag])
(DIRECT-OBJECT [flag])
(INDIRECT-OBJECT [flag])
flag:
REQUIRED
OPTIONAL
FORBIDDEN
Example:
(DEFAULT
(ACTOR OPTIONAL))
ADVSYS An Adventure Writing System Page 13
Examples:
(OBJECT sword
(NOUN sword weapon)
(CLASS-PROPERTY
is-weapon T)
(PROPERTY
weight 10
value 5
damage 20))
(sword red-sword
(ADJECTIVE red)
(PROPERTY
damage 25))
Expressions:
(CLASS obj)
This function returns the class of an object. If the object
was defined with an (OBJECT ...) statement, NIL will be
returned. If the object was defined with the (class-name
...) statement, the class object will be returned.
original state and starts over with the INIT handler and
EXIT causes an immediate exit back to the operating system.
(function-name expr*)
Examples:
"This is a string.\\n"
"This
is
a
string.\\n"
expr an expression
value an expression
test an expression (NIL means false, anything
else is true)
then-expr an expression
else-expr an expression
obj an expression that evaluates to an object
property-name an expression that evaluates to a property
name
noun-phrase-number an expression that evaluates to a noun
phrase number
variable a variable name
T true
NIL false
500 words
500 objects
20 properties per object
200 actions or functions
16384 bytes of code
16384 bytes of data
262144 bytes of text