~ubuntu-branches/ubuntu/vivid/inform/vivid

« back to all changes in this revision

Viewing changes to inform-6.31.1/demos/museum.inf

  • Committer: Bazaar Package Importer
  • Author(s): Jan Christoph Nordholz
  • Date: 2008-05-26 22:09:44 UTC
  • mfrom: (2.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080526220944-ba7phz0d1k4vo7wx
Tags: 6.31.1+dfsg-1
* Remove a considerable number of files from the package
  due to unacceptable licensing terms.
* Repair library symlinks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
! ----------------------------------------------------------------------------
 
2
!   Museum 961111                   One of the standard Inform 6 example games
 
3
!
 
4
!                                                            created: 20.12.95
 
5
!                                             translated to Inform 6: 11.11.96
 
6
!
 
7
!   This "game" is a compendium of solved exercises from the Designer's
 
8
!   Manual.  Room numbers are section numbers within the Third Edition.
 
9
!   Many of these exercises are difficult, and so is some of the code below.
 
10
! ----------------------------------------------------------------------------
 
11
 
 
12
Constant Story "MUSEUM OF INFORM";
 
13
Constant Headline
 
14
    "^An Interactive Companion to the Designer's Manual (Third Edition)^";
 
15
 
 
16
!   The game is meant to be experimented with, so we always define:
 
17
Constant DEBUG;
 
18
 
 
19
Release 2;
 
20
Serial "961111";
 
21
 
 
22
Replace DrawStatusLine;
 
23
Include "Parser";
 
24
 
 
25
! --------------------------------------------------------------------------
 
26
 
 
27
Object samples_bag "samples bag"
 
28
  with description "A capacious SACK_OBJECT (see section 20).",
 
29
       name "samples" "bag", article "your",
 
30
       when_closed "Your samples bag lies on the floor.",
 
31
       when_open "Your samples bag lies open on the floor.",
 
32
  has  container open openable;
 
33
 
 
34
Constant SACK_OBJECT = samples_bag;
 
35
 
 
36
Include "VerbLib";
 
37
 
 
38
! --------------------------------------------------------------------------
 
39
 
 
40
Attribute crewmember;
 
41
 
 
42
Property weight 10;
 
43
 
 
44
Class Key with name "key";
 
45
 
 
46
! --------------------------------------------------------------------------
 
47
 
 
48
Object  Foyer "Foyer"
 
49
 has    light
 
50
 with   description
 
51
           "The foyer of the magnificent Museum of Inform. A flight of 
 
52
            stairs sweeps upward to Chapters V and VI, and corridors 
 
53
            fan out on this level into Chapter IV. These run:^
 
54
            ^  north into Room 10 (the Halls of Sense and Direction),
 
55
            ^  south along Corridor 12 (doors) to Room 13 (switches),
 
56
            ^  @00 to Room 11 (the Wonderful World of Containers)
 
57
            ^  and @01 to Room 14 (which houses larger exhibits).^^
 
58
            (And a plain ladder descends into the basement; you can also 
 
59
             step out onto a balcony.)",
 
60
        e_to Room11, u_to Second_Floor, n_to Room10,
 
61
        s_to Corridor12, w_to Room14,
 
62
        d_to basement, out_to balcony;
 
63
 
 
64
Object -> "map"
 
65
  with name "map" "ground" "floor",
 
66
       initial "A map of the ground floor is embossed in one wall.",
 
67
       description
 
68
       [;  font off;
 
69
           print
 
70
          "^+------------------------------------------+
 
71
           ^|                              (mirror)    |
 
72
           ^|   Weights      Room 10  ---  Room 10a    |
 
73
           ^|    Room         senses      directions   |
 
74
           ^|      |            |                      |
 
75
           ^|   Room 14 ---   Foyer   ---   Room 11    |
 
76
           ^|  (changing  (you are here)   containers  |
 
77
           ^|  character)       |                      |
 
78
           ^|                   |                      |
 
79
           ^|   Room 15 --- Corridor 12                |
 
80
           ^|  (MS room)  (door, curator)              |
 
81
           ^|   (Bible)         |                      |
 
82
           ^|             Switches Hall 13             |
 
83
           ^|                (chasm)                   |
 
84
           ^|                   |                      |
 
85
           ^|           Far Side of Room 13            |
 
86
           ^+------------------------------------------+^";
 
87
           font on;
 
88
       ],
 
89
  has  static;
 
90
 
 
91
! --------------------------------------------------------------------------
 
92
 
 
93
Object basement "Museum Basement"
 
94
  with u_to Foyer,
 
95
       description
 
96
          "Once Room 17, this space has been abandoned by the curators,
 
97
           who have simply sprayed its walls with moth-repellent and
 
98
           abandoned it.",
 
99
       before
 
100
       [;  Smell: "Napthalene.";
 
101
       ];
 
102
 
 
103
! --------------------------------------------------------------------------
 
104
 
 
105
Object Room10 "Hall of Senses"
 
106
  with description
 
107
          "This is Room 10, north of the foyer. If you try going further 
 
108
           north, a string will be printed instead. The exit to the @00 
 
109
           has a routine attached, and randomly leads either to the 
 
110
           Directions Room or back to the foyer.",
 
111
       s_to Foyer,
 
112
       n_to "This string is the ~n_to~ value for this room.",
 
113
       e_to
 
114
       [;  if (random(2)==1) return Foyer; return Room10a; ],
 
115
  has  light;
 
116
 
 
117
Object -> "TRAP lever"
 
118
  with name "trap" "lever",
 
119
       before
 
120
       [;  Pull, Push:
 
121
               if (self has on) <<SwitchOff self>>;
 
122
               <<SwitchOn self>>;
 
123
       ],
 
124
       after
 
125
       [;  SwitchOn: move orange_cloud to location;
 
126
              "Clunk! An orange cloud suddenly descends upon you.";
 
127
           SwitchOff: remove orange_cloud;
 
128
              "Click! The orange cloud vanishes.";
 
129
       ],
 
130
  has  switchable static;
 
131
 
 
132
Object -> "gold watch"
 
133
  with name "gold" "watch",
 
134
       description "The watch has no hands, oddly.",
 
135
       react_before
 
136
       [;  Listen: if (noun==0 or self) "The watch ticks loudly."; ];
 
137
 
 
138
Object -> "sprig of lavender"
 
139
  with name "sprig" "of" "lavender",
 
140
       react_before
 
141
       [;  Smell: if (noun==0 or self) "Lavender-perfume. Ahh!"; ];
 
142
 
 
143
Object orange_cloud "orange cloud"
 
144
  with name "orange" "cloud",
 
145
       react_before
 
146
       [;  Look: "You can't see for the orange cloud surrounding you.";
 
147
           Go, Exit: "You wander round in circles, choking.";
 
148
           Smell: if (noun==0 or self) "Cinnamon? No, nutmeg.";
 
149
       ],
 
150
  has  scenery;
 
151
 
 
152
! --------------------------------------------------------------------------
 
153
!   For east-west reflection
 
154
! --------------------------------------------------------------------------
 
155
 
 
156
Lowstring east_str "east"; Lowstring west_str "west";
 
157
[ NormalWorld; string 0 east_str; string 1 west_str;
 
158
  e_obj.door_dir = e_to; w_obj.door_dir = w_to;
 
159
];
 
160
[ ReversedWorld; string 0 west_str; string 1 east_str;
 
161
  w_obj.door_dir = e_to; e_obj.door_dir = w_to;
 
162
];
 
163
 
 
164
Object Room10a "Hall of Directions"
 
165
  with name "mirror",
 
166
       description
 
167
          "An annexe to Room 10: the main exit is back @01, and there's a 
 
168
           curiously misty mirror on the north wall. Also, there's an exit 
 
169
           in the fourth, ~hyper~ dimension (which is only visible in the 
 
170
           weird geometry of this room).",
 
171
       initial
 
172
       [;  move hyper to compass; StartDaemon(hyper);
 
173
       ],
 
174
       w_to Room10,
 
175
       n_to
 
176
       [;  print "Walking through the mirror is confusing...^";
 
177
           if (self has general) NormalWorld(); else ReversedWorld();
 
178
           if (self has general) give self ~general; else give self general;
 
179
           <<Look>>;
 
180
       ],
 
181
       in_to [; print "Amazing! Your body corkscrews as you pass.^";
 
182
                return Room11; ],
 
183
  has  light;
 
184
 
 
185
Object hyper "hyper-dimensional direction"
 
186
  with name "hyper" "fourth" "dimension", article "the", door_dir in_to,
 
187
       daemon
 
188
       [;  if (location ~= Room10a) { remove self; StopDaemon(self); }
 
189
       ],
 
190
  has  scenery;
 
191
 
 
192
! --------------------------------------------------------------------------
 
193
 
 
194
Object Room11 "Wonderful World of Containers"
 
195
  with description
 
196
          "This is Room 11, @00 of the foyer. You notice a typical piece 
 
197
           of scenery which turns out to be a supporter: a mantelpiece.",
 
198
       w_to Foyer,
 
199
  has  light;
 
200
 
 
201
Object -> "bearded psychiatrist"
 
202
  with name "bearded" "doctor" "psychiatrist" "psychologist" "shrink",
 
203
       initial "A bearded psychiatrist has you under observation.",
 
204
       life
 
205
       [;  "He is fascinated by your behaviour, but makes no attempt to 
 
206
            interfere with it.";
 
207
       ],
 
208
       react_after
 
209
       [;  Insert: print "~Subject puts ", (a) noun, " in ", (the) second,
 
210
                      ". Interesting.~^";
 
211
           PutOn:  print "~Subject puts ", (a) noun, " in ", (the) second,
 
212
                      ". Interesting.~^";
 
213
       ],
 
214
       react_before
 
215
       [;  Take, Remove: print "~Subject feels lack of ", (the) noun,
 
216
               ". Suppressed Oedipal complex? Mmm.~^";
 
217
       ],
 
218
  has  animate;
 
219
 
 
220
Object -> "mantelpiece"
 
221
  with name "mantel" "mantle" "piece" "mantelpiece"
 
222
  has  scenery supporter;
 
223
 
 
224
Object -> "green ball" with name "green" "ball";
 
225
Object -> "red cone" with name "red" "cone";
 
226
Object -> "blue pyramid" with name "blue" "pyramid";
 
227
 
 
228
Object -> "plain shopping bag (which can only hold 2 things)"
 
229
  with name "plain" "shopping" "bag", capacity 2,
 
230
  has  container open;
 
231
 
 
232
Object -> "glass box with a lid" with name "glass" "box" "with" "lid"
 
233
  has  container transparent openable open;
 
234
Object -> "steel box with a lid" with name "steel" "box" "with" "lid"
 
235
  has  container openable open;
 
236
 
 
237
Key -> bolted_key "bolted key" with name "bolted";
 
238
 
 
239
Object -> "toothed bag"
 
240
  with name "toothed" "bag",
 
241
       description "A capacious bag with a toothed mouth.",
 
242
       before
 
243
       [; LetGo: "The bag defiantly bites itself 
 
244
                  shut on your hand until you desist.";
 
245
          Close: "The bag resists all attempts to close it.";
 
246
       ],
 
247
       after
 
248
       [; Receive:
 
249
                 "The bag wriggles hideously as it swallows ",
 
250
                 (the) noun, ".";
 
251
       ],
 
252
  has  container open;
 
253
 
 
254
Object -> "bolted cupboard"
 
255
  with name "bolted" "cupboard",
 
256
       describe
 
257
       [; if (self hasnt open)
 
258
              "^A pretty typical shut cupboard is bolted to one wall.";
 
259
          "^Bolted up on one wall is an open cupboard.";
 
260
       ],
 
261
       with_key bolted_key
 
262
  has  locked container openable lockable static;
 
263
 
 
264
Object -> "portable television set"
 
265
  with name "tv" "television" "set" "portable",
 
266
       initial "A portable television set has two sub-objects attached: 
 
267
                a power button and a screen.",
 
268
       before
 
269
       [;  SwitchOn: <<SwitchOn power_button>>;
 
270
           SwitchOff: <<SwitchOff power_button>>;
 
271
           Examine: <<Examine screen>>;
 
272
       ],
 
273
  has  transparent;
 
274
Object -> -> power_button "power button"
 
275
  with name "power" "button" "switch",
 
276
       after
 
277
       [;  SwitchOn, SwitchOff: <<Examine screen>>;
 
278
       ],
 
279
  has  switchable;
 
280
Object -> -> screen "television screen"
 
281
  with name "screen",
 
282
       before
 
283
       [;  Examine: if (power_button hasnt on) "The screen is black.";
 
284
               "The screen writhes with a strange Japanese cartoon.";
 
285
       ];
 
286
 
 
287
Object -> "macrame bag"
 
288
  with name "macrame" "bag" "string" "net" "sack",
 
289
       react_before
 
290
       [;  Examine, Search, Listen, Smell: ;
 
291
           default:
 
292
               if (inp1>1 && inp1 in self)
 
293
                   print_ret (The) inp1, " is tucked away in the bag.";
 
294
               if (inp2>1 && inp2 in self)
 
295
                   print_ret (The) inp2, " is tucked away in the bag.";
 
296
       ],
 
297
       describe
 
298
       [;  print "^A macrame bag hangs from the ceiling, shut tight";
 
299
           if (child(self)==0) ".";
 
300
           print ". Inside you can make out ";
 
301
           WriteListFrom(child(self), ENGLISH_BIT); ".";
 
302
       ],
 
303
  has  container transparent static;
 
304
Object -> -> "music box"
 
305
  with name "music" "box" "musical",
 
306
       description "Attractively lacquered.",
 
307
       react_before
 
308
       [;  Listen: if (noun==0 or self)
 
309
              "The musical box chimes some Tchaikovsky."; ];
 
310
 
 
311
! --------------------------------------------------------------------------
 
312
 
 
313
Object Corridor12 "Corridor 12"
 
314
  with description
 
315
          "Runs south of the foyer. A side exit leads @01 to Room 15, 
 
316
           the manuscripts room.",
 
317
       n_to Foyer, s_to Oak_Door, w_to Room15,
 
318
  has  light;
 
319
 
 
320
Object -> "sinister curator"
 
321
  with name "sinister" "curator",
 
322
       initial
 
323
       [;  if (self hasnt general)
 
324
              "A sinister curator leans against the wall, asleep.";
 
325
          "The curator is here, casting menacing looks.";
 
326
       ],
 
327
       daemon
 
328
       [ i p j n k;
 
329
           if (random(3)~=1 || self hasnt general) rfalse;
 
330
           p=parent(self);
 
331
           objectloop (i in compass)
 
332
           {   j=p.(i.door_dir);
 
333
               if (ZRegion(j)==1 && j hasnt door) n++;
 
334
           }
 
335
           if (n==0) rfalse;
 
336
           k=random(n); n=0;
 
337
           objectloop (i in compass)
 
338
           {   j=p.(i.door_dir);
 
339
               if (ZRegion(j)==1 && j hasnt door) n++;
 
340
               if (n==k)
 
341
               {   move self to j;
 
342
                   if (p==location) "^The curator stalks away.";
 
343
                   if (j==location) "^The curator stalks in.";
 
344
                   rfalse;
 
345
               }
 
346
           }
 
347
       ],
 
348
       orders
 
349
       [;  if (self hasnt general) "The curator only snores.";
 
350
          "He raises a skeletal finger to his lips. ~Shh!~";
 
351
       ],
 
352
       life
 
353
       [;  WakeOther:
 
354
               if (self hasnt general)
 
355
               {   give self general; move self to Foyer;
 
356
                  "He wakes and rouses to his feet, pushes past you 
 
357
                   and stalks away.";
 
358
               }
 
359
           default: "He rears back with disdain.";
 
360
       ],
 
361
  has  animate;
 
362
 
 
363
Object Oak_Door "oaken door"
 
364
  with name "oak" "door" "oaken",
 
365
       description "Despite appearances, there is no key to this door.",
 
366
       door_dir
 
367
       [; if (location==Corridor12) return s_to; return n_to; ],
 
368
       door_to
 
369
       [; if (location==Corridor12) return Room13; return Corridor12; ],
 
370
       describe
 
371
       [; if (self has open) "^The oaken door stands open.";
 
372
          if (self hasnt locked) "^The corridor ends in an oaken door.";
 
373
       ],
 
374
       found_in  Corridor12  Room13
 
375
  has  static door openable lockable;
 
376
 
 
377
! --------------------------------------------------------------------------
 
378
 
 
379
Object Room15 "Manuscripts Room"
 
380
  with description
 
381
          "This is Room 15, adjoining a corridor to the @00.",
 
382
       e_to Corridor12,
 
383
  has  light;
 
384
 
 
385
Object -> "black Tyndale Bible"
 
386
  with name "bible" "black" "book",
 
387
       initial "A black Bible rests on a spread-eagle lectern.",
 
388
       description "A splendid foot-high Bible, which must have survived 
 
389
           the burnings of 1520.",
 
390
       before
 
391
       [ w x; Consult:
 
392
               wn = consult_from; w = NextWord();
 
393
               switch(w)
 
394
               {   'matthew': x="Gospel of St Matthew";
 
395
                   'mark': x="Gospel of St Mark";
 
396
                   'luke': x="Gospel of St Luke";
 
397
                   'john': x="Gospel of St John";
 
398
                   default: "There are only the four Gospels.";
 
399
               }
 
400
               if (consult_words==1)
 
401
                   "You read the ", (string) x, " right through.";
 
402
               w = TryNumber(wn);
 
403
               if (w==-1000)
 
404
                   "I was expecting a chapter number in the ",
 
405
                             (string) x, ".";
 
406
               "Chapter ", (number) w, " of the ", (string) x,
 
407
                     " is too sacred for you to understand now.";
 
408
       ];
 
409
 
 
410
! --------------------------------------------------------------------------
 
411
 
 
412
Object Room13 "Switches Hall"
 
413
  with description
 
414
          "This is Room 13, at the south end of a long corridor leading 
 
415
           north. Progress further south is blocked by a chasm.",
 
416
       n_to Oak_Door, s_to PlankBridge,
 
417
  has  light;
 
418
 
 
419
Object -> "Gotham City searchlight"
 
420
  with name "gotham" "city" "search" "light" "template" "searchlight",
 
421
       article "the",
 
422
       description "It has some kind of template on it.",
 
423
       when_on "The old city searchlight shines out a bat against 
 
424
                the alabaster ceiling of the Museum.",
 
425
       when_off "The old Gotham city searchlight has been lovingly 
 
426
                restored and housed here."
 
427
  has  switchable static;
 
428
 
 
429
Object -> "basement light switch"
 
430
  with name "basement" "light" "switch",
 
431
       after
 
432
       [;  SwitchOn: give basement light; "Click!";
 
433
           SwitchOff: give basement ~light; "Click!";
 
434
       ],
 
435
  has  switchable static;
 
436
 
 
437
Object -> PlankBridge "plank bridge"
 
438
  with description "Extremely fragile and precarious.",
 
439
       name "precarious" "fragile" "wooden" "plank" "bridge",
 
440
       when_open
 
441
           "A precarious plank bridge spans the chasm.",
 
442
       door_to
 
443
       [;  if (children(player)~=0)
 
444
            {   deadflag=1;
 
445
               "You step gingerly across the plank, which bows under 
 
446
                your weight. But your meagre possessions are the straw 
 
447
                which breaks the camel's back! There is a horrid crack...";
 
448
            }
 
449
            print "You step gingerly across the plank, grateful that 
 
450
                   you're not burdened.^";
 
451
           if (location==Room13) return FarSide; return Room13;
 
452
       ],
 
453
       door_dir
 
454
       [;  if (location==Room13) return s_to; return n_to;
 
455
       ],
 
456
       found_in Room13 FarSide,
 
457
  has  static door open;
 
458
 
 
459
Object FarSide "Far Side of Chasm in Room 13"
 
460
  with description
 
461
          "This side of the chasm is dull and dusty after all.",
 
462
       n_to PlankBridge,
 
463
  has  light;
 
464
 
 
465
! --------------------------------------------------------------------------
 
466
 
 
467
Object Room14 "Large Exhibits Room"
 
468
  with description
 
469
          "This is Room 14, @01 of the foyer, which gives onto the Weights 
 
470
           Room to the north.",
 
471
       e_to Foyer, n_to Weights_Room,
 
472
  has  light;
 
473
 
 
474
Object -> "hypnotic portrait"
 
475
  with name "hypnotic" "portrait" "warthog" "picture" "of" "hog",
 
476
       initial "A somewhat hypnotic full-length portrait of a warthog hangs 
 
477
           on the wall.",
 
478
       before
 
479
       [;  Examine: <Examine hog>; print "^...and somehow, so do you...^";
 
480
               ChangePlayer(hog); <<Look>>;
 
481
       ],
 
482
  has  static;
 
483
 
 
484
Object -> "Louis XV chair"
 
485
  with name "louis" "xv" "quinze" "chair",
 
486
       initial "A valuable Louis XV chair takes pride of place.",
 
487
  has  enterable supporter;
 
488
 
 
489
Object -> car "little red car"
 
490
  with name "little" "red" "car" "kar1",
 
491
       description "Large enough to sit inside. Among the controls is a 
 
492
                 prominent on/off switch. The numberplate is KAR 1.",
 
493
       when_on  "The red car sits here, its engine still running.",
 
494
       when_off "A little red car is parked here.",
 
495
       before
 
496
       [; PushDir: AllowPushDir(); rtrue;
 
497
          Go: if (car has on) { Achieved(1); "Brmm! Brmm!"; }
 
498
              print "(The ignition is off at the moment.)^";
 
499
       ],
 
500
       after
 
501
       [; PushDir: "The car rolls very slowly as you push it.";
 
502
       ],
 
503
  has  switchable enterable static container open;
 
504
 
 
505
Object -> -> "small note"
 
506
  with name "small" "note",
 
507
       description
 
508
           "  !!!! FROBOZZ MAGIC CAR COMPANY !!!!^
 
509
           ^Hello, Driver!^
 
510
           ^Instructions for use:^
 
511
           ^Switch on the ignition and off you go!^
 
512
           ^Warranty:^
 
513
           ^This car is guaranteed against all defects for a period of 
 
514
            76 milliseconds from date of purchase or until used, 
 
515
            whichever comes first.^
 
516
           ^Good Luck!";
 
517
 
 
518
Object -> "Giant"
 
519
  with name "giant",
 
520
       initial "A Giant is here. (And you know the old legend... push a 
 
521
           Giant, become a Giant!)",
 
522
       before
 
523
       [;  Push: ChangePlayer(self); <<Look>>;
 
524
           Take: rtrue;
 
525
       ],
 
526
       number 0,
 
527
       orders
 
528
       [;  if (player==self)
 
529
           {   if (actor~=self)
 
530
                  "You only become tongue-tied and gabble.";
 
531
               if (action==##Push && noun==selfobj)
 
532
               {   ChangePlayer(selfobj); <<Look>>; }
 
533
               rfalse;
 
534
           }
 
535
           Attack: "The Giant looks at you with doleful eyes. 
 
536
                    ~Me not be so bad!~";
 
537
           default: "The Giant is unable to comprehend your instructions.";
 
538
       ],
 
539
  has  animate;
 
540
 
 
541
 
 
542
! --------------------------------------------------------------------------
 
543
 
 
544
Object "Caldera"
 
545
  with description
 
546
          "An old volcanic crater of mud and ash, from which there is 
 
547
           nowhere to go.",
 
548
  has  light;
 
549
 
 
550
Object -> hog "Warthog"
 
551
  with name "wart" "hog" "warthog",
 
552
       description "Muddy, sniffing and grunting.",
 
553
       number,
 
554
       orders
 
555
       [;  if (player~=self || actor~=self) rfalse;
 
556
 
 
557
           ! So now we have just the case where the player
 
558
           ! is currently the warthog, ordering himself about:
 
559
 
 
560
           Go, Look, Examine, Eat, Smell, Taste, Touch: rfalse;
 
561
           default: "Warthogs can't do anything as tricky as that!";
 
562
       ],
 
563
  has  animate proper;
 
564
 
 
565
Object -> "red berry"
 
566
  with name "red" "berry" "magic",
 
567
       initial "A magic red berry is half-uncovered in the mud.",
 
568
       before
 
569
       [;  Smell, Taste, Touch:
 
570
               print "The blood-smell of the berry brings you back, 
 
571
                    back...^";
 
572
                ChangePlayer(selfobj); <<Look>>;
 
573
       ];
 
574
 
 
575
! --------------------------------------------------------------------------
 
576
 
 
577
Constant CARRYING_STRENGTH = 500;
 
578
Constant HEAVINESS_THRESHOLD = 100;
 
579
 
 
580
Object Weights_Room "Weights Room"
 
581
  with description
 
582
          "This is an annexe, south of Room 14. In here (though nowhere 
 
583
           else) objects have given weights, and 
 
584
           you can carry only a limited total weight. (Items from elsewhere 
 
585
           in the museum all weigh 10 zobs, regardless of what they are.)
 
586
           The longer you carry heavy objects, the more tired you become,
 
587
           until you're forced to drop them; your strength recovers once
 
588
           you're carrying only a light load.",
 
589
       initial [; weight_monitor.activate(); ],
 
590
       s_to Room14,
 
591
  has  light;
 
592
 
 
593
Object -> "feather" with name "feather", weight 1;
 
594
Object -> "iron anvil" with name "iron" "anvil", article "an", weight 300;
 
595
Object -> "five-zob weight" with name "five" "zob" "weight", weight 5;
 
596
Object -> "ten-zob weight" with name "ten" "zob" "weight", weight 10;
 
597
Object -> "twenty-zob weight" with name "twenty" "zob" "weight", weight 20;
 
598
Object -> "fifty-zob weight" with name "fifty" "zob" "weight", weight 50;
 
599
Object -> "hundred-zob weight" with name "hundred" "zob" "weight", weight 100;
 
600
 
 
601
[ WeightOf obj t i;
 
602
   t = obj.weight;
 
603
   objectloop (i in obj) t = t + WeightOf(i);
 
604
   return t;
 
605
];
 
606
 
 
607
Object weight_monitor
 
608
  with
 
609
       players_strength,
 
610
       warning_level 5,
 
611
 
 
612
       activate
 
613
       [;  self.players_strength = CARRYING_STRENGTH; StartDaemon(self);
 
614
       ],
 
615
       daemon
 
616
       [ w s b bw;
 
617
            if (location ~= Weights_Room) { StopDaemon(self); return; }
 
618
 
 
619
            s = self.players_strength
 
620
                - WeightOf(player) + HEAVINESS_THRESHOLD;
 
621
            if (s<0) s=0; if (s>CARRYING_STRENGTH) s=CARRYING_STRENGTH;
 
622
            self.players_strength = s;
 
623
 
 
624
            if (s==0)
 
625
            {   bw=-1;
 
626
                objectloop(b in player)
 
627
                    if (WeightOf(b) > bw) { bw = WeightOf(b); w=b; }
 
628
                self.players_strength = self.players_strength + bw;
 
629
                print "^Exhausted with carrying so much, you decide 
 
630
                    to discard ", (the) w, ": "; <<Drop w>>;
 
631
            }
 
632
 
 
633
            w=s/100; if (w==self.warning_level) return;
 
634
 
 
635
            self.warning_level = w;
 
636
            switch(w)
 
637
            {   3: "^You are feeling a little tired.";
 
638
                2: "^You possessions are weighing you down.";
 
639
                1: "^Carrying so much weight is wearing you out.";
 
640
                0: "^You're nearly exhausted enough to drop everything
 
641
                     at an inconvenient moment.";
 
642
            }
 
643
       ];
 
644
 
 
645
! --------------------------------------------------------------------------
 
646
 
 
647
Constant SUNRISE  360;  ! i.e., 6 am
 
648
Constant SUNSET  1140;  ! i.e., 7 pm
 
649
Global day_state = 2;
 
650
 
 
651
Object balcony "Balcony"
 
652
  with description
 
653
       [;  print "An open-air balcony on the cliffside wall of the 
 
654
               cathedral-like Museum, hundreds of feet above ";
 
655
           if (day_state==1) "sunlit plains of farms and settlements.";
 
656
           "a darkling plain. Dim light from the walls above is 
 
657
            the only beacon in this vast night.";
 
658
       ],
 
659
       in_to Foyer,
 
660
       cant_go "The only way is back inside.",
 
661
       each_turn
 
662
       [ f;
 
663
           if (the_time >= SUNRISE && the_time < SUNSET) f=1;
 
664
           if (day_state == f) return;
 
665
           if (day_state==2) { day_state = f; return; }
 
666
           day_state = f;
 
667
           if (f==1) "^The sun rises, illuminating the landscape!";
 
668
         "^As the sun sets, the landscape is plunged into darkness.";
 
669
       ],
 
670
  has  light;
 
671
 
 
672
Object -> "giant clock"
 
673
  with name "giant" "clock" "face" "clockface" "clock-face",
 
674
       before
 
675
       [;  Examine: "According to the giant clockface on the wall 
 
676
               above, it is now ", the_time/60, ":", (the_time%60)/10,
 
677
               the_time%10, ".";
 
678
           default: "The giant clock-face is too high above you.";
 
679
       ],
 
680
       react_after [; Look: new_line; <Examine self>; ],
 
681
  has  static concealed;
 
682
 
 
683
Object -> moth "moth"
 
684
  with name "moth",
 
685
       initial "A catchable moth flits about.";
 
686
 
 
687
[ GoMothGo;
 
688
   if (moth in player)
 
689
   {   remove moth;
 
690
      "As your eyes try to adjust, you feel a ticklish sensation 
 
691
       and hear a tiny fluttering sound.";
 
692
   }
 
693
];
 
694
 
 
695
Object -> "Commander Data"
 
696
  with name "data" "commander",
 
697
       orders
 
698
       [; "~I regret that I am only here to make an example work elsewhere. 
 
699
            Please proceed upstairs to 10 Forward to see.~";
 
700
       ],
 
701
  has  proper animate crewmember;
 
702
 
 
703
! ==========================================================================
 
704
 
 
705
Object Second_Floor "Mezzanine"
 
706
  with description
 
707
          "Halfway up the marble staircase of the building, a second floor 
 
708
           mezzanine which leads south into Grammar Hall (an extension 
 
709
           purpose-built for the Room 16 exhibition).",
 
710
       d_to Foyer,
 
711
       s_to Grammar_Hall,
 
712
       u_to Third_Floor,
 
713
  has  light;
 
714
 
 
715
Object -> "map"
 
716
  with name "map" "mezzanine" "level",
 
717
       initial "A map of the mezzanine level is embossed in one wall.",
 
718
       description
 
719
       [;  font off;
 
720
           print
 
721
          "^+------------------------------------------+
 
722
           ^|                                          |
 
723
           ^|                                          |
 
724
           ^|                                          |
 
725
           ^|                                          |
 
726
           ^|               Mezzanine                  |
 
727
           ^|             (you are here)               |
 
728
           ^|                   |                      |
 
729
           ^|                   |                      |
 
730
           ^|             Grammar Hall 16              |
 
731
           ^|       (telepathy, clock)                 |
 
732
           ^|       (Charlotte, Dan)   --- Ten Forward |
 
733
           ^|                   |         (replicator) |
 
734
           ^|               Liberator     (computer)   |
 
735
           ^|                Bridge       (tricorder)  |
 
736
           ^|                 (Zen)                    |
 
737
           ^+------------------------------------------+^";
 
738
           font on;
 
739
       ],
 
740
  has  static;
 
741
 
 
742
Object -> "Room 16 exhibition leaflet"
 
743
  with name "leaflet" "exhibition" "guide" "room" "sixteen",
 
744
       initial "An exhibition leaflet has fallen to the floor.",
 
745
       description
 
746
          "Among the rare & fascinating exhibits in Room 16 are:...^^
 
747
           Telekinetic (and telepathic) Martha. In the telepathy
 
748
           booth, you can speak to her as though she were in Room 16
 
749
           with you -- but she's not, she is far away. Tell her to
 
750
           ~look~ to find out where, and you can also ask her to give
 
751
           you things (by telekinesis).^^
 
752
           Charlotte, who is playing Simon Says. She'll obey
 
753
           instructions you give as long as you preface it with
 
754
           ~simon says~. (Though she only knows how to wave, or how to
 
755
           clap many times (just tell her a number).)^^
 
756
           Dyslexic Dan knows how to take and drop things and how to
 
757
           perform an inventory, but unfortunately confuses Take and
 
758
           Drop orders.^^
 
759
           The alarm clock can be told ~on~, ~off~ or a time of day
 
760
           (to set its alarm to).";
 
761
           
 
762
! --------------------------------------------------------------------------
 
763
 
 
764
Object Grammar_Hall "Grammar Hall"
 
765
  has  light,
 
766
  with description
 
767
          "The main exhibit on the second floor: Room 16, south of the 
 
768
           mezzanine. A Jeffreys Tube runs @00 into a Star Trek: The
 
769
           Next Generation room, while a hexagonal corridor to the south
 
770
           leads to the bridge of the spaceship ~Liberator~.",
 
771
       n_to Second_Floor, e_to Star_Trek, s_to Blakes_Seven;
 
772
 
 
773
Object -> booth "telepathy booth"
 
774
  with name "booth" "telepathy",
 
775
       initial
 
776
          "A telepathy booth stands invitingly open: 
 
777
           ~Talk To Telekinetic Martha~.",
 
778
  has  enterable static;
 
779
 
 
780
Object -> "Charlotte"
 
781
  with name "charlotte" "charlie" "chas",
 
782
       number 0,
 
783
       grammar
 
784
       [;  give self ~general;
 
785
           wn=verb_wordnum;
 
786
           if (NextWord()=='simon' && NextWord()=='says')
 
787
           {   give self general;
 
788
               verb_wordnum=verb_wordnum+2;
 
789
           }
 
790
           self.number=TryNumber(verb_wordnum);
 
791
           if (self.number~=-1000)
 
792
           {    action=##Clap; noun=0; second=0; rtrue; }
 
793
       ],
 
794
       orders
 
795
       [ i;  if (self hasnt general) "Charlotte sticks her tongue out.";
 
796
           WaveHands: "Charlotte waves energetically.";
 
797
           Clap: if (self.number==0) "Charlotte folds her arms.";
 
798
                 for (i=0:i<self.number:i++)
 
799
                 {   print "Clap! ";
 
800
                     if (i==100)
 
801
                         print "(You must be regretting this by now.) ";
 
802
                     if (i==200)
 
803
                         print "(What a determined girl she is.) ";
 
804
                 }
 
805
                 if (self.number>100)
 
806
                     "^^Charlotte's a bit out of breath now.";
 
807
                "^^~Easy!~ says Charlotte.";
 
808
           default: "~Don't know how,~ says Charlotte.";
 
809
       ],
 
810
       initial "Charlotte wants to play Simon Says.",
 
811
  has  animate female proper crewmember;
 
812
 
 
813
Object -> "Dyslexic Dan"
 
814
  with name "dan" "dyslexic",
 
815
       grammar
 
816
       [;  if (verb_word == 'take') { verb_wordnum++; return 'drop'; }
 
817
           if (verb_word == 'drop') { verb_wordnum++; return 'take'; }
 
818
       ],
 
819
       orders
 
820
       [;
 
821
           Take: "~What,~ says Dan, ~ you want me to take ",
 
822
                     (the) noun, "?~";
 
823
           Drop: "~What,~ says Dan, ~ you want me to drop ",
 
824
                     (the) noun, "?~";
 
825
           Inv: "~That I can do,~ says Dan. ~I'm empty-handed.~";
 
826
           default: "~Don't know how,~ says Dan.";
 
827
       ],
 
828
       initial "Dyslexic Dan is here.",
 
829
  has  animate proper crewmember;
 
830
 
 
831
[ PrintTime x;
 
832
  print (x/60), ":", (x%60)/10, (x%60)%10;
 
833
];
 
834
 
 
835
Object -> "alarm clock"
 
836
  with name "alarm" "clock", article "an",
 
837
       number 480,
 
838
       description
 
839
       [;  print "The alarm is ";
 
840
           if (self has general) print "on, "; else print "off, but ";
 
841
           "the clock reads ", (PrintTime) the_time,
 
842
           " and the alarm is set for ", (PrintTime) self.number, ".";
 
843
       ],
 
844
       react_after
 
845
       [;  Inv:  if (self in player)   { new_line; <<Examine self>>; }
 
846
           Look: if (self in location) { new_line; <<Examine self>>; }
 
847
       ],
 
848
       daemon
 
849
       [;  if (the_time >= self.number && the_time <= self.number+3
 
850
               && self has general) "^Beep! Beep! The alarm goes off.";
 
851
       ],
 
852
       grammar
 
853
       [;  return 'alarm,';
 
854
       ],
 
855
       orders
 
856
       [;  SwitchOn: give self general; StartDaemon(self); "~Alarm set.~";
 
857
           SwitchOff: give self ~general; StopDaemon(self);
 
858
               "~Alarm cancelled.~";
 
859
           SetTo:   self.number=noun; <<Examine self>>;
 
860
           default: "~Commands are on, off or a time of day only, pliz.~";
 
861
       ],
 
862
       life
 
863
       [;  Ask, Answer, Tell:
 
864
           "[Try ~clock, something~ to address the clock.]";
 
865
       ],
 
866
  has  talkable;
 
867
 
 
868
! --------------------------------------------------------------------------
 
869
 
 
870
Object Blakes_Seven "Spaceship Liberator: Bridge"
 
871
  has  light,
 
872
  with description
 
873
          "The great serried bridge of the alien spaceship Liberator,
 
874
           captured by Blake's group of revolutionary criminals on the
 
875
           run from the oppressive Earth Federation.  (Don't worry --
 
876
           it's just a convincing replica, and the museum still lies
 
877
           back north.)",
 
878
       n_to Grammar_Hall;
 
879
 
 
880
Object -> "informative plaque"
 
881
  with name "informative" "plaque",
 
882
       article "an",
 
883
       description
 
884
          "[Among the commands which Zen was often given by the hard-pressed
 
885
           Liberator crew were:^^
 
886
           zen, scan 360 orbital^
 
887
           zen, speed standard by six^
 
888
           zen, clear the neutron blasters for firing^
 
889
           zen, raise the force wall^
 
890
           zen, set course for centauro]",
 
891
  has  static;
 
892
 
 
893
Object -> "Zen"
 
894
  with name "zen" "flight" "computer",
 
895
       initial
 
896
          "Square lights flicker unpredictably across a hexagonal fascia 
 
897
           on one wall, indicating that the flight computer Zen is on-line.",
 
898
       grammar
 
899
       [;  return -'zen,';
 
900
       ],
 
901
       orders
 
902
       [;  Show: "The main screen shows a starfield, 
 
903
                  turning through ", noun, " degrees.";
 
904
           Go:  "~Confirmed.~  The ship turns to a new bearing.";
 
905
           SetTo: if (noun==0) "~Confirmed.~  The ship comes to a stop.";
 
906
               if (noun>12) "~Standard by ", (number) noun,
 
907
                            " exceeds design tolerances.~";
 
908
               "~Confirmed.~  The ship's engines step to 
 
909
                standard by ", (number) noun, ".";
 
910
           Take: if (noun~=force_wall) "~Please clarify.~";
 
911
                "~Force wall raised.~";
 
912
           Drop: if (noun~=blasters)   "~Please clarify.~";
 
913
              "~Battle-computers on line. 
 
914
                Neutron blasters cleared for firing.~";
 
915
           NotUnderstood: "~Language banks unable to decode.~";
 
916
           default: "~Information. That function is unavailable.~";
 
917
       ],
 
918
  has  talkable proper static;
 
919
Object -> -> force_wall "force wall"     with name "force" "wall" "shields";
 
920
Object -> -> blasters "neutron blasters" with name "neutron" "blasters";
 
921
 
 
922
! --------------------------------------------------------------------------
 
923
 
 
924
Object "Captain Picard"
 
925
  with name "captain" "picard",
 
926
  has  proper animate crewmember;
 
927
 
 
928
Object Star_Trek "10 Forward"
 
929
  has  light,
 
930
  with description
 
931
          "The starswept observation lounge forward of deck 10
 
932
           of the Starship Enterprise, where many milkshakes have
 
933
           been consumed in crisis situations. (It's only a replica,
 
934
           of course, and the museum lies back @01.)",
 
935
       w_to Grammar_Hall;
 
936
 
 
937
Object -> "informative plaque"
 
938
  with name "informative" "plaque",
 
939
       article "an",
 
940
       description
 
941
          "[The computer, called just ~computer~, is useful for locating
 
942
           crew-members: try ~computer, where is commander data~, or
 
943
           ~...captain picard~, or any of the other people who can be
 
944
           found in the Museum.^^
 
945
           The tricorder will scan something if you tell it the name of
 
946
           whom or what you wish to scan.^^
 
947
           The replicator is a superior drinks machine: for instance,
 
948
           Captain Picard is fond of saying ~replicator, tea earl grey~.
 
949
           There's also brandy and distilled water.]",
 
950
  has  static;
 
951
 
 
952
Object -> "computer"
 
953
  with name "computer",
 
954
       initial "The computer, of course, always responds to your voice here.",
 
955
       grammar
 
956
       [;  return 'stc,';
 
957
       ],
 
958
       orders
 
959
       [;  Examine:
 
960
               if (parent(noun)==0)
 
961
                   "~", (name) noun,
 
962
                   " is no longer aboard this demonstration game.~";
 
963
               "~", (name) noun, " is in ", (name) parent(noun), ".~";
 
964
           default: "The computer's only really good for locating the crew.";
 
965
       ],
 
966
       life
 
967
       [;  Ask, Answer, Tell: "The computer is too simple.";
 
968
       ],
 
969
  has  talkable static;
 
970
 
 
971
Object -> "tricorder"
 
972
  with name "tricorder",
 
973
       grammar
 
974
       [;  return 'tc,';
 
975
       ],
 
976
       orders
 
977
       [;  Examine: if (noun==player) "~You radiate life signs.~";
 
978
               print "~", (The) noun, " radiates ";
 
979
               if (noun hasnt animate) print "no ";
 
980
              "life signs.~";
 
981
           default: "The tricorder bleeps. It can only accept commands 
 
982
               ~tricorder, <something>~.";
 
983
       ],
 
984
       life
 
985
       [;  Ask, Answer, Tell: "The tricorder is too simple.";
 
986
       ],
 
987
  has  talkable;
 
988
 
 
989
Object -> "replicator"
 
990
  with name "replicator",
 
991
       initial
 
992
          "A replicator (i.e. Star Trek drinks machine) occupies a niche 
 
993
           in one wall.",
 
994
       grammar
 
995
       [;  return 'rc,';
 
996
       ],
 
997
       orders
 
998
       [;  Give:
 
999
               "The replicator serves up a cup of ",
 
1000
               (name) noun, " which you drink eagerly.";
 
1001
           default: "The replicator is unable to oblige. You must give 
 
1002
               it the name of a drink it knows about.";
 
1003
       ],
 
1004
       life
 
1005
       [;  Ask, Answer, Tell: "The replicator has no conversation skill.";
 
1006
       ],
 
1007
  has  talkable static;
 
1008
Object -> -> "Earl Grey tea"    with name "earl" "grey" "tea";
 
1009
Object -> -> "Aldebaran brandy" with name "aldebaran" "brandy";
 
1010
Object -> -> "distilled water"  with name "distilled" "water";
 
1011
 
 
1012
! --------------------------------------------------------------------------
 
1013
 
 
1014
Object "Sealed Room"
 
1015
  with description
 
1016
          "I'm in a sealed room, like a squash court without a door, 
 
1017
           maybe six or seven yards across",
 
1018
  has  light;
 
1019
Object -> "fish" with name "fish";
 
1020
Key -> "cadmium key"
 
1021
  with name "cadmium",
 
1022
       after
 
1023
       [;  Drop: remove self; "The key smashes into smithereens!";
 
1024
       ];
 
1025
 
 
1026
Object -> martha "Martha"
 
1027
   has animate female concealed proper crewmember
 
1028
  with name "martha",
 
1029
       orders
 
1030
       [ r; r=parent(self);
 
1031
           Give:
 
1032
               if (noun notin r) "~That's beyond my telekinesis.~";
 
1033
               if (noun==self) "~Teleportation's too hard for me.~";
 
1034
               move noun to player;
 
1035
               "~Here goes...~ and Martha's telekinetic talents 
 
1036
                magically bring ", (the) noun, " to your hands.";
 
1037
           Look:
 
1038
               print "~", (string) r.description;
 
1039
               if (children(r)==1) ". There's nothing here but me.~";
 
1040
               print ". I can see ";
 
1041
               WriteListFrom(child(r),CONCEAL_BIT+ENGLISH_BIT);
 
1042
              ".~";
 
1043
           default: "~Afraid I can't help you there.~";
 
1044
       ],
 
1045
       life
 
1046
       [;  Ask: "~You're on your own this time.~";
 
1047
           Tell: "Martha clucks sympathetically.";
 
1048
           Answer: "~I'll be darned,~ Martha replies.";
 
1049
       ];
 
1050
 
 
1051
! ==========================================================================
 
1052
 
 
1053
Object Third_Floor "Third Floor"
 
1054
  with name "trapdoor",
 
1055
       description
 
1056
          "Atop the marble staircase, this third floor 
 
1057
           foyer fans out into Rooms from Chapter V. These run:^
 
1058
           ^  south to Corridor 22 (inventories) 
 
1059
           and the List Property Office,
 
1060
           ^  @00 to Room 24 (Curious Names),
 
1061
           ^  @01 to Room 28, which is divided by a glass window.^
 
1062
           ^Only a very rickety
 
1063
           ladder goes further up, through an open trapdoor to the roof.",
 
1064
       d_to Second_Floor, u_to roof,
 
1065
       e_to Room24, w_to window_w, s_to Corridor22,
 
1066
  has  light;
 
1067
 
 
1068
Object -> "map"
 
1069
  with name "map" "third" "floor",
 
1070
       initial "A map of the third floor is embossed in one wall.",
 
1071
       description
 
1072
       [;  font off;
 
1073
           print
 
1074
          "^+------------------------------------------+
 
1075
           ^|                                          |
 
1076
           ^|    (glass                                |
 
1077
           ^|     window)                              |
 
1078
           ^|      !                                   |
 
1079
           ^| Room ! 28  ---  Stairs  ---   Room 24    |
 
1080
           ^|      !       (you are here)     Names    |
 
1081
           ^|                   |              |       |
 
1082
           ^|                   |          Museum Cafe |
 
1083
           ^|               Corridor 22                |
 
1084
           ^|              (Inventories)               |
 
1085
           ^|            /      |        @@92             |
 
1086
           ^|           /       |         @@92            |
 
1087
           ^| Room 23 W ---   Room 23  --- Room 23 E   |
 
1088
           ^| (listing     List Property    (I Ching)  |
 
1089
           ^| machine)        Office                   |
 
1090
           ^+------------------------------------------+^";
 
1091
           font on;
 
1092
       ],
 
1093
  has  static;
 
1094
 
 
1095
Object -> "Lexicon"
 
1096
  with name "lexicon",
 
1097
       initial
 
1098
          "On the top step is a discarded Lexicon of verbs.",
 
1099
       description
 
1100
          "(The lexicon has the number 27 written on the spine.)^^
 
1101
           Inside are many familiar verbs that you regularly use
 
1102
           when navigating through Inform games. There are also
 
1103
           some special ones, only available in the Museum...^^
 
1104
           ~megalook~ : like ~look~ but much fuller;^
 
1105
           ~threefold <noun> <noun> <noun>~ : this doesn't
 
1106
           actually do anything, but it shows how a verb can
 
1107
           be parsed which has three objects, not just 0 to 2
 
1108
           as usual;^
 
1109
           ~time <time of day>~ : sets the current time of day
 
1110
           (go out onto the Balcony to see sunrise at 6 AM);^
 
1111
           ~fp <floating-point number>~ : shows how floating-point
 
1112
           numbers can be parsed;^
 
1113
           ~dial <phone-style number>~ : likewise phone numbers.^^
 
1114
           Also, in the Museum, ~lock~ and ~unlock~ are cunningly
 
1115
           able to presume keys as their second objects.";
 
1116
 
 
1117
! --------------------------------------------------------------------------
 
1118
 
 
1119
Object Corridor22 "Corridor 22"
 
1120
  with description
 
1121
          "Runs south of the top floor foyer, and leads to Room 23,
 
1122
           such a long room that you can enter it to southwest, south
 
1123
           or southeast.^^
 
1124
           In the floor is a curious solid quartz window.",
 
1125
       n_to Third_Floor,
 
1126
       s_to Room23, se_to Room23b, sw_to Room23a,
 
1127
       d_to "Solid quartz.",
 
1128
  has  light;
 
1129
 
 
1130
Object -> "quartz window"
 
1131
  with name "quartz" "window",
 
1132
       before
 
1133
       [;  Examine, Search, LookUnder:
 
1134
               print "Through the window you can hazily make out the contents 
 
1135
                      of the Grammar Hall below...^";
 
1136
               if (Locale(Grammar_Hall, "You can see",
 
1137
                          "You can also see")~=0)
 
1138
                   " on the floor below.";
 
1139
               rtrue;
 
1140
       ],
 
1141
  has  scenery;
 
1142
 
 
1143
Object -> "Geoffrey's book"
 
1144
  with name "book" "old" "harmless" "lethal" "of" "geoffrey^s",
 
1145
       invent "that harmless old book of Geoffrey's",
 
1146
       before
 
1147
       [;  Examine:
 
1148
               self.invent = "that lethal old book of Geoffrey's";
 
1149
              "The apparently harmless book turns fiery hot in your hands, 
 
1150
               and your eyes are dragged toward the hideous sigils 
 
1151
               inscribed within it... Just in time, you break the gorgon 
 
1152
               gaze and look away.^^
 
1153
               [From this moment, its inventory entry changes.]";
 
1154
       ],
 
1155
  has  proper;
 
1156
 
 
1157
Object -> "platinum pyramid"
 
1158
  with name "platinum" "pyramid",
 
1159
       description "No matter how many times you pick this up and put it 
 
1160
           down again, it never becomes an ~ordinary~ object for room 
 
1161
           description purposes -- it always has a line to itself.",
 
1162
       describe
 
1163
       [;  "^The platinum pyramid catches the light beautifully.";
 
1164
       ];
 
1165
 
 
1166
Object -> "ornate box"
 
1167
  with name "decorated" "ornate" "box",
 
1168
       invent
 
1169
       [;  if (inventory_stage==1) give self general;
 
1170
           else give self ~general;
 
1171
       ],
 
1172
       short_name
 
1173
       [;  if (self has general) { print "box"; rtrue; } ],
 
1174
       article
 
1175
       [;  if (self has general)
 
1176
           {   print "that most remarkably decorated"; rtrue;
 
1177
           }
 
1178
           else print "an"; ],
 
1179
       description
 
1180
          "[What's interesting about the ornate box is that its
 
1181
            inventory listing overrides its short name entirely,
 
1182
            and yet its contents will still be inventoried.]",
 
1183
  has  open openable container;
 
1184
 
 
1185
Object -> -> "pearl"
 
1186
  with name "pearl",
 
1187
       description "Don't look at me - I'm irrelevant.";
 
1188
 
 
1189
! --------------------------------------------------------------------------
 
1190
 
 
1191
Object Room23a "Room 23 @01: Inventory Annexe"
 
1192
  with description
 
1193
        "The @01ern end of Room 23 is a housing for the Listing Machine.",
 
1194
       e_to Room23, ne_to Corridor22,
 
1195
  has  light;
 
1196
 
 
1197
Object -> list_machine "listing machine"
 
1198
  with name "listing" "list" "machine",
 
1199
       describe
 
1200
       [ i;  print "The listing machine has a go button and a number of 
 
1201
                    switches, whose current settings are as follows:^";
 
1202
             objectloop (i in self)
 
1203
             {   if (i~=list_go)
 
1204
                 {   print (address) (i.&name)-->0, "  ";
 
1205
                     if (i has on) print "(on)^"; else print "(off)^";
 
1206
                 }
 
1207
             }
 
1208
             rtrue;
 
1209
       ],
 
1210
  has  transparent static;
 
1211
 
 
1212
Object -> -> list_go "go button"
 
1213
  with name "go" "button" "control",
 
1214
       before
 
1215
       [ i j;  Push:
 
1216
            objectloop (i in list_machine)
 
1217
                if (i~=self && i has on) j=j+i.number;
 
1218
            print "~In this style, your inventory is listed as 
 
1219
                follows...^";
 
1220
            WriteListFrom(child(player), j, 1);
 
1221
           "...~";
 
1222
       ],
 
1223
  has  static;
 
1224
 
 
1225
Class  BitSwitch
 
1226
  with name "switch" "control",
 
1227
  has  switchable static;
 
1228
 
 
1229
BitSwitch -> -> "newline switch" 
 
1230
  with name "newline",  number NEWLINE_BIT;
 
1231
BitSwitch -> -> "indent switch" 
 
1232
  with name "indent",   number INDENT_BIT;
 
1233
BitSwitch -> -> "fullinv switch" 
 
1234
  with name "fullinv",  number FULLINV_BIT, has on;
 
1235
BitSwitch -> -> "english switch" 
 
1236
  with name "english",  number ENGLISH_BIT, has on;
 
1237
BitSwitch -> -> "recurse switch" 
 
1238
  with name "recurse",  number RECURSE_BIT, has on;
 
1239
BitSwitch -> -> "always switch" 
 
1240
  with name "always",   number ALWAYS_BIT;
 
1241
BitSwitch -> -> "terse switch" 
 
1242
  with name "terse",    number TERSE_BIT;
 
1243
BitSwitch -> -> "partinv switch" 
 
1244
  with name "partinv",  number PARTINV_BIT;
 
1245
BitSwitch -> -> "defart switch" 
 
1246
  with name "defart",   number DEFART_BIT;
 
1247
BitSwitch -> -> "workflag switch" 
 
1248
  with name "workflag", number WORKFLAG_BIT;
 
1249
BitSwitch -> -> "isare switch" 
 
1250
  with name "isare",    number ISARE_BIT;
 
1251
BitSwitch -> -> "conceal switch" 
 
1252
  with name "conceal",  number CONCEAL_BIT;
 
1253
 
 
1254
! --------------------------------------------------------------------------
 
1255
 
 
1256
[ CoinsTogether cla i x y;
 
1257
  objectloop (i ofclass cla)
 
1258
  {   x=parent(i);
 
1259
      if (y==0) y=x; else { if (x~=y) return 0; }
 
1260
  }
 
1261
  return y;
 
1262
];
 
1263
 
 
1264
[ Face x; if (x.number==1) print "Heads"; else print "Tails"; ];
 
1265
 
 
1266
Array gold_trigrams -->   "fortune" "change" "river flowing" "chance"
 
1267
                          "immutability" "six stones in a circle"
 
1268
                          "grace" "divine assistance";
 
1269
Array silver_trigrams --> "happiness" "sadness" "ambition" "grief"
 
1270
                          "glory" "charm" "sweetness of nature"
 
1271
                          "the countenance of the Hooded Man";
 
1272
 
 
1273
[ Trigram cla i k state;
 
1274
  objectloop (i ofclass cla)
 
1275
  {   print (Face) i; if (k++<2) print ","; print " ";
 
1276
      state=state*2 + (i.number-1);
 
1277
  }
 
1278
  if (cla == GoldCoin) i=gold_trigrams; else i=silver_trigrams;
 
1279
  print "(", (string) i-->state, ")";
 
1280
];
 
1281
 
 
1282
[ CoinsLT cla k i c;
 
1283
  if (inventory_stage==1)
 
1284
  {   if (cla == GoldCoin) print "the gold"; else print "the silver";
 
1285
      print " coins ";
 
1286
      k=CoinsTogether(cla);
 
1287
      if (k==location || k has supporter)
 
1288
      {   objectloop (i ofclass cla)
 
1289
          {   print (name) i;
 
1290
              switch(++c)
 
1291
              {  1: print ", "; 2: print " and ";
 
1292
                 3: print " (showing the trigram ", (Trigram) cla, ")";
 
1293
              }
 
1294
          }
 
1295
          rtrue;
 
1296
      }
 
1297
      c_style = c_style | (ENGLISH_BIT+NOARTICLE_BIT);
 
1298
      if (c_style & NEWLINE_BIT ~= 0) c_style = c_style - NEWLINE_BIT;
 
1299
      if (c_style & INDENT_BIT ~= 0)  c_style = c_style - INDENT_BIT;
 
1300
  }
 
1301
  rfalse;
 
1302
];
 
1303
 
 
1304
Class  Coin
 
1305
  with number 1, article "the",
 
1306
       parse_name
 
1307
       [ i j w;
 
1308
         if (parser_action==##TheSame) return -2;
 
1309
         w='gold'; if (self ofclass SilverCoin) w='silver';
 
1310
         for (::i++)
 
1311
         {   j=NextWord();
 
1312
             if (j=='coins') parser_action=##PluralFound;
 
1313
             else if (j~='coin' or w or self.name) return i;
 
1314
         }
 
1315
       ],
 
1316
       after
 
1317
       [ j;
 
1318
           Drop, PutOn:
 
1319
                 self.number=random(2); print (Face) self, ". ";
 
1320
                 if (self ofclass GoldCoin) j=GoldCoin; else j=SilverCoin;
 
1321
                 if (CoinsTogether(j)~=0)
 
1322
                 {   print "The ";
 
1323
                     if (j == GoldCoin) print "gold"; else print "silver";
 
1324
                     " trigram is now ", (Trigram) j, ".";
 
1325
                 }
 
1326
                 new_line; rtrue;
 
1327
       ];
 
1328
 
 
1329
Class  GoldCoin class Coin
 
1330
  with list_together [; return CoinsLT(GoldCoin); ];
 
1331
Class  SilverCoin class Coin
 
1332
  with list_together [; return CoinsLT(SilverCoin); ];
 
1333
 
 
1334
Object Room23b "Room 23 @00: Chinese Room"
 
1335
  with description "A small, well-composed Chinese room for meditation, 
 
1336
           through which ~a wind can blow~. (But only if it blows from 
 
1337
           @01 back to north@01, because they're the only exits.)
 
1338
           From each cornice of the ceiling, a cherub looks down.",
 
1339
       w_to Room23, nw_to Corridor22,
 
1340
  has  light;
 
1341
 
 
1342
Object -> "Chinese scroll"
 
1343
  with name "chinese" "scroll" "instructions",
 
1344
       initial "A scroll hangs on one wall.",
 
1345
       description
 
1346
          "Instructing you in the arts of the I Ching, the scroll advises 
 
1347
           you to throw the two trigrams of gold and silver coins, that 
 
1348
           you may find wisdom in the result.";
 
1349
 
 
1350
GoldCoin -> "goat" with name "goat";
 
1351
GoldCoin -> "deer" with name "deer";
 
1352
GoldCoin -> "chicken" with name "chicken";
 
1353
 
 
1354
SilverCoin -> "robin" with name "robin";
 
1355
SilverCoin -> "snake" with name "snake";
 
1356
SilverCoin -> "bison" with name "bison";
 
1357
 
 
1358
Global cherub_warning_given;
 
1359
Class  Cherub
 
1360
  with parse_name
 
1361
       [ i j flag;
 
1362
         for (flag=1:flag==1:)
 
1363
         {   flag=0;
 
1364
             j=NextWord();
 
1365
             if (j=='cherub' || j==self.name) flag=1;
 
1366
             if (j=='cherubs')
 
1367
             {   parser_action=##PluralFound; flag=1;
 
1368
                 if (cherub_warning_given==0)
 
1369
                     print "(I'll let this go, 
 
1370
                         but the plural of ~cherub~ is ~cherubim~.)^";
 
1371
                 cherub_warning_given = true;
 
1372
             }
 
1373
             if (j=='cherubim')
 
1374
             {   parser_action=##PluralFound; flag=1; }
 
1375
             i++;
 
1376
         }
 
1377
         return i-1;
 
1378
       ],
 
1379
  has  scenery;
 
1380
 
 
1381
Cherub -> "northeast cherub"  with name "northeast";
 
1382
Cherub -> "southeast cherub"  with name "southeast";
 
1383
Cherub -> "northwest cherub"  with name "northwest";
 
1384
Cherub -> "southwest cherub"  with name "southwest";
 
1385
 
 
1386
! --------------------------------------------------------------------------
 
1387
 
 
1388
Object Room23 "Room 23: List Property Office"
 
1389
  with description
 
1390
          "This the List Property Office (it seems that an ~O~ 
 
1391
           was lost some time ago), at the southern end of the top floor; 
 
1392
           the management have kindly provided a green baize table, while 
 
1393
           the rest is presumably the work of patrons.^^
 
1394
           Room 23 continues @00 to @01.",
 
1395
       n_to Corridor22,
 
1396
       e_to Room23b,
 
1397
       w_to Room23a
 
1398
  has  light;
 
1399
 
 
1400
Object -> "green baize table"
 
1401
  with name "green" "baize" "table"
 
1402
  has  scenery supporter;
 
1403
 
 
1404
Class  PlasticCutlery
 
1405
  with name "plastic" "cutlery", article "a plastic",
 
1406
       list_together
 
1407
       [;  if (inventory_stage==1)
 
1408
           { if (c_style & NOARTICLE_BIT == 0) c_style=c_style+NOARTICLE_BIT;
 
1409
             if (c_style & ENGLISH_BIT == 0)   c_style=c_style+ENGLISH_BIT;
 
1410
             if (c_style & NEWLINE_BIT ~= 0)   c_style=c_style-NEWLINE_BIT;
 
1411
             if (c_style & INDENT_BIT ~= 0)    c_style=c_style-INDENT_BIT;
 
1412
             print "a plastic ";
 
1413
           }
 
1414
       ];
 
1415
 
 
1416
PlasticCutlery -> "fork"  with name "fork";
 
1417
PlasticCutlery -> "knife" with name "knife";
 
1418
PlasticCutlery -> "spoon" with name "spoon";
 
1419
 
 
1420
Class Hat with list_together "hats", name "hat" "hats", has clothing;
 
1421
 
 
1422
Hat -> "fez"      with name "fez";
 
1423
Hat -> "Panama"   with name "panama";
 
1424
Hat -> "sombrero" with name "sombrero";
 
1425
 
 
1426
Class Letter
 
1427
  with list_together
 
1428
       [;  if (inventory_stage==1)
 
1429
           { print "the letters ";
 
1430
             c_style = c_style | (ENGLISH_BIT+NOARTICLE_BIT);
 
1431
             if (c_style & NEWLINE_BIT ~= 0) c_style = c_style - NEWLINE_BIT;
 
1432
             if (c_style & INDENT_BIT ~= 0)  c_style = c_style - INDENT_BIT;
 
1433
           }
 
1434
           else print " from a Scrabble set";
 
1435
       ],
 
1436
       short_name
 
1437
       [;  if (listing_together ofclass Letter) rfalse;
 
1438
           print "letter ", (object) self, " from a Scrabble set"; rtrue;
 
1439
       ],
 
1440
       article "the";
 
1441
 
 
1442
Letter -> "X" with name "x";
 
1443
Letter -> "Y" with name "y";
 
1444
Letter -> "Z" with name "z";
 
1445
Letter -> "P" with name "p";
 
1446
Letter -> "Q" with name "q";
 
1447
Letter -> "R" with name "r";
 
1448
 
 
1449
Object -> "defrosting Black Forest gateau"
 
1450
  with name "black" "forest" "gateau" "cake",
 
1451
  has  edible;
 
1452
 
 
1453
Object -> "Punch magazine"
 
1454
  with name "punch" "magazine",
 
1455
       description
 
1456
          "Five years out of date by the cover, a hundred by the contents.",
 
1457
       list_together 1,
 
1458
  has  proper;
 
1459
Object -> "issue of the Spectator"
 
1460
  with name "spectator" "issue" "magazine", article "a recent",
 
1461
       description
 
1462
          "Up to date by the cover, a nightmare view of the future within.",
 
1463
       list_together 1;
 
1464
 
 
1465
Object -> "die"
 
1466
  with name "die" "dice",
 
1467
       after [; Drop: print "It comes up ", random(6); "!"; ];
 
1468
 
 
1469
 
 
1470
Class  Star
 
1471
  with name "star",
 
1472
       description
 
1473
           "A little star of precious-metal, perhaps exotic currency.",
 
1474
       parse_name
 
1475
       [ i j w;
 
1476
         if (parser_action==##TheSame)
 
1477
         {   if ((parser_one.&name)-->0 == (parser_two.&name)-->0) return -1;
 
1478
             return -2;
 
1479
         }
 
1480
         w=(self.&name)-->0;
 
1481
         for (::i++)
 
1482
         {   j=NextWord();
 
1483
             if (j=='stars') parser_action=##PluralFound;
 
1484
             else if (j~='star' or w) return i;
 
1485
         }
 
1486
       ],
 
1487
       list_together "stars",
 
1488
       plural
 
1489
       [;  print (address) (self.&name)-->0;
 
1490
           if (~~(listing_together ofclass Star)) print " stars";
 
1491
       ],
 
1492
       short_name
 
1493
       [;  if (listing_together ofclass Star)
 
1494
           {   print (address) (self.&name)-->0; rtrue; }
 
1495
       ],
 
1496
       article
 
1497
       [;  if (listing_together ofclass Star) print "one"; else print "a";
 
1498
       ];
 
1499
 
 
1500
Class  GoldStar   class Star with name "gold";
 
1501
Class  SilverStar class Star with name "silver";
 
1502
Class  BronzeStar class Star with name "bronze";
 
1503
 
 
1504
SilverStar -> "silver star";
 
1505
SilverStar -> "silver star";
 
1506
SilverStar -> "silver star";
 
1507
SilverStar -> "silver star";
 
1508
BronzeStar -> "bronze star";
 
1509
GoldStar -> "gold star";
 
1510
GoldStar -> "gold star";
 
1511
GoldStar -> "gold star";
 
1512
 
 
1513
! --------------------------------------------------------------------------
 
1514
 
 
1515
Object Room24 "Curious Names"
 
1516
  with description
 
1517
          "This is Room 24, @00 of the mezzanine. The exhibits are
 
1518
           packed in here, but fortunately there's a plaque making
 
1519
           some sense of it all.",
 
1520
       w_to Third_Floor, s_to Museum_Cafe,
 
1521
  has  light;
 
1522
 
 
1523
Object -> plaque "plaque"
 
1524
  with name "plaque",
 
1525
       description
 
1526
          "Room 24 Plaque^^
 
1527
           Princess is capable of a startling change of name when kissed.^^
 
1528
           The genie's lamp, when rubbed, may make alarming things
 
1529
           happen to your ability to refer to the colours ~black~ and
 
1530
           ~white~. The stones may help you to experiment with this.^^
 
1531
           Carrying the magnifying glass allows you to ~magnify~ things.^^
 
1532
           The game's parser has been specially programmed for the
 
1533
           fly in amber object, so that ~put the fly in amber in box~
 
1534
           will work correctly (and not be interpreted as ~put (the fly) in
 
1535
           (amber in box)~).",
 
1536
  has  scenery;
 
1537
 
 
1538
Object -> genies_lamp "genie's lamp"
 
1539
  with name "lamp",
 
1540
       before
 
1541
       [;  Rub:
 
1542
               if (self hasnt general) give self general;
 
1543
               else give self ~general;
 
1544
               "A genie appears from the lamp, declaring:^^
 
1545
                  ~Mischief is my sole delight:^ 
 
1546
                   If white means black, black means white!~";
 
1547
       ];
 
1548
 
 
1549
Object -> "white stone"   with name "white" "stone";
 
1550
Object -> "black stone"   with name "black" "stone";
 
1551
 
 
1552
Object -> "fly in amber"  with name "fly" "amber";
 
1553
 
 
1554
Object -> magnifier "magnifying glass"
 
1555
  with name "glass" "magnifying" "magnifier" "lense",
 
1556
       description "Using this, you can ~magnify~ things.";
 
1557
 
 
1558
[ MagnifySub;
 
1559
   if (magnifier notin player)
 
1560
      "You're not holding a magnifying glass.";
 
1561
   if (noun==magnifier) "Light is not so flexible as that.";
 
1562
   print "You can just make out that ", (the) noun,
 
1563
      " is inscribed as being ~object ", noun, "~.^";
 
1564
   if (magnifier hasnt general)
 
1565
   {   give magnifier general;
 
1566
      "^(When you're carrying the magnifier, you can refer to 
 
1567
        things by their numbers like this; and you can even use 
 
1568
        # to mean ~any single object~ and * to mean ~all objects~.)";
 
1569
   }
 
1570
];
 
1571
 
 
1572
[ ParseNoun obj;
 
1573
  if (magnifier notin player) return -1;
 
1574
  if (NextWord() == 'object' && TryNumber(wn) == obj) return 2;
 
1575
  wn--;
 
1576
  if (WordLength(wn)==1 && WordAddress(wn)->0 == '#') return 1;
 
1577
  if (WordLength(wn)==1 && WordAddress(wn)->0 == '*')
 
1578
  {   parser_action = ##PluralFound; return 1; }
 
1579
  return -1;
 
1580
];
 
1581
 
 
1582
Object -> "/?%?/ (the artiste formally known as Princess)"
 
1583
  with name "princess" "artiste" "formally" "known" "as",
 
1584
       description "You somehow feel it would be appropriate 
 
1585
                    to kiss Princess.",
 
1586
       short_name
 
1587
       [;   if (self hasnt general) { print "Princess"; rtrue; }
 
1588
       ],
 
1589
       react_before
 
1590
       [;  Listen: print_ret (name) self, " sings a soft siren song.";
 
1591
       ],
 
1592
       initial
 
1593
       [;  print_ret (name) self, " is singing softly.";
 
1594
       ],
 
1595
       parse_name
 
1596
       [ x n; if (self hasnt general)
 
1597
            {   if (NextWord()=='princess') return 1;
 
1598
                return 0;
 
1599
            }
 
1600
            x=WordAddress(wn);
 
1601
            if (   x->0 == '/' && x->1 == '?' && x->2 == '%'
 
1602
                && x->3 == '?' && x->4 == '/')
 
1603
            {   while (wn<=parse->1 && WordAddress(wn++)<x+5) n++;
 
1604
                return n;
 
1605
            }
 
1606
            return -1;
 
1607
       ],
 
1608
       life
 
1609
       [;   Kiss: give self general; self.life = NULL;
 
1610
                "In a fairy-tale transformation, the Princess 
 
1611
                 steps back and astonishes the world by announcing 
 
1612
                 that she will henceforth be known as ~/?%?/~.";
 
1613
       ],
 
1614
  has  animate proper female;
 
1615
 
 
1616
! --------------------------------------------------------------------------
 
1617
 
 
1618
Object Museum_Cafe "Room 24 Annexe: The Museum Cafe"
 
1619
  with description
 
1620
          "Very much a self-service refreshments area, which
 
1621
           somehow cunningly continues the exhibition from the north.",
 
1622
       n_to Room24,
 
1623
  has  light;
 
1624
 
 
1625
Object -> "upright fridge"
 
1626
  with name "upright" "fridge",
 
1627
       initial "There is an upright fridge in one corner.",
 
1628
       after
 
1629
       [;  Open:
 
1630
               print
 
1631
              "On the inside of the door is a note to the effect 
 
1632
               that the pepper is a standardly-named Inform object 
 
1633
               and can be called ~green~, ~pepper~, ~green pepper~, 
 
1634
               ~pepper green~, etc.; 
 
1635
               whereas, in the case of the red tomato, ~red~ and 
 
1636
               ~tomato fried red~, etc., will not be allowed.^^";
 
1637
               <<Search self>>;
 
1638
       ],
 
1639
  has  openable container static;
 
1640
 
 
1641
Object -> -> "green pepper"
 
1642
  with name "green" "pepper",
 
1643
  has  edible;
 
1644
 
 
1645
Object -> -> "red fried tomato"
 
1646
  with name "red" "pepper",
 
1647
       parse_name
 
1648
       [ i w; w=NextWord();
 
1649
              while (w=='red' or 'fried')
 
1650
              {   w=NextWord(); i++;
 
1651
              }
 
1652
              if (w=='tomato') return i+1;
 
1653
              return 0;
 
1654
       ],
 
1655
  has  edible;
 
1656
 
 
1657
Object -> "drinks machine"
 
1658
  with name "drinks" "machine",
 
1659
       initial
 
1660
          "Next to the fridge is a drinks machine with buttons 
 
1661
           for Cola, Coffee and Tea.",
 
1662
  has  static transparent;
 
1663
Object -> -> "drinks machine button"
 
1664
  has  scenery
 
1665
 with  parse_name
 
1666
       [ i flag type;
 
1667
            for (: flag == 0: i++)
 
1668
            {   flag = 1;
 
1669
                switch(NextWord())
 
1670
                {   'button', 'for': flag = 0;
 
1671
                    'coffee': if (type == 0) { flag = 0; type = 1; }
 
1672
                    'tea':    if (type == 0) { flag = 0; type = 2; }
 
1673
                    'cola':   if (type == 0) { flag = 0; type = 3; }
 
1674
                }
 
1675
            }
 
1676
            if (type==drink.number && i==2 && type~=0 && drink in player)
 
1677
                return 0;
 
1678
            self.number=type; return i-1;
 
1679
        ],
 
1680
        number 0,
 
1681
        before
 
1682
        [; Push, SwitchOn:
 
1683
             if (self.number == 0)
 
1684
                "You'll have to say which button to press.";
 
1685
             if (parent(drink) ~= 0) "The machine's broken down.";
 
1686
             drink.number = self.number; move drink to player; itobj = drink;
 
1687
             "Whirr! The machine puts ", (a) drink, " into your 
 
1688
                 glad hands.";
 
1689
           Attack: "The machine shudders and squirts cola at you.";
 
1690
           Drink:  "You can't drink until you've worked the machine.";
 
1691
        ];
 
1692
Object  drink "drink"
 
1693
  with  parse_name
 
1694
        [ i flag type;
 
1695
            for (: flag == 0: i++)
 
1696
            {   flag = 1;
 
1697
                switch(NextWord())
 
1698
                {   'drink', 'cup', 'of': flag = 0;
 
1699
                    'coffee': if (type == 0) { flag = 0; type = 1; }
 
1700
                    'tea':    if (type == 0) { flag = 0; type = 2; }
 
1701
                    'cola':   if (type == 0) { flag = 0; type = 3; }
 
1702
                }
 
1703
            }
 
1704
            if (type ~= 0 && type ~= self.number) return 0;
 
1705
            return i-1;
 
1706
        ],
 
1707
        short_name
 
1708
        [;  print "cup of ";
 
1709
            switch (self.number)
 
1710
            { 1: print "coffee"; 2: print "tea"; 3: print "cola"; }
 
1711
            rtrue;
 
1712
        ],
 
1713
        number 0,
 
1714
        before
 
1715
        [; Drink: remove self;
 
1716
            "Ugh, that was awful. You crumple the cup and responsibly 
 
1717
             dispose of it.";
 
1718
        ];
 
1719
 
 
1720
! --------------------------------------------------------------------------
 
1721
 
 
1722
Class  WindowRoom
 
1723
  with description
 
1724
       [;  print "This is one end of a long east/west room. ";
 
1725
           if (self==window_w) "An exit leads back @00.";
 
1726
          "There appears to be no way in or out at this end.";
 
1727
       ],
 
1728
       before
 
1729
       [;  Examine, Search: ;
 
1730
           default:
 
1731
             if (inp1~=1 && noun~=0 && noun in self.far_side)
 
1732
                 print_ret (The) noun, " is on the far side of 
 
1733
                    the glass.";
 
1734
             if (inp2~=1 && second~=0 && second in self.far_side)
 
1735
                 print_ret (The) second, " is on the far side of 
 
1736
                    the glass.";
 
1737
       ],
 
1738
       after
 
1739
       [;  Look:
 
1740
             if (ggw has general) rfalse;
 
1741
             print "^The room is divided by a great glass window";
 
1742
             if (location.far_side hasnt light) " onto darkness.";
 
1743
             print ", stretching from floor to ceiling.^";
 
1744
             if (Locale(location.far_side,
 
1745
                    "Beyond the glass you can see",
 
1746
                    "Beyond the glass you can also see")~=0) ".";
 
1747
       ],
 
1748
  has  light;
 
1749
 
 
1750
WindowRoom window_w "Room 28: @01 of Window"
 
1751
  with e_to Third_Floor, w_to "The window is in your way.",
 
1752
       far_side window_e;
 
1753
 
 
1754
Object -> "plastic cup"
 
1755
  with name "plastic" "cup";
 
1756
 
 
1757
WindowRoom window_e "Room 28: @00 of Window"
 
1758
  with far_side window_w;
 
1759
 
 
1760
Key -> "bronze key"
 
1761
  with name "bronze";
 
1762
 
 
1763
Object -> "golden chalice"
 
1764
  with name "golden" "chalice" "cup" "grail" "holy";
 
1765
 
 
1766
Object ggw "great glass window"
 
1767
  with name "great" "glass" "window",
 
1768
       before
 
1769
       [ place; Examine, Search: place=location;
 
1770
               if (place.far_side hasnt light)
 
1771
                   "The other side is dark.";
 
1772
               print "The view through the window:^";
 
1773
               give self general;
 
1774
               PlayerTo(place.far_side,1); <Look>; PlayerTo(place,1);
 
1775
               give self ~general;
 
1776
               give place.far_side ~visited; rtrue;
 
1777
       ],
 
1778
       found_in window_w window_e,
 
1779
  has  scenery;
 
1780
 
 
1781
! ==========================================================================
 
1782
 
 
1783
Object roof "Museum Roof: area 33"
 
1784
  with name "trapdoor",
 
1785
       description
 
1786
          "A small trapdoor leads down from this tiled roof into the 
 
1787
           museum. The view is indescribable, which saves me some typing 
 
1788
           and you some reading, right? Yes -- this is one of those 
 
1789
           post-modern room descriptions, the kind that makes you aware 
 
1790
           you're only playing a game.",
 
1791
       d_to Third_Floor,
 
1792
  has  light;
 
1793
 
 
1794
Global status_style = 3;
 
1795
 
 
1796
Object -> "dial"
 
1797
  with name "dial",
 
1798
       initial
 
1799
          "A dial here has four settings, which control the appearance
 
1800
           of the status line drawn by the computer to indicate the
 
1801
           state of play.  Settings are: 1 - invisible; 2 - centred
 
1802
           place name only; 3 -�standard Score/Turns display;
 
1803
           4 - a compass rose of possible directions to go in.",
 
1804
       before
 
1805
       [;  SetTo:
 
1806
               if (second<1 || second>4) "There are only four settings.";
 
1807
               status_style = second; "Set.";
 
1808
       ],
 
1809
  has  static;
 
1810
 
 
1811
! --------------------------------------------------------------------------
 
1812
 
 
1813
[ Initialise;
 
1814
  location = Foyer; move samples_bag to player;
 
1815
  thedark.short_name = "An odd-smelling darkness";
 
1816
  thedark.initial = GoMothGo;
 
1817
  NormalWorld(); lookmode=2;
 
1818
  SetTime(SUNRISE-10,1);
 
1819
 
 
1820
 "^^^^^Welcome indeed to the...^";
 
1821
];
 
1822
 
 
1823
[ InScope actor;
 
1824
 
 
1825
   if (actor==martha) PlaceInScope(player);
 
1826
   if (actor==player && scope_reason==TALKING_REASON && player in booth)
 
1827
       PlaceInScope(martha);
 
1828
 
 
1829
   if (location==window_w && window_e has light)
 
1830
       ScopeWithin(window_e);
 
1831
   if (location==window_e && window_w has light)
 
1832
       ScopeWithin(window_w);
 
1833
   rfalse;
 
1834
];
 
1835
 
 
1836
[ BeforeParsing i j;
 
1837
  for (i=parse->1,j=2:j<i:j++)
 
1838
  {   wn=j-1;
 
1839
      if (NextWord()=='fly' && NextWord()=='in' && NextWord()=='amber')
 
1840
          parse-->(j*2-1) = 'fly';
 
1841
  }
 
1842
   if (genies_lamp hasnt general) return;
 
1843
   for (wn=1::)
 
1844
   {   switch(NextWordStopped())
 
1845
       {   'white': parse-->(wn*2-3) = 'black';
 
1846
           'black': parse-->(wn*2-3) = 'white';
 
1847
           -1: return;
 
1848
       }
 
1849
   }
 
1850
];
 
1851
 
 
1852
! --------------------------------------------------------------------------
 
1853
 
 
1854
Constant U_POS 28; Constant W_POS 30; Constant C_POS 31;
 
1855
Constant E_POS 32; Constant IN_POS 34;
 
1856
 
 
1857
Array printed_text table 64;
 
1858
 
 
1859
[ DrawStatusLine j posa posb width;
 
1860
  if (location==0) rfalse;
 
1861
  width = 0->33; if (width==0) width=80;
 
1862
  switch(status_style)
 
1863
  {   1: @split_window 0;
 
1864
      2: font off;
 
1865
         @split_window 1; @buffer_mode 0; @set_window 1;
 
1866
         style reverse; @set_cursor 1 1; spaces width;
 
1867
         printed_text-->0 = 64;
 
1868
         @output_stream 3 printed_text;
 
1869
         print (name) location;
 
1870
         @output_stream -3;
 
1871
         j=(width-(printed_text-->0))/2;
 
1872
         @set_cursor 1 j; print (name) location; spaces(j-1);
 
1873
         style roman;
 
1874
         @buffer_mode 1; @set_window 0; font on;
 
1875
      3: @split_window 1; @set_window 1; @set_cursor 1 1; style reverse;
 
1876
         posa = width-26; posb = width-13;
 
1877
         spaces width;
 
1878
         @set_cursor 1 2; print (name) location;
 
1879
         if (width > 76)
 
1880
         {   @set_cursor 1 posa; print "Score: ", sline1;
 
1881
             @set_cursor 1 posb; print "Moves: ", sline2;
 
1882
         }
 
1883
         if (width > 63 && width <= 76)
 
1884
         {   @set_cursor 1 posb; print sline1, "/", sline2;
 
1885
         }
 
1886
         @set_cursor 1 1; style roman; @set_window 0;
 
1887
      4: if (e_obj.door_dir~=e_to)
 
1888
         {   @split_window 1; @set_window 1; style reverse; font off;
 
1889
             @set_cursor; spaces width;
 
1890
             print "You're very disoriented in this reflected world";
 
1891
             @set_cursor 1 1; style roman; @set_window 0; font on;
 
1892
             rfalse;
 
1893
         }
 
1894
         @split_window 3; @set_window 1; style reverse; font off;
 
1895
         @set_cursor 1 1; spaces width;
 
1896
         @set_cursor 2 1; spaces width;
 
1897
         @set_cursor 3 1; spaces width;
 
1898
         @set_cursor 1 2;  print (name) location;
 
1899
         @set_cursor 1 51; print "Score: ", sline1;
 
1900
         @set_cursor 1 64; print "Moves: ", sline2;
 
1901
         if (location ~= thedark)
 
1902
         {   ! First line
 
1903
             if (location.u_to ~= 0)  { @set_cursor 1 U_POS; print "U"; }
 
1904
             if (location.nw_to ~= 0) { @set_cursor 1 W_POS; print "@@92"; }
 
1905
             if (location.n_to ~= 0)  { @set_cursor 1 C_POS; print "@@124"; }
 
1906
             if (location.ne_to ~= 0) { @set_cursor 1 E_POS; print "/"; }
 
1907
             if (location.in_to ~= 0) { @set_cursor 1 IN_POS; print "I"; }
 
1908
             ! Second line
 
1909
             if (location.w_to ~= 0)  { @set_cursor 2 W_POS; print "-"; }
 
1910
                                        @set_cursor 2 C_POS; print "o";
 
1911
             if (location.e_to ~= 0)  { @set_cursor 2 E_POS; print "-"; }
 
1912
             ! Third line
 
1913
             if (location.d_to ~= 0)  { @set_cursor 3 U_POS; print "D"; }
 
1914
             if (location.sw_to ~= 0) { @set_cursor 3 W_POS; print "/"; }
 
1915
             if (location.s_to ~= 0)  { @set_cursor 3 C_POS; print "@@124"; }
 
1916
             if (location.se_to ~= 0) { @set_cursor 3 E_POS; print "@@92"; }
 
1917
             if (location.out_to ~= 0){ @set_cursor 3 IN_POS; print "O"; }
 
1918
         }
 
1919
         @set_cursor 1 1; style roman; @set_window 0; font on;
 
1920
  }
 
1921
];
 
1922
 
 
1923
! --------------------------------------------------------------------------
 
1924
 
 
1925
Include "Grammar";
 
1926
 
 
1927
! --------------------------------------------------------------------------
 
1928
 
 
1929
[ FPXSub;
 
1930
    "You typed the floating point number ", noun/100, ".",
 
1931
    (noun%100)/10, noun%10, " (rounded off to 2 decimal places.)";
 
1932
];
 
1933
 
 
1934
[ DigitNumber n type x;
 
1935
  x = NextWordStopped(); if (x==-1) return -1; wn--;
 
1936
  if (type==0)
 
1937
  {   x = WordAddress(wn);
 
1938
      if (x->n>='0' && x->n<='9') return (x->n) - '0';
 
1939
      return -1;
 
1940
  }
 
1941
  if (x=='nought' or 'oh') { wn++; return 0; }
 
1942
  x = TryNumber(wn++); if (x==-1000 || x>=10) x=-1; return x;
 
1943
];
 
1944
[ FloatingPoint a x b w d1 d2 d3 type;
 
1945
  a = TryNumber(wn++);
 
1946
  if (a==-1000) return -1;
 
1947
  w = NextWordStopped(wn); if (w==-1) return a*100;
 
1948
  x = NextWordStopped(wn); if (x==-1) return -1; wn--;
 
1949
  if (w=='point') type=1;
 
1950
  else
 
1951
  {   if (WordAddress(wn-1)->0~='.' || WordLength(wn-1)~=1)
 
1952
          return -1;
 
1953
  }
 
1954
  d1 = DigitNumber(0,type);
 
1955
  if (d1==-1) return -1;
 
1956
  d2 = DigitNumber(1,type); d3 = DigitNumber(2,type);
 
1957
  b=d1*10; if (d2>=0) b=b+d2; else d3=0;
 
1958
  if (type==1)
 
1959
  {   x=1; while (DigitNumber(x,type)>=0) x++; wn--;
 
1960
  }
 
1961
  else wn++;
 
1962
  parsed_number = a*100 + b;
 
1963
  if (d3>=5) parsed_number++;
 
1964
  return 1;
 
1965
];
 
1966
 
 
1967
Verb "fp" * FloatingPoint -> FPX;
 
1968
 
 
1969
! --------------------------------------------------------------------------
 
1970
 
 
1971
Constant MAX_PHONE_LENGTH 30;
 
1972
Array dialled_number string MAX_PHONE_LENGTH;
 
1973
[ PhoneNumber f a l ch pp i;
 
1974
  pp=1; if (NextWordStopped()==-1) return 0;
 
1975
  do
 
1976
  {   a=WordAddress(wn-1); l=WordLength(wn-1);
 
1977
      for (i=0:i<l:i++)
 
1978
      {   ch=a->i;
 
1979
          if (ch<'0' || ch>'9')
 
1980
          {   if (ch~='-') { f=1; if (i~=0) return -1; } }
 
1981
          else
 
1982
          {   if (pp<MAX_PHONE_LENGTH)
 
1983
                  dialled_number->(pp++)=ch-'0';
 
1984
          }
 
1985
      }
 
1986
  } until (f==1 || NextWordStopped()==-1);
 
1987
  if (pp==1) return -1;
 
1988
  dialled_number->0 = pp-1;
 
1989
  return 0;
 
1990
];
 
1991
 
 
1992
[ DialPhoneSub i;
 
1993
  print "You dialled <";
 
1994
  for (i=1:i<=dialled_number->0:i++) print dialled_number->i;
 
1995
  ">";
 
1996
];
 
1997
Verb "dial"  * PhoneNumber -> DialPhone;
 
1998
 
 
1999
! --------------------------------------------------------------------------
 
2000
 
 
2001
Global assumed_key;
 
2002
[ DefaultLockSub;
 
2003
  print "(with ", (the) assumed_key, ")^"; <<Lock noun assumed_key>>;
 
2004
];
 
2005
[ DefaultUnlockSub;
 
2006
  print "(with ", (the) assumed_key, ")^"; <<Unlock noun assumed_key>>;
 
2007
];
 
2008
 
 
2009
[ DefaultKeyTest i count;
 
2010
  if (noun hasnt lockable) rfalse;
 
2011
 
 
2012
  objectloop (i in player && i ofclass Key)
 
2013
  {   count++; assumed_key = i; }
 
2014
 
 
2015
  if (count==1) rtrue; rfalse;
 
2016
];
 
2017
 
 
2018
Extend "lock" first * noun = DefaultKeyTest -> DefaultLock;
 
2019
Extend "unlock" first * noun = DefaultKeyTest -> DefaultUnlock;
 
2020
 
 
2021
! --------------------------------------------------------------------------
 
2022
 
 
2023
Constant TWELVE_HOURS 720;
 
2024
[ NumericTime hr mn word x;
 
2025
  if (hr>=24) return -1;
 
2026
  if (mn>=60) return -1;
 
2027
  x=hr*60+mn; if (hr>=13) return x;
 
2028
  x=x%TWELVE_HOURS; if (word=='pm') x=x+TWELVE_HOURS;
 
2029
  if (word~='am' or 'pm' && hr==12) x=x+TWELVE_HOURS;
 
2030
  return x;
 
2031
];
 
2032
[ MyTryNumber wordnum i j;
 
2033
  i=wn; wn=wordnum; j=NextWordStopped(); wn=i;
 
2034
  switch(j)
 
2035
  {   'twenty-five': return 25;
 
2036
      'thirty': return 30;
 
2037
      default: return TryNumber(wordnum);
 
2038
  }
 
2039
];
 
2040
[ TimeOfDay i j k x flag loop ch hr mn;
 
2041
  i=NextWord();
 
2042
  if (i=='midnight') { parsed_number=0; return 1; }
 
2043
  if (i=='midday' or 'noon') { parsed_number=TWELVE_HOURS; return 1; }
 
2044
  !   Next try the format 12:02
 
2045
  j=WordAddress(wn-1); k=WordLength(wn-1);
 
2046
  flag=0;
 
2047
  for (loop=0:loop<k:loop++)
 
2048
  {   ch=j->loop;
 
2049
      if (ch==':' && flag==0 && loop~=0 && loop~=k-1) flag=1;
 
2050
      else { if (ch<'0' || ch>'9') flag=-1; }
 
2051
  }
 
2052
  if (k<3 || k>5) flag=0;
 
2053
  if (flag==1)
 
2054
  {   for (loop=0:j->loop~=':':loop++, hr=hr*10)
 
2055
          hr=hr+j->loop-'0';
 
2056
      hr=hr/10;
 
2057
      for (loop++:loop<k:loop++, mn=mn*10)
 
2058
          mn=mn+j->loop-'0';
 
2059
      mn=mn/10;
 
2060
      j=NextWordStopped();
 
2061
      parsed_number=NumericTime(hr, mn, j);
 
2062
      if (parsed_number<0) return -1;
 
2063
      if (j~='pm' or 'am') wn--;
 
2064
      return 1;
 
2065
  }
 
2066
  !   Next the format "half past 12"
 
2067
  j=-1; if (i=='half') j=30; if (i=='quarter') j=15;
 
2068
  if (j<0) j=MyTryNumber(wn-1); if (j<0) return -1;
 
2069
  if (j>=60) return -1;
 
2070
  k=NextWordStopped();
 
2071
  if ((k=='o^clock' or 'am' or 'pm')||(k==-1))
 
2072
  {   hr=j; if (hr>12) return -1; jump TimeFound; }
 
2073
  if (k=='to' or 'past')
 
2074
  {   mn=j; hr=MyTryNumber(wn);
 
2075
      if (hr<=0)
 
2076
      {   x=NextWordStopped();
 
2077
          if (x=='noon' or 'midday') hr=12;
 
2078
          if (x=='midnight') hr=0;
 
2079
          if (hr<0) return -1;
 
2080
      }
 
2081
      if (hr>=13) return -1;
 
2082
      if (k=='to') { mn=60-mn; hr=hr-1; if (hr==-1) hr=23; }
 
2083
      wn++; k=NextWordStopped();
 
2084
      jump TimeFound;
 
2085
  }
 
2086
  hr=j; mn=MyTryNumber(--wn);
 
2087
  if (mn<0 || mn>=60) return -1;
 
2088
  wn++; k=NextWordStopped();
 
2089
 .TimeFound;
 
2090
  parsed_number = NumericTime(hr, mn, k);
 
2091
  if (parsed_number<0) return -1;
 
2092
  if (k~='pm' or 'am' or 'o^clock') wn--;
 
2093
  return 1;
 
2094
];
 
2095
 
 
2096
[ SetTheTimeSub;
 
2097
  SetTime(noun,1);
 
2098
  "The time is set to ", (PrintTime) noun, ".";
 
2099
];
 
2100
Verb "time"  * TimeOfDay -> SetTheTime;
 
2101
 
 
2102
! --------------------------------------------------------------------------
 
2103
 
 
2104
Global third;
 
2105
[ ThreefoldSub; "You do something involving ", (the) noun, ", ",
 
2106
      (the) second, " and ", (the) third, ".";
 
2107
];
 
2108
[ GhostObject x;
 
2109
  x=NounDomain(player,location,0);
 
2110
  if (x==REPARSE_CODE) return x;
 
2111
  if (x==0 or 1) return -1;
 
2112
  third = x;
 
2113
  return 0;
 
2114
];
 
2115
Verb "threefold" * noun noun GhostObject -> Threefold;
 
2116
               
 
2117
! --------------------------------------------------------------------------
 
2118
 
 
2119
[ MegaExam obj; print (a) obj, ": "; <Examine obj>; ];
 
2120
[ MegaLookSub; <Look>; LoopOverScope(MegaExam); ];
 
2121
Verb meta "megalook" *                           -> MegaLook;
 
2122
 
 
2123
! --------------------------------------------------------------------------
 
2124
 
 
2125
[ ClapSub; "You clap."; ];
 
2126
Verb "clap"   * -> Clap;
 
2127
 
 
2128
! --------------------------------------------------------------------------
 
2129
 
 
2130
Verb "magnify" * noun                          -> Magnify;
 
2131
 
 
2132
! --------------------------------------------------------------------------
 
2133
 
 
2134
Verb "alarm," * "on"      -> SwitchOn
 
2135
              * "off"     -> SwitchOff
 
2136
              * TimeOfDay -> SetTo
 
2137
              * ConTopic  -> Inv;
 
2138
 
 
2139
Verb "tc,"    * noun      -> Examine
 
2140
              * ConTopic  -> Inv;
 
2141
 
 
2142
[ Crew i;
 
2143
  switch(scope_stage)
 
2144
  {  1: rfalse;
 
2145
     2: objectloop (i has crewmember) PlaceInScope(i); rtrue;
 
2146
  }
 
2147
];
 
2148
 
 
2149
Verb "stc,"   * "where" "is" scope=Crew        -> Examine
 
2150
              * "locate" scope=Crew            -> Examine;
 
2151
 
 
2152
Verb "rc,"    * held      -> Give
 
2153
              * ConTopic  -> Inv;
 
2154
 
 
2155
[ Planet;
 
2156
  switch(NextWord())
 
2157
  {   'centauro', 'earth': return 1;
 
2158
      default: return -1;
 
2159
  }
 
2160
];
 
2161
 
 
2162
Verb "zen,"   * "scan" number "orbital"        -> Show
 
2163
              * "set" "course" "for" Planet    -> Go
 
2164
              * "speed" "standard" "by" number -> SetTo
 
2165
              * "raise" held                   -> Take
 
2166
              * "clear" held "for" "firing"    -> Drop;
 
2167
 
 
2168
! ----------------------------------------------------------------------------
 
2169