-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtestgame.alan
418 lines (280 loc) · 7.22 KB
/
testgame.alan
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
-- TESTGAME
IMPORT 'library.i'.
THE my_game ISA DEFINITION_BLOCK
VERB attack
DOES ONLY "No."
END VERB.
END THE.
THE sunny_room ISA ROOM -- all ROOMS automatically have a floor, walls and a ceiling
NAME sunny 'room'
DESCRIPTION "You are in a spacious room filled with bright sunlight entering through
the window and through an open doorway to the west leading to a small balcony.
A white door leads north. There is a staircase to the south."
EXIT north TO closet
CHECK door1_s IS open
ELSE "You can't, since the door is closed."
END EXIT.
EXIT west TO balcony.
EXIT south TO nowhere
CHECK "The staircase just leads out of here. Stay here to keep experimenting,
otherwise type QUIT to quit."
END EXIT.
END THE.
THE sunny_room_object ISA OBJECT AT sunny_room
-- We cannot examine locations, only objects and actors.
-- That's why, if the player types 'x room', we account for that situation
-- by making a sunny_room object that can be examined.
NAME sunny 'room'
DESCRIPTION ""
VERB examine
DOES ONLY LOOK.
END VERB.
END THE.
THE table ISA SUPPORTER -- you can place things on a supporter
AT sunny_room
IS NOT takeable.
HAS components {drawer1, drawer2}.
VERB examine
DOES AFTER
FOR EACH c IN components OF THIS
DO
"The table has" SAY AN c. "."
IF c IS open
THEN LIST c.
ELSE SAY THE c. "is closed."
END IF.
END FOR.
END VERB.
END THE.
THE drawer1 ISA LISTED_CONTAINER
AT sunny_room
OPAQUE CONTAINER
NAME top drawer
IS closeable. IS closed.
DESCRIPTION ""
END THE.
THE drawer2 ISA LISTED_CONTAINER
AT sunny_room
OPAQUE CONTAINER
NAME bottom drawer
IS closeable. IS closed.
DESCRIPTION ""
END THE.
THE pearls ISA OBJECT
In table.
IS plural.
PRONOUN 'them'
VERB examine
DOES BEFORE
"This is an object with a plural name. Experiment with different commands to see
the responses and how they differ as compared with objects with a singular name.$p"
END VERB.
END THE.
THE box ISA LISTED_CONTAINER
AT sunny_room
IS NOT takeable.
VERB examine
DOES BEFORE "This is a listed container defined in the library. The contents should be
listed after both 'examine', 'look in' and 'look'."
END VERB.
END THE.
THE door1_s ISA DOOR
AT sunny_room
NAME white 'door'
HAS otherside door1_n.
IS lockable. IS locked.
HAS matching_key silver_key.
DESCRIPTION ""
END THE.
THE silver_key ISA OBJECT IN table
NAME silver key
END THE.
THE window1 ISA WINDOW
AT sunny_room
NAME 'window'
DESCRIPTION ""
END THE.
THE flower ISA OBJECT
IS scenery.
IN table -- Note the 'in' here; however, the flower will be described
-- to be *on* the table.
END THE.
THE note ISA OBJECT
IN table
IS writeable.
IS readable.
VERB examine
DOES ONLY "You can try writing something on the note."
END VERB.
VERB write
WHEN obj
DOES ONLY
IF pen NOT IN hero
THEN "(taking the pen first)$n"
LOCATE pen IN hero.
END IF.
IF text OF obj = ""
THEN SET text OF obj TO txt.
ELSE SET text OF obj TO text OF obj + " " + txt.
END IF.
"You write ""$$" SAY txt. "$$"" on" SAY THE obj. "."
MAKE obj readable.
END VERB.
VERB burn
CHECK match IS lit
ELSE "How?"
DOES ONLY "You burn the note to ashes."
LOCATE note AT nowhere.
END VERB.
VERB burn_with
WHEN obj
CHECK instr = match
ELSE "That's not possible."
DOES ONLY "You burn the note to ashes."
LOCATE note AT nowhere.
END VERB.
END THE.
THE pen ISA OBJECT
IN table
END THE.
THE bottle ISA LISTED_CONTAINER
IN box
VERB examine
DOES ONLY LIST THIS.
END VERB.
END THE.
THE juice ISA LIQUID
IN bottle
IS drinkable.
ARTICLE "some"
END THE.
THE match ISA LIGHTSOURCE
IN box
IS natural.
END THE.
THE flashlight ISA LIGHTSOURCE
IN box
IS NOT natural.
END THE.
THE waterpistol ISA WEAPON
IN box
IS fireable.
END THE.
THE blue_ball ISA OBJECT
IN box
NAME blue ball NAME blue
VERB take
DOES SCORE 1.
END VERB.
END THE.
THE red_ball ISA OBJECT
AT sunny_room
NAME red ball NAME red
VERB take
DOES SCORE 1.
END VERB.
END THE.
THE yellow_ball ISA OBJECT
AT sunny_room
NAME yellow ball NAME yellow
VERB take
DOES SCORE 1.
END VERB.
END THE.
THE felix ISA PERSON
AT sunny_room
NAME felix NAME himself NAME butler
IS named.
IS wearing {tuxedo}.
MENTIONED "Felix"
PRONOUN 'him'
DESCRIPTION "$pFelix, your grumpy butler, is standing off to one side."
VERB examine
DOES ONLY "Felix is your grumpy butler. You could try talking to him, or asking him
for various things." LIST felix.
END VERB.
END THE.
THE tuxedo ISA CLOTHING
IS NOT takeable.
END THE.
THE dog ISA ACTOR
AT sunny_room
DESCRIPTION "$pA dog is here, looking at you with faithful eyes."
VERB examine
DOES ONLY "Give the blue ball to the dog and he will follow you." LIST dog.
END VERB.
END THE.
THE balcony ISA LOCATION
DESCRIPTION "You're standing on a small balcony overlooking a garden. The sky is clear.
In the distance you see a mountain.
The room is back to the east."
IF visited OF balcony = 1
THEN "$pHaving never been on this balcony before, you pause to take in the magnificent view."
ELSE "$pEven if you've been here before, the magnificent view never ceases to amaze you."
END IF.
EXIT east TO sunny_room.
END THE.
-- The balcony is neither a pure indoor or outdoor room, we need the floor but also the sky:
THE balcony_object ISA OBJECT AT balcony
NAME balcony
IS NOT takeable.
IS NOT movable.
DESCRIPTION ""
END THE.
-- we cannot declare the balcony either as a room or as a site, because we need here both the floor
-- and the sky, but rooms don't have skies and sites don't have floors. That's why the balcony is defined
-- as a normal location above, and here we add to it its own floor and sky objects:
THE balcony_floor ISA OBJECT AT balcony
NAME floor
IS NOT takeable.
IS NOT movable.
DESCRIPTION ""
END THE.
THE balcony_sky ISA OBJECT AT balcony
NAME sky
IS distant.
DESCRIPTION ""
END THE.
THE mountain ISA OBJECT
AT balcony
IS distant.
DESCRIPTION ""
VERB examine
DOES ONLY "Majestic."
END VERB.
END THE.
THE garden ISA OBJECT
AT balcony
IS distant.
NAME garden NAME flowers
DESCRIPTION "The garden is green and full of blossoming flowers."
END THE.
THE closet ISA LOCATION
DESCRIPTION "This is a closet."
EXIT south TO sunny_room
CHECK door1_n IS open
ELSE "You can't, since the door is closed."
END EXIT.
END THE.
THE door1_n ISA DOOR AT closet
NAME white 'door'
END THE.
THE shirt ISA CLOTHING
AT closet
IS topcover 8.
END THE.
THE jacket ISA CLOTHING
AT closet
IS topcover 32.
END THE.
THE wallet ISA LISTED_CONTAINER
IS openable. IS NOT open.
IN jacket
END THE.
WHEN blue_ball IN dog AND dog IS NOT following
=> MAKE dog following.
START AT sunny_room.
DESCRIBE banner.
"$pThis is a" STYLE alert. "testgame" STYLE normal. "for the new ALAN library. Experiment with
manipulating various objects and moving around.
Taking any ball will increase your score."