BSD 4_3 release
[unix-history] / usr / src / games / ddl / doc / tiny.ddl
CommitLineData
49f13b5d
C
1NOUN startrm;
2NOUN brightroom;
3
4NOUN .ME(startrm);
5
6VAR Obj; { A global }
7SEEN = 1; { A property (bit) number }
8
9Looker =
10 ($num @Verb)
11 (($ldesc ($loc .ME)) ) { CALL Ldesc of room }
12 ($setg Obj ($cont ($loc .ME))) { start with first obj in room }
13 (WHILE @Obj :
14 (($ldesc @Obj) : { If it has a description, }
15 (($ldesc @Obj)) { then say it. }
16 )
17 ($setg Obj ($link @Obj)) { Continue with sibling }
18 )
19 ;
20
21
22Slook = (($sdesc ($loc .ME))) { CALL Ldesc of room }
23 ($setg Obj ($cont ($loc .ME))) { start with first obj in room }
24 (WHILE @Obj :
25 (($ldesc @Obj) : { If it has a description, }
26 (($ldesc @Obj)) { then say it. }
27 )
28 ($setg Obj ($link @Obj)) { Continue with sibling }
29 )
30 ;
31
32Rdesc = { Room description }
33 ($say "\n")
34 (($prop ($loc .ME) SEEN) : { Have I been here? }
35 (Slook) { Yes, be brief. }
36 :{else} (Looker) { Otherwise, do the spiel, }
37 ($setp ($loc .ME) SEEN 1) { but only once. }
38 )
39 ($say "\n> ") { Prompt player }
40 ;
41
42VERB look;
43look(ACTION) = Looker;
44
45VERB inventory;
46inven = inventory;
47
48inven(ACTION) = (($not ($cont .ME)): { Null "contents" field }
49 ($say "You are empty-handed.\n")
50 :{else}
51 ($say "You are carrying:\n")
52 ($setg Obj ($cont .ME))
53 (WHILE @Obj :
54 (($sdesc @Obj))
55 ($say "\n")
56 ($setg Obj ($link @Obj))
57 )
58 )
59 ;
60
61VERB take;
62VERB drop;
63get=take;
64
65take(PREACT) = (($ne ($loc .ME) ($loc ($dobj))): { Dobj in same room? }
66 ($say "I don't see ") { No, report the fact }
67 (($sdesc ($dobj)))
68 ($say " here.\n")
69 ($exit 1)); { and end the turn. }
70
71drop(PREACT) = (($ne ($loc ($dobj)) .ME) : { Must be carrying the dobj }
72 ($say "You aren't carrying it!\n")
73 ($exit 1));
74
75take (ACTION) = ($move ($dobj) .ME)
76 ($say "Taken.\n")
77 ;
78
79drop(ACTION) = ($move ($dobj) ($loc .ME))
80 ($say "Dropped.\n")
81 ;
82
83DWIMD = (($and ($eq ($verb) take)
84 ($ne ($loc ($dobj)) ($loc .ME))):
85 ($rtrn 0))
86 (($and ($eq ($verb) drop)
87 ($ne ($loc ($dobj)) .ME)):
88 ($rtrn 0))
89 ($rtrn 1);
90
91startrm (LDESC) =
92 ($say
93"You are in a small but comfortable room. You hardly want
94to leave, but there is a door leading east, if you insist.\n")
95 ;
96startrm (SDESC) =
97 ($say "Comfortable room.\n");
98
99
100brightroom(LDESC) =
101 ($say
102"You are in a brightly lit room. The walls sparkle with
103scintillating lights. There is a darker room to the west.\n");
104
105brightroom(SDESC) = ($say "Bright room.\n");
106
107
108ADJECTIVE red, blue;
109NOUN red pillow(startrm);
110NOUN blue pillow(startrm);
111red pillow(LDESC) = ($say "There is a red pillow here.\n");
112red pillow(SDESC) = ($say "A red pillow");
113blue pillow(LDESC) = ($say "There is a blue pillow here.\n");
114blue pillow(SDESC) = ($say "A blue pillow");
115
116
117NOUN platinum(brightroom); bar=platinum;
118platinum(LDESC) = ($say "There is a bar of platinum here!\n");
119platinum(SDESC) = ($say "Platinum bar");
120platinum(ACTION) =
121 (($eq ($verb) drop) :
122 (($eq ($loc .ME) ($loc [red pillow])):
123 ($say
124"The bar falls onto the red pillow, breaking it! The symbolism
125impresses itself upon you, and you go back to work instead of
126playing these silly games!\n")
127 ($spec 3 0 0 0 0)
128 )
129 );
130
131VERB north, south, east, west;
132n=north; s=south; e=east; w=west;
133
134cg = ($say "You can't go that way.\n");
135n(ACTION) = cg;
136s(ACTION) = cg;
137e(ACTION) = cg;
138w(ACTION) = cg;
139
140startrm(ACTION) = (($eq ($verb) east) :
141 ($move .ME brightroom)
142 ($exit 1) { bypass default }
143 );
144brightroom(ACTION) = (($eq ($verb) west) : ($move .ME startrm)($exit 1));
145
146START = ($sdem Rdesc);
147