The following functions are built-in functions available to the
programmer. These functions are the heart of the
routines manipulate all system data. Thus,
these functions completely describe the facilities of the
($loc \fIobj\fR) \(-> The container of \fIobj\fR.
($cont \fIobj\fR) \(-> First item contained in \fIobj\fR.
($link \fIobj\fR) \(-> The next object in the same node as \fIobj\fR.
($ldisc \fIobj\fR) \(-> The routine ID for the long description of \fIobj\fR.
($sdisc \fIobj\fR) \(-> The routine ID for the short description of \fIobj\fR.
($rtn \fIobj\fR) \(-> The ACTION routine for \fIobj\fR.
($prop \fIobj\fR \fIpropnum\fR) \(-> returns the value of the \fIpropnum\fR'th property
($plus \fIarg1\fR \fIarg2\fR) \(-> \fIarg1\fR+\fIarg2\fR
($minus \fIarg1\fR \fIarg2\fR) \(-> \fIarg1\fR-\fIarg2\fR
($times \fIarg1\fR \fIarg2\fR) \(-> \fIarg1\fR*\fIarg2\fR
($quotient \fInum den\fR) \(-> [\fInum\fR/\fIden\fR]
.IP "\fB$remainder \fR" 8
($remainder \fInum den\fR) \(-> \fInum\fB mod \fIden\fR
($rand \fIarg\fR) \(-> Random integer between 1 and \fIarg\fR inclusive
($and \fIa b\fR) \(-> \fIa\fB (bitwise AND) \fIb\fR
($or \fIa b\fR) \(-> \fIa\fB (bitwise OR) \fIb\fR
($not \fIx\fR) \(-> \s-2IF\s+2 \fIx\fR nonzero \s-2THEN\s+2 zero \s-2ELSE\s+2 one.
($yorn) \(-> Waits for the Player to type a line of input. Returns
one if the Player types "yes" or "y" and zero otherwise.
($pct \fIprob\fR) \(-> Returns one, \fIprob\fR% of the time, zero otherwise.
($eq \fIarg1\fR \fIarg2\fR) \(-> 1 if \fIarg1\fR equals \fIarg2\fR, zero otherwise.
($ne \fIarg1\fR \fIarg2\fR) \(-> IF \fIarg1\fR ~= \fIarg2\fR THEN one ELSE zero.
($lt \fIarg1\fR \fIarg2\fR) \(-> 1 if \fIarg1\fR < \fIarg2\fR, zero otherwise.
($gt \fIarg1\fR \fIarg2\fR) \(-> 1 if \fIarg1\fR > \fIarg2\fR, zero otherwise.
($le \fIarg1\fR \fIarg2\fR) \(-> 1 if \fIarg1\fR <= \fIarg2\fR, zero otherwise.
($ge \fIarg1\fR \fIarg2\fR) \(-> 1 if \fIarg1\fR >= \fIarg2\fR, zero otherwise.
Builtin Procedures (no return value)
($setg \fIglobalnumber value\fR) \(-> No return value. Sets the
contents of global #\fIglobalnumber\fR to \fIvalue\fR.
($setp \fIobj propnum value\fR) \(-> No return value. Sets the \fIpropnum\fR'th
property of \fIobj\fR to \fIvalue\fR. Note that properties 1-16 may only contain 0 or 1.
($move \fIobj dest\fR) \(-> No return value. Causes \fIobj\fR to be placed
inside \fIdest\fR, and adjusts pointers accordingly. \fBDanger\fR: No checking is
performed to verify that $move is not being used to violate the tree structure
of the object list (eg ($move obj obj)).
Bad results are likely if this occurs.
($say \fImsg\fR) \(-> No return value. Types \fImsg\fR.
($name \fIobj\fR) \(-> No return value. Types the (5-letter) name of \fIobj\fR.
($num \fIx\fR) \(-> No return value. Types the number \fIx\fR.
($exit \fIn\fR) \(-> Leave present routine. ($exit 1) causes the current
"turn" to be prematurely terminated and the next turn to be initiated
at the Demon phase. ($exit 0) returns to the driver to begin the next phase.
($rtrn \fIn\fR) \(-> Exits to the calling routine, returning value '\fIn\fR' TO
($spec \fIcode arg1 arg2 arg3 arg4\fR) \(-> Performs a special function as
3 Terminate this run of DDL
7 Preserve unknown words in file \fIarg1\fR
Functions 4 and 5 prompt for a file name in which the saved game is
kept. Function 7 causes any unknown words encountered by the parser
to be preserved in a file for later perusal by the
would be used to learn about things players have tried unsuccessfully
that should be dealt with. The file must already exist, and must
be specified as a string.
ALL arguments must be specified, even if zero.
($glob \fIn\fR) \(-> Value of global \fIn\fR. Equivalent to @\fIn\fR.
($verb) \(-> The ID of the verb returned by the parser (zero if none).
Typically used in comparisons, it is equivalent to @Verb.
($dobj) \(-> The ID of the direct object returned by the parser
(zero if none). Equivalent to @Dobj.
($dobj) \(-> The ID of the indirect object returned by the parser
(zero if none). Equivalent to @Iobj.
($setv \fIv1 v2 v3 v4 v5 v6 v7 v8 v9 v10\fR) \(-> sets the values in
the internal vector VECVERB to the values \fIv1\fR thru \fIv10\fR. These are
used by routines $hit and $miss.
($hit \fImover d1 d2 d3 d4 d5 d6 d7 d8 d9 d10\fR) \(-> No return value.
Compares ($verb) with the values in builtin vector VECVERB. When ($verb)
is found to match the nth entry in VECVERB, ($move \fImover d[n]\fR) is executed.
Note that \fImover\fR is what gets moved to d[n]; this argument is naturally
absent from $setv and $miss.
($miss \fIr1 r2 r3 r4 r5 r6 r7 r8 r9 r10\fR) \(-> no return value.
Compares ($verb) to VECVERB as $hit does. When a match to the nth
entry in VECVERB is found, routine \fIr\fR[n] is called. An attempt to
call routine 0 does nothing.
There are two varieties of strings. Constant strings defined
by the DDL programmer are permanent, and have a numeric "value"
greater than zero (which is in fact a table index). Strings
typed by the Player as a direct object, and strings produced
by the functions $eqst and $read are temporary, have a numeric
"value" less than zero (which allows the programmer to determine
if the direct object is in fact a string), and are purged by
having their index values recycled at the beginning of every turn.
No more than 200 such strings may be generated on a given turn.
($eqst \fIarg1 arg2\fR) \)-> 1 iff the strings specified by the
two \fIarg\fRs are equal, zero otherwise.
($subs \fIstr index length\fR) \)-> a string consisting of the
substring of \fIstr\fR, starting at character \fIindex\fR
(with an origin of Zero for the beginning of the string), for
the specified \fIlength\fR. A \fIlength\fR of zero causes
all the remaining characters starting at \fIindex\fR to be
($leng \fIstr\fR) \)-> The length of string \fIstr\fR.
($read) \)-> Causes \s-2DDL\s+2 to pause and wait for input from
the Player. Returns the string the player typed, without the
($sdem n) \(-> Activates routine n as a Demon, to be executed every
turn. At least one such Demon should exist, to Look at the Player's
current location, and to increment the turn counter
($ddem n) \(-> Removes routine n from the active Demon list. For
example, ($ddem Kount) undoes the action of ($sdem Kount).
($sfus rout n) \(-> Causes routine "rout" to be executed (one
time only) after n turns. Such a routine is called a Fuse.
($dfus rout) \(-> Causes routine rout to be taken off the
($itun) \(-> Increments the turn counter. This is a builtin function
because fuses depend upon the turn counter. The
option to "slow time" by refraining from incrementing the turn counter.
($gtun) \(-> Returns the current turn counter value.