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