Contents | Index | < Browse | Browse >
Appendix 1 - A Tiny Dungeon
The following dungeon is a tiny but complete scenario.
It demonstrates the use of $hit and $miss, as well as the
use of some of the features of standard.adl.
INCLUDE "standard.adl";
NOUN startrm, brightroom; { Locations in the dungeon }
startrm(LIGHT) = TRUE; brightroom(LIGHT) = TRUE;
cg = ($say "You can't go that way.n");
startrm(LDESC) =
($say "You are in a small but comfortable room. You hardly "
"want to leave, but there is a door leading east, if "
"you insist.n")
;
startrm (SDESC) = ($say "Comfortable room.n");
startrm(ACTION) =
($miss cg cg 0 cg 0 0 0 0 0 0)
($hit .ME 0 0 brightroom 0 0 0 0 0 0 0)
;
brightroom(LDESC) =
($say "You are in a brightly lit room. The walls sparkle "
"with scintillating lights. There is a darker room "
"to the west.n")
;
brightroom(SDESC) = ($say "Bright room.n");
brightroom(ACTION) =
($miss cg cg cg 0 0 0 0 0 0 0)
($hit .ME 0 0 0 startrm 0 0 0 0 0 0)
;
ADJEC red, blue;
NOUN red pillow(startrm), blue pillow(startrm);
red pillow(LDESC) = ($say "There is a red pillow here.n");
red pillow(SDESC) = ($say "A red pillow");
blue pillow(LDESC) = ($say "There is a blue pillow here.n");
blue pillow(SDESC) = ($say "A blue pillow");
NOUN platinum(brightroom); bar = platinum;
platinum(LDESC) = ($say "There is a bar of platinum here!n");
platinum(SDESC) = ($say "A platinum bar");
platinum(ACTION) =
(IF ($and ($eq ($verb) drop)
($eq ($loc .ME) ($loc [red pillow])))
THEN
($say "The bar falls onto the red pillow, breaking it! "
"The symbolism impresses itself upon you, and "
"you go back to work instead of playing these "
"silly games!n")
($spec 3)
)
;
NOUN SELF(startrm); SELF(NOTAKE) = TRUE;
START = ($prompt Prompter)
($sdem Looker)
($actor SELF 0 1 0)
($setv n s e w 0 0 0 0 0 0)
;
DWIMD = ($return (DWIM %1));
DWIMI = (DWIM %1); { This result will be returned by default }