games-request@tekred.TEK.COM (08/05/87)
Submitted by: cunniff%hpda@hplabs.HP.COM (Ross Cunniff) Comp.sources.games: Volume 2, Issue 20 Archive-name: adl/Part03 #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 3 (of 11)." # Contents: man/adldebug.6 man/doc.ab samples/mpu/locales.adl # Wrapped by billr@tekred on Tue Aug 4 16:27:37 1987 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f man/adldebug.6 -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"man/adldebug.6\" else echo shar: Extracting \"man/adldebug.6\" \(848 characters\) sed "s/^X//" >man/adldebug.6 <<'END_OF_man/adldebug.6' X X X X ADLDEBUG(6) (HP) ADLDEBUG(6) X X X X X NAME X adldebug - print information about an ADL game X X SYNOPSIS X adldebug infile X X DESCRIPTION X Adldebug reads a datafile, infile, which contains tables and X routines necessary to play a generalized Adventure(6)-like X game. Using adldebug, one may do such things as examine the X contents of objects, view the code genereated by adlcomp(6), X or print out the various messages found in the source. For X a full list of commands, type "?" after receiving the X prompt. To terminate adldebug, either type "q" or the EOF X character. X X EXAMPLE X adldebug aard X X SEE ALSO X adlcomp(6) X adlrun(6) X Brengle and Cunniff: The ADL Programmer's Reference Manual X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X Hewlett-Packard Company - 1 - Jun 18, 1987 X X X END_OF_man/adldebug.6 if test 848 -ne `wc -c <man/adldebug.6`; then echo shar: \"man/adldebug.6\" unpacked with wrong size! fi # end of overwriting check fi if test -f man/doc.ab -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"man/doc.ab\" else echo shar: Extracting \"man/doc.ab\" \(33706 characters\) sed "s/^X//" >man/doc.ab <<'END_OF_man/doc.ab' X X X$prop ( $prop obj num ) -> The numth property of obj. X X Example: X ($setg obj ($loc .ME)) X (IF ($prop @obj VISIT) THEN X ($say "I've been here before!\n") X ) X X X X$setp ( $setp obj num val ) -> No return value. Sets the X numth property of obj to val. X X Example: X ($setg obj ($loc .ME)) X ($setp @obj VISIT TRUE) X X X X$move ( $move obj loc ) -> No return value. Moves obj to X loc. WARNING: Do not attempt to violate the tree X structure of objects (e.g. ($move .ALL foobar)) or X horrible and unpredictable things will happen. X X Example: X (IF ($eq @Verb north) THEN X ($move .ME room2) X ) X X X X X X X X X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 27 - X X X7.2. Verb Routines X X These two routines operate on Verbs. They are provided Xfor scenarios in which the properties of Verbs may change. X X$vset ( $vset verb prop val ) -> No return value. The pro- X perty prop of verb is set to val. Prop must be X either PREACT or ACTION. X X Example: X ($vset @Verb PREACT Silly) X X X X$vprop ( $vprop verb prop ) -> The value of property prop X of verb. Prop must be either PREACT or ACTION. X X Example: X { Call Verb's PREACT } X ( ($vprop @Verb PREACT) ) X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 28 - X X X7.3. Arithmetic Routines X X These routines operate on arbitrary sixteen-bit Xnumbers, and return sixteen-bit values. Note that the Xnumbers may actually be Object IDs, global variable IDs, or Xany of the sixteen bit IDs used by ADL. X X$plus ( $plus num1 num2 ) -> Returns num1 + num2. X X Example: X ($setg Score ($plus @Score 50)) X X X X$minus ( $minus num1 num2 ) -> Returns num1 - num2. X X Example: X ($setg LivesLeft ($minus @LivesLeft 1)) X X X X$times ( $times num1 num2 ) -> Returns num1 * num2. X X Example: X ($setg TimeLeft ($times @NumBattery 10)) X X X X$div ( $div num1 num2 ) -> Returns num1 / num2. X X Example: X ($setg Rating ($div @Score 100)) X X X X$mod ( $mod num1 num2 ) -> Returns the remainder which X results when num1 is divided by num2 according to X normal integer division. X X Example: X { Make sure XPos is from 0 to 9 } X ($setg XPos ($mod @Xpos 10)) X X X X$rand ( $rand num ) -> Returns a random number from 1 to X num inclusive. X X Example: X { Move the player to a random room from room1 to room10 } X ($setg Num ($rand 10)) X ($move .ME ($plus room1 ($minus @Num 1))) X X X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 29 - X X X7.4. Boolean Routines X X These routines are typically used in conditionals and Xloops. However, traditional bit-masking may be done with X$and and $or. X X X$and ( $and a b c ... ) -> Returns the bitwise AND of the X vector a b c .... Note that since this is the bit- X wise AND, care must be taken in conditions since X ANDing two non-zero values does not necessarily X return a non-zero value. X X Example: X ($and 2 4) is 0 (0b0001 AND 0b0010 = 0b0000) X ($and 3 7) is 3 (0b0011 AND 0b0111 = 0b0011) X ($and 1 1) is 1 (0b0001 AND 0b0001 = 0b0001) X X X X$or ( $or a b c ... ) -> Returns the bitwise OR of the X vector a b c .... X X Example: X ($or 0 0) is 0 (0b0000 OR 0b0000 = 0b0000) X ($or 1 2) is 3 (0b0001 OR 0b0010 = 0b0011) X ($or 1 1) is 1 (0b0001 OR 0b0001 = 0b0001) X X X X$not ( $not num ) -> Returns zero if num is non-zero and X one if num is zero. Note that this is BOOLEAN NOT X and not BITWISE NOT. BITWISE NOT could be coded as X ($minus ($minus 0 %1) 1) for a two's complement X machine. X X Example: X ($not 0) is 1 X ($not 1) is 0 X ($not 5) is 0 X X X X$yorn ( $yorn ) -> Waits for the player to type a line of X input, returns one if this line begins with the X letter 'Y' or 'y', and returns zero otherwise. Note X that no prompt is automatically made for this input. X X Example: X ($say "Are you sure you want to quit? ") X (IF ($yorn) THEN X ($say "OK. Goodbye!\n") X ($spec 3) X ELSE X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 30 - X X X ($say "Whew! That was a close one!\n") X ) X X X X$pct ( $pct num ) -> Returns one num percent of the time X and zero the rest of the time. This is equivalent X to ($ge num ($rand 100)). X X Example: X (IF ($pct 30) THEN X ($say "The troll swings at you, and hits!\n") X ELSE X ($say "The troll's axe misses you by a hair!\n") X ) X X X X$eq ( $eq num1 num2 ) -> Returns one if num1 is equal to X num2 and zero otherwise. X X Example: X ($setg loc ($loc .ME)) X (IF ($eq @loc room1) THEN X ($say "You are in room 1.\n") X ) X X X X$ne ( $ne num1 num2 ) -> Returns one if num1 is not X equal to num2 and zero otherwise. X X Example: X ($setg loc ($loc .ME)) X (IF ($ne @LastLoc @loc) THEN X ($say "You've moved since I last checked!\n") X ) X X X X$lt ( $lt num1 num2 ) -> Returns one if num1 is less X than num2 and zero otherwise. X X Example: X (IF ($lt @Score 100) THEN X ($say "You are a novice adventurer\n") X ) X X X X$gt ( $gt num1 num2 ) -> Returns one if num1 is greater X than num2 and zero otherwise. X X Example: X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 31 - X X X (IF ($gt @Score 1000) THEN X ($say "You are a super master grand ") X ($say "champion mongo adventurer!!!\n") X ) X X X X$le ( $le num1 num2 ) -> Returns one if num1 is less X than or equal to num2 and zero otherwise. X X Example: X (IF ($le @Score 1000) THEN X ($say "You are a pretty good adventurer.\n") X ) X X X X$ge ( $ge num1 num2 ) -> Returns one if num1 is greater X than or equal to num2 and zero otherwise. X X Example: X (IF ($ge @Weight 200) THEN X ($say "The ice breaks under your weight!\n") X ) X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 32 - X X X7.5. Global Value Routines X X X$setg ( $setg which val ) -> Returns val. Sets the con- X tents of (or the value of) variable which to be val. X X$global ( $global which ) -> Returns the contents of (or the X value of) variable which. Equivalent to @which, X with the exception that $global allows arithmetic X expressions. X X Example: X Given: X VAR var[3]; X (var + 0) = 10; X (var + 1) = 20; X (var + 2) = 30; X X The statement X ($global ($plus var 2)) X would return 30. X X X X$verb ( $verb ) -> Returns the current Verb. Equivalent X to @Verb. X X Example: X (IF ($eq ($verb) take) THEN X ($say "You can't take that!!\n") X ) X X X X$dobj ( $dobj ) -> Returns the current direct object. X Equivalent to @Dobj. X X Example: X (IF ($eq ($dobj) ball) THEN X ($say "Dobj = ball\n") X ) X X X X$iobj ( $iobj ) -> Returns the current indirect object. X Equivalent to @Iobj. X X Example: X (IF ($eq ($iobj) basket) THEN X ($say "Iobj = basket\n") X ) X X X X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 33 - X X X$prep ( $prep ) -> Returns the current Preposition. X Equivalent to @Prep. X X Example: X (IF ($eq ($prep) into) THEN X ($say "Prep = into\n") X ) X X X X$conj ( $conj ) -> Returns the current conjunction. X Equivalent to @Conj. X X Example: X (IF ($eq ($conj) 1) THEN X ($say "The conjunction was 'but'\n") X ELSE X ($say "The conjunction was 'and' or ','\n") X ) X X X X$numd ( $numd ) -> Returns the length of the current X direct object list. Equivalent to @Numd. X X Example: X (IF ($gt ($numd) 1) THEN X ($say "You may not use multiple direct objects!\n") X ) X X X X X X X X X X X X X X X X X X X X X X X X X X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 34 - X X X7.6. Transition Routines X X ADL has an internal structure known as the Transition XVector. This structure is a list of ten verb IDs and is set Xand used by the following routines. These routines are typ- Xically used in the ACTION routines of rooms in scenarios in Xorder to move the player around. X X$setv ( $setv verb1 verb2 verb3 ... verb10 ) -> No return X value. Initializes the Transition Vector to the X list of verbs verb1 verb2 verb3 ... verb10. X X Example: X ($setv north south east west ne se nw sw up down) X X X X$hit ( $hit obj loc1 loc2 loc3 ... loc10 ) -> No return X value. Scans the Transition Vector for a match with X the current Verb. If found, obj is moved to the X corresponding loc. Nothing happens if no match is X found. An attempt to move an object to location 0 X (.ALL) is ignored. X X Example: X room1(ACTION) = X ($hit .ME room2 room3 room4 0 0 0 0 0 0 0) X ; X X X X$miss ( $miss rout1 rout2 rout3 ... rout10 ) -> No return X value. Scans the Transition Vector for a match with X the current Verb. If found, the corresponding rout X is called. Nothing happens if no match is found. X An attempt to call routine 0 does nothing. X X Example: X cg = ($say "You can't go that way.\n") X X room2(ACTION) = X ($miss 0 0 0 cg cg cg cg cg cg cg) X ; X X X X X X X X X X X X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 35 - X X X7.7. String Manipulation Routines X X There are basically three types of strings which an ADL Xprogram uses. The first type of string is the compile-time Xstring (a string which was present in the ADL source file of Xthe scenario). All compile-time strings have a positive Xstring ID and exist for the duration of program execution. X X The second type of string is the "volatile" run-time Xstring. Examples of this type of string include strings Xtyped by the player and strings produced by the builtin rou- Xtines $subs, $cat, $read, $name, $vname, $mname, $pname, X$num, and $chr (see also Sections 7.8 and 7.9). Volatile Xstrings have negative string IDs and are "flushed" at the Xbeginning of each turn (just before the Daemon phase). X X The third type of string is the "non-volatile" run-time Xstring. These strings also have negative string IDs but Xthey are never "flushed". These strings are produced by the X$savestr routine. Note that there is no easy way to distin- Xguish volatile and non-volatile run-time strings. X X In the context of the $subs and $pos routines, strings Xare indexed starting at zero (the first character of the Xstring). The following routines operate on all types of Xstrings: X X$eqst ( $eqst str1 str2 ) -> Returns one if str1 has the X same contents as str2 and zero otherwise. Note that X this is NOT the same as ($eq str1 str2), since the X $eq only compares the string IDs of the strings. X X Example: X The program: X ($setg str1 "hello") X ($setg str2 ($cat "he" "llo")) X (IF ($eqst @str1 @str2) THEN X ($say "String 1 == string 2\n") X ) X (IF ($ne @str1 @str2) THEN X ($say "String ID 1 != string ID 2\n") X ) X X will produce the output: X String 1 == string 2 X String ID 1 != string ID 2 X X X X$subs ( $subs str start len ) -> Returns a volatile copy X of the substring of str starting at start and going X for len characters. If len is 0, the suffix of str X starting at start is returned. X X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 36 - X X X Example: X The program: X ($setg str "Hello world") X ($say ($subs @str 0 5) "\n") X ($say ($subs @str 6 0) "\n") X X will produce the output: X Hello X world X X X X$leng ( $leng str ) -> Returns the length of str. X X Example: X ($leng "Hello") is 5 X ($leng "") is 0 X X X X$cat ( $cat str1 str2 ) -> Returns a volatile string X which is the result of concatenating str1 and str2. X X Example: X ($cat "hello " "world") returns "hello world" X X X X$pos ( $pos str1 str2 ) -> Returns the position of str1 X in str2. If no occurrence of str1 is found in str2, X -1 is returned. X X Example: X ($pos "hello" "hello world") is 0 X ($pos "Foobar" "bletch") is -1 X ($pos "testing" "This is a test") is -1 X ($pos "is" "This is a test") is 2 X X X X$read ( $read ) -> Returns a volatile string which is read X from the player's keyboard. Note that no prompt is X automatically generated. X X Example: X ($say "What is your name? ") X ($setg MyName ($read)) X ($say "Hello, " @MyName ", welcome to ADL!\n") X X X X$savestr( $savestr str ) -> Returns a non-volatile copy of X str. Note that str may be any string -- compile- X time, volatile, or non-volatile. X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 37 - X X X Example: X ($setg MyName ($savestr @MyName)) X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 38 - X X X7.8. Name Routines X X The following routines all return volatile strings Xwhich contain the requested name. X X$name ( $name obj ) -> Returns a volatile string contain- X ing the (possibly multiple-word) name of obj. X X Example: X ($say "You see no " ($name @Dobj) " here!\n") X X X X$vname ( $vname verb ) -> Returns a volatile string con- X taining the name of verb. X X Example: X ($say "No multiple objects with " ($vname @Verb) "!\n") X X X X$mname ( $mname modif ) -> Returns a volatile string con- X taining: the name of modifier modif (if modif is X greater than zero), the name of verb -modif (if X modif is less than zero), or the null string (if X modif is zero). X X Example: X ($say "The modifier of blue ball is " ($mname blue) "\n") X X X X$pname ( $pname prep ) -> Returns a volatile string con- X taining the name of Preposition prep. X X Example: X ($say "The sentence is:\n") X ($say ($vname @Verb) " " X ($name @Dobj) " " X ($pname @Prep) " " X ($name @Iobj) X ) X X X X X X X X X X X X X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 39 - X X X7.9. Conversion Routines X X The following routines perform conversions between Xstrings and numbers. X X$str ( $str num ) -> Returns a volatile string which con- X tains the ASCII representation of num. X X Example: X ($str 3) is the string "3" X X X X$num ( $num str ) -> Returns the numeric value of str. X X Example: X ($num "234") is the number 234 X X X X$ord ( $ord str ) -> Returns the ASCII code of the first X character in str. X X Example: X ($ord "ABC") is 65 X X X X$chr ( $chr num ) -> Returns a volatile string which con- X tains exactly one character, whose ASCII code is X num. X X Example: X ($chr 97) is the string "a". X X X X X X X X X X X X X X X X X X X X X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 40 - X X X7.10. Internal Structure Manipulation Routines X X The following routines are the means whereby the ADL Xprogrammer may modify the Internal Structures described in XChapter 3. See also Chapter 4 for the use of some of these Xroutines. X X$sdem ( $sdem rout ) -> No return value. Activates rout X as a daemon. X X Example: X ($sdem Looker) X ($sdem Follower) X X X X$ddem ( $ddem rout ) -> No return value. De-activates X rout as a daemon. No action is taken if rout is not X an active daemon. X X Example: X ($ddem Follower) X X X X$sfus ( $sfus actor rout count ) -> No return value. X Activates rout as a fuse associated with actor to be X executed in count turns. X X Example: X ($sfus .ME LampDie 300) X X X X$dfus ( $dfus actor rout ) -> No return value. De- X activates rout as a fuse associated with actor. No X action is taken if rout is not an active fuse. X X Example: X (IF @BatteryFound THEN X ($dfus .ME LampDie) X ) X X X X$incturn( $incturn [ nturns ] ) -> No return value. Incre- X ments the turn counter by nturns (or 1 if nturns is X not given) and activates any fuses associated with X the current actor that have "burned down". The X "burned down" fuses are then de-activated. The ADL X programmer to "halt time" by refraining from incre- X menting the turn counter. Usually, ($incturn) is X only called when the daemons are executing for the X primary actor. For other actors, ($incturn 0) is X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 41 - X X X used to see whether the fuses associated with the X current actor have burned down, without incrementing X the turn counter. X X Example: X sleep(ACTION) = ($incturn 300) ; X X X X$turns ( $turns ) -> Returns the current value of the turn X counter. X X Example: X (IF ($eq @Verb north) THEN X (IF ($gt ($turns) 230) THEN X ($move .ME room3) X ELSE X ($move .ME room5) X ) X ) X X X X$prompt ( $prompt rout ) -> No return value. Sets the X prompter to be rout. X X Example: X ($prompt Prompter) X X X X$actor ( $actor obj str flag ) -> No return value. X Activates obj as a new Actor with the line buffer X initialized to str. If flag is non-zero then the X new Actor will be interactive. If flag is zero then X the new Actor will be non-interactive. If str is X zero then the line buffer will be initialized to the X empty string. X X Example: X ($actor Myself NULL TRUE) X ($setg s "Go east then south. Push button. Go north") X ($actor robot @s FALSE) X X X X$delact ( $delact obj ) -> No return value. Deletes the X Actor associated with obj from the Actor list. No X action is performed if obj is not an active Actor. X X Example: X (IF ($prop robot BROKEN) THEN X ($delact robot) X ) X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 42 - X X X$define ( $define str1 str2 ) -> No return value. Informs X the parser that upon input from an Actor, the string X str1 is to be replaced with the contents of str2. X This process continues until an infinite loop is X detected or until a word is found for which there is X no corresponding expansion. Str1 must contain no X spaces. Str2 may contain several words separated by X spaces. Note that in the case of multiple defini- X tions (such as ($define "a" "b") followed by X ($define "a" "c")), the macro table should be viewed X as a stack with $define pushing macro definitions on X the stack and $undef popping definitions. X X Example: X (IF ($eq @MyDir 1) THEN X ($define "left" "north") X ($define "right" "south") X ELSE X ($define "left" "south") X ($define "right" "north") X ) X X X X$undef ( $undef str ) -> No return value. This routine X removes str and its expansion from the macro table. X No action is performed if str is not an active X macro. X X Example: X ($undef "left") X ($undef "right") X X X X X X X X X X X X X X X X X X X X X X X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 43 - X X X7.11. Special Routines X X$spec ( $spec code arg1 arg2 ... argN ) -> No return X value. Performs a special, system-dependent opera- X tion. Note that not all operations exist in all X implementations. Consult your local ADL documenta- X tion for information. X X X +------+---------------------------------------+ X | code | function | X +------+---------------------------------------+ X | 1 | Toggle the instruction trace flag | X | 2 | Restart this game | X | 3 | Terminate execution of this game | X | 4 | Save this game in file arg1 | X | 5 | Restore this game from file arg1 | X | 6 | Execute the system program named arg1 | X | 7 | Preserve unknown words in file arg1 | X | 8 | Write a script to file arg1 | X | 9 | Print a header line on the screen | X | 10 | Set the right margin | X +------+---------------------------------------+ X X Function 1 X Toggles the instruction trace flag. If this X flag is set, an instruction trace and stack X dump are printed for every ADL instruction exe- X cuted (a very messy but informative process). X X Function 2 X Re-initializes all ADL structures and vari- X ables, re-executes START, and generally starts X the game over from the beginning. X X Function 3 X Terminates the game immediately, no questions X asked. X X Function 4 X Saves a "core image" of the ADL structures and X variables sufficient to restore the game to the X same position later. X X Function 5 X Reads a "core image" which was created by a X previous invocation of Function 4, thus restor- X ing the game to its previous state. X X Function 6 X Runs the program arg1 with arguments arg2 X through argN. All arguments must be strings, X except the last argument which must be 0. X X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 44 - X X X Function 7 X Starts recording those words from the player's X input which are unrecognized by the run-time X parser. The words are appended to the file X named by arg1. This recording is stopped if X arg1 is 0. X X Function 8 X Starts recording a "script" of all input and X output produced during the subsequent execution X of the game. The script is written into the X file named by arg1. Stops recording if arg1 is X 0. X X Function 9 X Prints a line of the form "Room Name X Score: NN Moves: NN" at the top of the X screen. It is assumed that arg1 is the name of X the room, arg2 is the current score, and arg3 X is the number of turns that have passed. X X Function 10 X Sets the right margin to arg1. This function X is provided for the use of those games whose X messages would look better on narrower (or X wider) screens than the default of 80 columns. X X Examples: X VERB debug; X debug(ACTION) = ($spec 1); X X VERB restart; X restart(ACTION) = ($spec 2); X X VERB quit; X quit(ACTION) = ($spec 3); X X VERB save; X save(ACTION) = X LOCAL name; X ($say "Save to what filename? ") X ($setg name ($read)) X (IF ($leng @name) THEN X ($spec 4 @name) X ) X ; X X VERB restore; X restore(ACTION) = X LOCAL name; X ($say "Restore from what filename? ") X ($setg name ($read)) X (IF ($leng @name) THEN X ($spec 5 @name) X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 45 - X X X ) X ; X X VERB shell; X shell(ACTION) = X ($spec 6 "/bin/csh") X ; X X VERB savewords; X savewords(ACTION) = X ($spec 7 "unknown.wrds") X ; X X VERB script; X script(ACTION) = X LOCAL name; X ($say "Script to what filename? ") X ($setg name ($read)) X (IF ($leng @name) THEN X ($spec 8 @name) X ) X ; X X Status = ($spec 9 ($name ($loc .ME)) @Score ($turns)) ; X X START = ($spec 10 60); { It makes the text prettier } X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 46 - X X X7.12. Miscellaneous Routines X X These routines are placed here for lack of a better Xplace to put them. X X X$say ( $say str1 str2 ... ) -> No return value. Prints X the messages str1 str2 ... on the screen. Note that X ADL automatically "word-wraps" strings so that they X fit within the right margin as closely as possible. X Therefore, it is not necessary for the ADL program- X mer to take great care in formatting the messages X passed to $say. If the programmer desires that the X current line be terminated, and output start on a X new line, the character sequence "\n" should be X embedded in the string. Note that each str may X actually be an expression such as ($name foo) or X ($num @Score). X X Example: X ($say "Hi! My name is " @MyName "! How are you today?\n") X Note that MyName is assumed to contain a string ID. X X X X$arg ( $arg num ) -> Returns the numth argument of the X current routine. It is basically the same as %num X except that in this case num may be a numeric X expression, not just a numeric constant. ($arg 0) X returns the number of arguments passed to this invo- X cation of the current routine. X X Example: X { Print all of the arguments to this routine } X ($setg i 1) X (WHILE ($le @i %0) DO X ($say "Arg " @i " = " ($arg @i) "\n") X ) X X X X$exit ( $exit code ) -> Doesn't return to the current rou- X tine. $exit terminates execution of the current X phase. If code is 0, control passes to the next X phase. If code is 1, control passes to the outer- X most loop. If code is 2, control passes to the top X of the Dobj loop. If code is 3, control passes to X the parser which attempts to complete a partial sen- X tence. See the diagram in Chapter 4 for a complete X definition. X X Example: X take(PREACT) = X (IF ($ne ($loc @Dobj) ($loc .ME)) THEN X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 47 - X X X ($say "You don't see that here!\n") X { Skip the rest of the phases } X ($exit 1) X ) X ; X safe(ACTION) = X (IF ($eq @Verb take) THEN X ($say "You can't budge the safe.\n") X { Go on to the rest of the Dobjs } X ($exit 2) X ) X ; X ball(ACTION) = X (IF ($prop ball BROKEN) THEN X { Rely on the default verb ACTION } X ($exit 0) X ) X ($say "The ball bounces nicely.\n") X ; X NOVERB(PREACT) = X ($say "What do you want me to do with the " X ($say ($name @Dobj) "?\n") X { Re-parse the sentence } X ($exit 3) X ; X X X X$return ( $return expr ) -> Doesn't return to the current X routine. Evaluates expr and returns the result to X the current routine's caller. Note that in the X absence of an explicit $return, the return value of X a routine is the same as the value of the last X statement executed. X X Example: X Increment = ($return ($plus %1 1)) X X ($say "Increment( 3 ) = " (Increment 3) "\n") X Increment( 3 ) = 4 X X X X$val ( $val expr ) -> Evaluates expr and returns the X result. Expr may be a routine call, a constant, a X string, or anything that yields a 16-bit value. X This routine is most useful in conditional expres- X sions. X X Example: X Signum = X (IF ($lt %1 0) THEN X ($val -1) X ELSEIF ($eq %1 0) THEN X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 48 - X X X ($val 0) X ELSE X ($val 1) X ) X ; X X X X$phase ( $phase ) -> Returns the number of the phase X currently executing. This number is 0 during the X START phase, 1 during the Daemon phase, 2 during the X Actor ACTION, 3 during the Verb PREACT, 4 during the X Iobj ACTION, 5 during the Dobj ACTION, 6 during the X Verb ACTION, and 7 during the Room ACTION. X X Example: X (IF ($eq ($phase) 2) THEN X ($say "This is the Actor ACTION\n") X ELSEIF ($eq ($phase) 4) THEN X ($say "This is the Iobj ACTION\n") X ELSEIF ($eq ($phase) 5) THEN X ($say "This is the Dobj ACTION\n") X ) X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 49 - X X X8. ADL Program Structure X X In the following extended BNF description of ADL pro- Xgram structure, terminal symbols are in BOLD UPPERCASE and Xnon-terminals in lowercase. Items enclosed in quotes are Xliteral terminals. X X X adlprog = stmt * X X stmt = "INCLUDE" STRING ";" X = "MESSAGE" STRING ";" X = decl X = assign X X decl = "VERB" ilist X = "ADJEC" ilist X = "ROUTINE" ilist X = "ARTICLE" ilist X = "PREP" ilist X = "VAR" vlist X = "NOUN" nlist X X assign = ID "=" expr ";" X = nounp "(" nprop ")" "=" expr ";" X = VERB "(" vprop ")" "=" routine ";" X = "(" VAR [ "+" const ] ")" "=" expr ";" X = PREP nounp PREP "=" PREP ";" X = VERB PREP "=" VERB ";" X X ilist = ID ( "," ID ) * ";" X X vlist = vdec ( "," vdec ) * ";" X X vdec = ID [ "[" const "]" ] X X nlist = nloc ( "," nloc ) * ";" X X nloc = nounp [ "(" nounp ")" ] X X nounp = [ modif ] NOUN X = OBJECT X X modif = VERB X = ADJEC X X vprop = "PREACT" X = "ACTION" X X nprop = const X = "LDESC" X = "SDESC" X = "ACTION" X X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 50 - X X X const = NUMBER X = CONST_ID X X expr = const X = STRING X = nounp X = routine X = modif X = ROUTINE X = PREP X = ARTICLE X = VAR X X routine = [ locals ] form + X X locals = "LOCAL" vlist X X form = "(" ifthen elseif * [ else ] ")" X = "(" "WHILE" arg "DO" form + ")" X = "(" arg + ")" X X ifthen = "IF" arg "THEN" form + X X elseif = "ELSEIF" arg "THEN" form + X X else = "ELSE" form + X X arg = form X = "@" VAR X = "[" nounp "]" X = ".ME" X = "%"NUMBER X = const X = STRING X = NOUN X = OBJECT X = ROUTINE X = modif X = PREP X = ARTICLE X = VAR X = vprop X = nprop X X X X X X X X X X X X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 51 - X X X9. ADL Sentence Structure X X In the following extended BNF description of ADL sen- Xtences, terminal symbols are in BOLD UPPERCASE and non- Xterminals in lowercase. A CONJ is one of the word "and", a Xcomma (","), or the word "but"; a SEP is one of a period X("."), the word "then", or a newline. Comment statements Xstart with "--" and continue to the end of the line. X X X input-line = ( sentence SEP ) * X X sentence = simple-sent -- Verb, Iobj, and Dobj are X -- as you would expect X = noverb-sent -- Verb = NOVERB; Iobj and Dobj X -- are as you would expect X = teller-sent -- Verb = TELLER; Iobj = object; X -- Dobj = STRING X X simple-sent = verb-phrase [ dobj-list ] [ prep object ] [ prep ] X = verb-phrase object dobj-list [ prep ] X X noverb-sent = [ dobj-list ] [ prep object ] [ prep ] X = object dobj-list [ prep ] X X teller-sent = object "," STRING X = object "," VERB REST-OF-STRING X X verb-phrase = VERB PREP * X X dobj-list = object ( CONJ object ) * X X object = [ ARTICLE ] modif NOUN X = [ ARTICLE ] modif X = [ ARTICLE ] NOUN X = [ ARTICLE ] OBJECT X = STRING X X modif = VERB X = ADJEC X X prep = PREP X = PREP PREP X = PREP object PREP X X X X X X X X X X X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 52 - X X X10. standard.adl X X Standard.adl is a file that contains many useful Xdefault definitions and routines. To use standard.adl, sim- Xply put 'INCLUDE "standard.adl"' before the rest of your Xprogram. X X Standard.adl defines six things: object properties, Xconstants, global variables, useful words, some normal verbs Xand their actions, and some utility routines. X X10.1. Object properties X X The following object properties are defined in X standard.adl. The ADL programmer using standard.adl is X advised not to re-use these properties with different X meanings, as strange and unusual things will happen. X X SEEN = 16; X OPENS = 15; X LOCKS = 14; X OPENED = 13; X LOCKED = 12; X TRANS = 11; X LIGHT = 10; X FLAME = 9; X NOTAKE = 8; X AllLink = 29; X SAVESENT = 28; X X This leaves boolean properties 1 though 7 and integer X properties 17 through 28 free for the programmer's X definition and use. The above properties are used as X follows: X X SEEN The standard looking daemon sets this X property of a room to TRUE whenever the X player visits the room. X X OPENS This property should be set to TRUE if it X is possible to open or close the object X (a treasure chest would be an example of X this). X X LOCKS This property should be set to TRUE if it X is possible to lock or unlock the object X (a door might be a good example of this). X X OPENED This property is set to TRUE if the X object is already opened and FALSE if the X object is closed. This is meaningful X only if OPENS is TRUE. X X LOCKED This property is set to TRUE if the X X X X c 1987 Ross Cunniff and Tim Brengle X X X X X X - 53 - X X X object is locked and FALSE if the object X is unlocked. This is meaningful only if X LOCKS is TRUE. X X TRANS This property should be set to TRUE if X the object is transparent (a glass box or X a bottle would be a good example of X this). X X LIGHT This property should be set to TRUE if X the object gives off light (in the case X of a transportable object like a flash- X light) or if the object is intrinsically X lit (like an outdoor location). X X FLAME This property should be set to TRUE if X the object is on fire. X X NOTAKE This property should be set to TRUE if it X is desired that "take" and "drop" ignore X the object when "take all" or "drop all" X are requested. X X AllLink This property is used by the PREACT and X ACTION routines of the verbs "take" and X "drop" and should not be used by anything X else. X X SAVESENT This property is used to hold the start- X ing number of a block of six global vari- X ables in which to store a sentence for X use with ActAction, below. X X X10.2. Constants X X For convenience and readability, standard.adl defines X the following constants: END_OF_man/doc.ab if test 33706 -ne `wc -c <man/doc.ab`; then echo shar: \"man/doc.ab\" unpacked with wrong size! fi # end of overwriting check fi if test -f samples/mpu/locales.adl -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"samples/mpu/locales.adl\" else echo shar: Extracting \"samples/mpu/locales.adl\" \(18212 characters\) sed "s/^X//" >samples/mpu/locales.adl <<'END_OF_samples/mpu/locales.adl' XSayer = X (IF ($not %2) THEN X ($say %1 "\n") X ) X ($return %1) X; X X.ALL(LDESC) = X ($say "You shouldn't be here at all. This is THE COSMIC ALL.\n") X; X.ALL(SDESC) = X ($return (Sayer "THE COSMIC ALL" %0)) X; X Xrdsc = ($return (Sayer "Road" %0)); Xrldsc = ($say "You are on the road.\n"); X Xroad1(SDESC) = rdsc; Xroad1(LDESC) = X ($say X"You're on a dirt road going east-west. Tall stalks of Xcorn grow on either side of the road.\n" X ) X; X Xroad2(SDESC) = rdsc; road2(LDESC) = rldsc; X Xroad3(SDESC) = X ($return (Sayer "Bridge" %0)) X; Xroad3(LDESC) = X (IF ($prop dragon KILLED) THEN X ($say "You are on a bridge over a swift river. ") X ELSE X ($say "You are on a bridge over a dry river bed. ") X ) X ($say "The river goes north-south, and the road continues east-west.\n") X; X Xroad4(SDESC) = rdsc; road4(LDESC) = rldsc; Xroad5(SDESC) = rdsc; road5(LDESC) = rldsc; X Xroad6(LDESC) = X ($say X"A road from the west forks north and south here. To the east is a Xdense-looking forest; cornfields are seen on the west.\n" X ) X; Xroad6(SDESC) = ($return (Sayer "Fork in road" %0)); X Xroad7(SDESC) = rdsc; Xroad7(LDESC)= X ($say X"The road stretches a long way east-west. A short fence divides the Xroad from the cornfields beyond. Please don't tresspass.\n" X ) X; X X Xgdsc = X ($say "You are somewhere in a cornfield. The cornstalks are ") X (IF ($prop dragon KILLED) THEN X ($say "green and healthy.\n") X ELSE X ($say "brown and dry-looking.\n") X ) X; X Xgsdsc = ($return (Sayer "Cornfield" %0)); Xfsdsc = ($return (Sayer "Forest" %0)); X Xgard1(SDESC) = gsdsc; gard1(LDESC) = gdsc; Xgard2(SDESC) = gsdsc; gard2(LDESC) = gdsc; X Xfrst1(SDESC) = fsdsc; frst1(LDESC) = fdsc; X Xfarm1(SDESC) = ($return (Sayer "Farm Entrance" %0)); Xfarm1 (LDESC) = X ($say X"You are at the entrance on the south side of a rundown Xfarmhouse. Someone has painted 'DIE, HEATHENS' on the Xfront door, which barely stays on its hinges. Marks of Xsmoke and flame are visible. A road runs to the south, Xand you may walk around the farmhouse by going east or west.\n" X ) X; X Xfarm2(LDESC) = X ($say X"You are in the entry hall of a long-deserted old farmhouse. XThe floor is covered with the dust of years of disuse. The Xfront door to the south is open, and there is another room Xto the north. A stairway on the east side of the room goes up.\n" X ) X; Xfarm2(SDESC) = X ($return (Sayer "Entry hall" %0)) X; X X Xfarm3(LDESC) = X ($say X"You are on the east side of the farmhouse. To the east, a forest Xstretches away into the distance. The entrance to the farmhouse Xis to the south.\n" X ) X; Xfarm3(SDESC) = X ($return (Sayer "East of Farmhouse" %0)) X; X Xfarm4(LDESC) = X ($say X"You are on the west side of the farmhouse. The cornfields Xstretch away forever to the west. The entrance to the house Xis to the south.\n" X ) X; Xfarm4(SDESC) = X ($return (Sayer "West of Farmhouse" %0)) X; X Xfarm5(LDESC) = X ($say X"You are on the north side of the farmhouse. A high fence Xseparates you from the cornfields to the north and west. " X ) X ($move insignia farm5) X; Xfarm5(SDESC) = X ($move insignia farm5) X ($return (Sayer "North of Farmhouse" %0)) X; X X Xfarm6(LDESC) = X ($say X"You are in an old, empty farmhouse kitchen. All the Xcupboards and cabinets are bare (unless you can eat the Xthick layer of dust which covers everything).\n" X ) X; Xfarm6(SDESC) = X ($return (Sayer "Kitchen" %0)) X; X Xfarm7(LDESC) = X ($say X"You are in the upstairs bedroom of the farmhouse. All the Xwindows are boarded up, and nobody has slept here for years. XTo the east is an exit leading to the entry hall below. " X ) X (IF ($prop bed OPENED) THEN X ($say X"In the middle of the room is an old, rickety bed. The west wall " X ) X (IF ($prop panel OPENED) THEN X ($say "has a panel missing, revealing a secret stairway down.\n") X ELSE X ($say "seems to have a loose panel.\n") X ) X ELSE X ($say X"Against the west wall is an old, rickety bed (which may be Xwhy nobody has slept here for years).\n" X ) X ) X; Xfarm7(SDESC) = ($return (Sayer "Bedroom" %0)); X XPanL = { Try to go through panel } X (IF ($prop panel OPENED) THEN X ($move .ME cel01) X ($say "You descend into the gloom...\n") X ELSEIF ($eq ($loc .ME) farm7) THEN X (cg) X ($exit 1) X ) X; X X Xtown1(SDESC) = X ($return (Sayer "Town" %0)) X; Xtown1(LDESC) = X ($say X"You are at the northern end of a one-horse town. Although the buildings Xare in good shape, all seem deserted. You can't even find one horse. XTo the east is an old smithy. On the west side of the street is an Xabandoned hotel. The street runs north and south.\n" X ) X; X Xtown2(SDESC) = X ($return (Sayer "Business District" %0)) X; Xtown2(LDESC) = X ($say X"You are at the southern end of a one-horse town. This is the Xbusiness district. On the east side of the street is an old Xbuilding with a tastefully lettered sign, 'Arpa-Citizen's Savings'. XTo the west is the legendary 'Packet Inn'. The street runs north-south.\n" X ) X; X Xtown3(SDESC) = X ($return (Sayer "Blacksmith's Shop" %0)) X; Xtown3(LDESC) = X ($say X"You're in what is left of a once-thriving blacksmith's shop. XLong ago abandoned, nothing much of interest remains.\n" X ) X; X Xtown4(SDESC) = X ($return (Sayer "Flophouse" %0)) X; Xtown4(LDESC) = X ($say X"You're in the Flophouse hotel. Never worth the visit even in Xits heyday, a quick search reveals nothing but a lot of dusty rooms.\n" X ) X; X Xtown5(SDESC) = X ($return (Sayer "Bank" %0)) X; Xtown5(LDESC) = X ($say X"You are in the ancient and venerable institution of Arpa-Citizen's XSavings (there's a branch in your town). The lobby is tastefully Xdecorated in marble. The only feature is a strange sweet-smelling Xwell in the center of the room. A mysterious plaque on the side " X"reads:\n X 'Drop your bits here!'\n" X ) X; XTWN5y = X ($setp .ME HAS ($minus ($prop .ME HAS) ($prop @Dobj WEIGH))) X ($move @Dobj ($loc .ME)) X ($say "A strange glowing network of lights appears, and you can read:\n") X (IF ($prop ($dobj) POINT) THEN X ($setg SCORE ($plus @SCORE ($prop ($dobj) POINT))) X ($move ($dobj) .ALL) X ($say X" Your account is now at $" ($str @SCORE) ".\n X Thank you for letting Arpa-Citizen's be your host.\n" X ) X ELSE X ($say " Your deposit is worthless") X (IF ($pct 25) THEN X ($say ", but thanks for the trinket!\n") X ($move ($dobj) .ALL) X ELSE X ($say "! Keep it!\n") X ) X ) X ($say "The Arpa network mercifully disappears.\n") X; X Xtown6(SDESC) = X ($return (Sayer "Packet Inn" %0)) X; Xtown6(LDESC) = X ($say X"You are at that famous old saloon, the Packet Inn. Thousands Xof the local adventurers drank 'till they were totally zorked in Xthis colorful old haunt. A little wandering convinces you that Xnothing much is to be seen.\n" X ) X; X X{*** DUNGEON PROPER ***} Xcel01(LDESC) = X ($say X"You are in a secret cellar below the farmhouse. In the Xcorner of one wall is a strange insignia composed of red Xand green squares, joined at the corners. Passages Xlead to north and west. An old stairway leads up and out.\n" X ) X ($move insignia cel01) X; Xcel01(SDESC) = X ($move insignia cel01) X ($return (Sayer "Secret Cellar" %0)) X; X Xcel02(LDESC) = X ($say X"You are in a cool cave, once used for the storage of rare Xwines. A cool breeze from the caves to the north keeps this cave Xat an even temperature the year round. Exits can be seen Xto the north, south, and east.\n" X ) X; Xcel02(SDESC) = ($return (Sayer "Cool Cave" %0)) X; X X{ cel03 was moved to after cel08 } X X Xcel04(LDESC) = X ($say X"This is a small temple to Elbereth, Queen of the Stars. The walls Xglow with a warm iridescence of their own. They are covered Xwith murals depicting the kindling of the stars at the Beginning of XDays. In the corner someone has added an insignia consisting of red Xand white squares joined at the corners. Passages lead east and west, Xand a stairway to the north leads down into darkness.\n" X ) X ($move insignia cel04) X; Xcel04(SDESC) = X ($move insignia cel04) X ($return (Sayer "Temple" %0)) X; Xcel04(LIGHT)=TRUE; X X Xcel05(LDESC) = X (IF ($prop dragon KILLED) THEN X ($say X"You are in a very wet cave. Puddles of extremely cold water Xare everywhere." X ) X ELSE X ($say X"You are in an icy cave. All the walls are covered with thick Xlayers of ice." X ) X ($move ice cel05) X ) X ($say X" The cave continues north and south, and there is a side tunnel leading Xto the northeast.\n" X ) X; Xcel05(SDESC) = X (IF ($prop dragon KILLED) THEN X ($return (Sayer "Wet Cave" %0)) X ELSE X ($move ice cel05) X ($return (Sayer "Ice Cave" %0)) X ) X; X Xcel06(LDESC) = X ($say "You have reached a large cavern") X (IF ($not ($prop dragon KILLED)) THEN X ($say X" of ice. You cannot see Xthe roof, but you are sure it is covered with icicles.\n" X ) X ($move ice cel06) X ELSE X ($say X". You cannot see the roof, Xand it looks like something has melted, covering the floor with puddles.\n" X ) X ) X ($say "There are exits east and southwest.\n") X; Xcel06(SDESC) = X (IF ($not ($prop dragon KILLED)) THEN X ($move ice cel06) X ) X ($return (Sayer "Great Cavern" %0)) X; X X Xcel07(LDESC) = X ($say "You are in a tiny side room where the ice dragon ") X (IF ($prop dragon KILLED) THEN X ($say "kept") X ELSE X ($say "keeps") X ) X ($say X" his single prize treasure. You may leave through a western doorway.\n" X ) X; Xcel07(SDESC) = X ($return (Sayer "Treasure Room" %0)) X; X Xcel08(LDESC) = X ($say X"You are in an old abandoned room, once the resident of a frustrated Xartist. A huge mural depicting " X ) X (IF ($prop dragon KILLED) THEN X ($say "a gentle green field ") X ELSE X ($say "a barren wasteland ") X ) X ($say X"covers the west wall. A dim glow comes from the corridor to the east. XVandals have apparently been here too, for on the painting is drawn a Xstrange insignia consisting of red and blue squares, joined at the corners.\n" X ) X ($move insignia cel08) X; Xcel08(SDESC) = X ($move insignia cel08) X ($return (Sayer "Artist's Retreat" %0)) X; X Xcel03(LDESC) = X (IF ($prop dragon KILLED) THEN X ($say X"You are standing on the south bank of a turbulent underground Xriver. The only way to go is back south.\n" X ) X ELSE X ($say X"You are standing on a frozen underground river. The Xsource of the river seems to have been to the west, and Xyou can walk that way on the ice. However, to the Xnortheast, the river forms a frozen waterfall you can Xslide down.\n" X ) X ($move ice cel03) X ) X; Xcel03(SDESC) = X (IF ($prop dragon KILLED) THEN X ($return (Sayer "Bank of Underground River" %0)) X ELSE X ($move ice cel03) X ($return (Sayer "Top of Frozen Fall" %0)) X ) X; X Xcel09(LDESC) = X ($say X"You are at the southern end of a dry river gorge. The source Xof the river was once a waterfall to the south, but for some reason Xit seems frozen solid. The riverbed continues north. There is Xa large crack in the waterfall to the south.\n" X ) X ($move ice cel09) X; Xcel09(SDESC) = X ($move ice cel09) X ($return (Sayer "Southern Gorge" %0)) X; X Xcel10(LDESC) = X ($say X"You are in a dark cave. The low-hanging stalactites and tall Xstalagmites cast eerily human-like shadows on the craggy walls. XA roughly-hewn stairway to the south is lit by a dim illumination Xfrom above, while a slimy pit in the middle of the room leads Xdown into even inkier blackness." X ) X (IF ($prop dragon KILLED) THEN X ($say " The pit is full of very cold water.") X ) X ($say "\n") X; Xcel10(SDESC) = X ($return (Sayer "Shadowy Cave" %0)) X; X Xcel11(LDESC) = X (IF ($and (See [clear crystal] ($cont ($loc .ME))) X ($prop [clear crystal] LIGHT) X ) X THEN X ($say X"You are in an impossibly dark cave. Only the light from your Xmagic crystal makes it possible to see, even dimly, here. You Xcan make out a tunnel leading leading west, and another leading Xeast. No other exits are visible. A large pit lies in the middle Xof the cave.\n" X ) X ELSE X ($say "It's mighty dark in here!") X (IF (See globe ($cont ($loc .ME))) THEN X (IF ($prop globe LIGHT) THEN X ($say " Even your glowing globe is barely visible!") X ) X ) X ($say "\n") X ($setg Dark TRUE) X ) X; X Xcel11(SDESC) = X (IF ($not ($and (See [clear crystal] ($cont ($loc .ME)) ) X ($prop [clear crystal] LIGHT) X )) X THEN X ($setg Dark TRUE) X ) X ($return (Sayer "DARK Cave" %0)) X; X Xcel12(LDESC) = X ($say X"You are in a small chamber which is not quite as dark as the DARK Xcave to the west. There are no other exits.\n" X ) X; Xcel12(SDESC) = X ($return (Sayer "Small Chamber" %0)) X; X XVAR X BSaid; X Xcel13(LDESC) = X ($say X"You are on a large underground lake of ice, thick enough Xto walk on. To the west you can dimly make out a cavern Xentrance; to the east is an icy river you can walk on. " X ) X (IF ($prop cel13 HOLED) THEN X ($say X"In the middle of the lake is a hole; icy water sloshes about Xtwo feet below the ice." X ) X ) X ($say "\n") X ($setg BSaid FALSE) X ($move ice cel13) X; Xcel13(SDESC) = X ($setg BSaid FALSE) X ($move ice cel13) X ($return (Sayer "Icy Lake" %0)) X; X XBDesc = X (IF ($prop wetsuit WORN) THEN X ($say "Luckily, your wetsuit enables you to breathe down here.\n") X ELSEIF ($not @BSaid) THEN X ($say "You can't hold your breath for long...\n") X ($setg BSaid TRUE) X ) X; X Xcel14(LDESC) = X ($say X"You are under the ice of a frozen lake. You can barely make out exits Xto the east and west. " X ) X (IF ($prop cel13 HOLED) THEN X ($say "There is a hole in the ice above you.\n") X ELSE X ($say "A diffuse light comes through the ice above.\n") X ) X (BDesc) X ($move ice cel14) X; Xcel14(SDESC) = X ($move ice cel14) X ($return (Sayer "Underwater" %0)) X; X Xcel15(LDESC) = X ($say X"You are on a sandy beach in a small ice cave. A small pool of water Xcomes up to the beach from the east, and a quick survey of the place Xshows that it is completely covered by the stony roof. You can walk up Xto the back of the cave to the south, but the pool seems to be the only Xother exit.\n" X ) X ($setg BSaid FALSE) X; Xcel15(SDESC) = X ($setg BSaid FALSE) X ($return (Sayer "Sandy Beach" %0)) X; X Xcel16(LDESC) = X ($say X"You are at the back of a small ice cave. A sandy shore slopes down Xto a blue pool of water to the north. To the east is a small crawlway Xleading into inky blackness.\n" X ) X; Xcel16(SDESC) = X ($return (Sayer "Back of Cave" %0)) X; X Xcel17(LDESC) = X ($say X"You are in a stream under a ceiling of ice. The stream Xleads northeast, and to the west you can see more light.\n" X ) X (BDesc) X ($move ice cel17) X; Xcel17(SDESC) = X ($move ice cel17) X ($return (Sayer "In Stream" %0)) X; X Xcel18(LDESC) = X ($say X"You are in a hollow spot behind a frozen waterfall to the north. XAbove you, a ceiling of ice gradually lowers to meet a dark Xbody of water to the southwest. There is a large crack in the Xwaterfall.\n" X ) X ($move ice cel18) X ($setg BSaid FALSE) X; Xcel18(SDESC) = X ($setg BSaid FALSE) X ($move ice cel18) X ($return (Sayer "Hollow Spot" %0)) X; X Xcel19(LDESC) = X ($say X"You are at the source of a frozen stream which flows out of the Xrock to the west. The stream continues to the east.\n" X ) X ($move ice cel19) X; Xcel19(SDESC) = X ($move ice cel19) X ($return (Sayer "Source of Frozen Stream" %0)) X; X Xcel20(LDESC) = X ($say X"You are in what was once a study. The furniture has Xbeen smashed to splinters, and none of the papers or Xbooks remain intact. The only exit is to the west.\n" X ) X; Xcel20(SDESC) = X ($return (Sayer "Study" %0)) X; X Xcel21(LDESC) = X (IF ($eq @RiverLoc GRATELOC) THEN X ($say X"You have reached a point where a bridge crosses the dry river bed. XThe river bed is blocked by a large iron grate to the south.\n" X ) X ELSEIF ($eq @RiverLoc BEND1LOC) THEN X ($say X"You are at a sharp bend where the dry river bed coming from the south Xturns to the west.\n" X ) X ELSEIF ($and ($gt @RiverLoc BEND1LOC) ($lt @RiverLoc BEND2LOC)) THEN X ($say "You are in a dry river bed that runs east-west.\n") X ELSEIF ($eq @RiverLoc BEND2LOC) THEN X ($say X"You are at a sharp bend where the dry river bed coming from Xthe east turns to the south.\n" X ) X ELSE X ($say "You are in a dry river bed that runs north-south.\n") X ) X; Xcel21(SDESC) = X (IF ($eq @RiverLoc GRATELOC) THEN X ($return (Sayer "Under Bridge" %0)) X ELSEIF ($or ($eq @RiverLoc BEND1LOC) ($eq @RiverLoc BEND2LOC)) THEN X ($return (Sayer "Bend in River" %0)) X ELSE X ($return (Sayer "Dry River Bed" %0)) X ) X; X Xdesert(LDESC) = X ($say X"You are lost in the middle of a vast desert. The terrain Xis the same, no matter which way you look. The heat Xis tremendous, and you have no water. In other words, Xyou're in trouble!\n" X ) X; Xdesert(SDESC) = X ($return (Sayer "Desert" %0)) X; X Xfield(LDESC) = X ($say X"You are in the middle of a grassy field. Above you is a beautiful Xblue sky in which fleecy white clouds make pretty shapes. The sound Xof birds fills the air. A path leads north to a large building built Xof white marble, with hundreds of columns and sculptures about.\n" X ) X; Xfield(SDESC) = X ($return (Sayer "Grassy Field" %0)) X; X XENDGAME = X ($say X"As you approach the building, a robed figure emerges from the door of the Xbuilding. He looks at you and says, \"I am the former owner of the farm Xand of the cellar below. You have shown great merit in your struggle Xto solve my puzzles. " X ) X (IF ($cont .ME) THEN X ($say X"However, you must shun all things wordly before you Xcan enter here. Return to your world and come back when you have Xattained this.\"\n" X ) X ELSEIF ($lt @SCORE PMAX) THEN X ($say X"Unfortunately, you have failed to return all misplaced Xtreasures to their proper location. Consider this: a penny saved Xis a penny earned!\"\n" X ) X ELSE X ($say X"You have also wisely shed yourself Xof damaging worldly affectations, and have honorably satisfied your Xobligations. Come and join our circle of philosophers!\" X\n\tThe robed figure escorts you into the building. You have finished Xthe game!\n" X ) X ($spec 3) X ) X ($say "The robed figure waves his arms, and you are transported to...\n") X ($move .ME road1) X ($setg GO TRUE) X; END_OF_samples/mpu/locales.adl if test 18212 -ne `wc -c <samples/mpu/locales.adl`; then echo shar: \"samples/mpu/locales.adl\" unpacked with wrong size! fi # end of overwriting check fi echo shar: End of archive 3 \(of 11\). cp /dev/null ark3isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 11 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 11 archives. rm -f ark[1-9]isdone ark[1-9][0-9]isdone echo Making adl.doc (cd man; cat doc.aa doc.ab doc.ac >adl.doc; rm doc.a[a-c]) else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0