Inform - Resources - Examples

Back to List

Inventory
Complete

Plain
Coloured
Gaudy

Browsing Museum.inf

This is the complete source code of the example game Museum.inf.

0001  ! ----------------------------------------------------------------------------
0002  !   Museum 961111                   One of the standard Inform 6 example games
0003  !
0004  !                                                            created: 20.12.95
0005  !                                             translated to Inform 6: 11.11.96
0006  !
0007  !   This "game" is a compendium of solved exercises from the Designer's
0008  !   Manual.  Room numbers are section numbers within the Third Edition.
0009  !   Many of these exercises are difficult, and so is some of the code below.
0010  ! ----------------------------------------------------------------------------
0011   
0012  Constant Story "MUSEUM OF INFORM";
0013  Constant Headline
0014      "^An Interactive Companion to the Designer's Manual (Third Edition)^";
0015   
0016  !   The game is meant to be experimented with, so we always define:
0017  Constant DEBUG;
0018   
0019  Release 2;
0020  Serial "961111";
0021   
0022  Replace DrawStatusLine;
0023  Include "Parser";
0024   
0025  ! --------------------------------------------------------------------------
0026   
0027  Object samples_bag "samples bag"
0028    with description "A capacious SACK_OBJECT (see section 20).",
0029         name "samples" "bag", article "your",
0030         when_closed "Your samples bag lies on the floor.",
0031         when_open "Your samples bag lies open on the floor.",
0032    has  container open openable;
0033   
0034  Constant SACK_OBJECT = samples_bag;
0035   
0036  Include "VerbLib";
0037   
0038  ! --------------------------------------------------------------------------
0039   
0040  Attribute crewmember;
0041   
0042  Property weight 10;
0043   
0044  Class Key with name "key";
0045   
0046  ! --------------------------------------------------------------------------
0047   
0048  Object  Foyer "Foyer"
0049   has    light
0050   with   description
0051             "The foyer of the magnificent Museum of Inform. A flight of 
0052              stairs sweeps upward to Chapters V and VI, and corridors 
0053              fan out on this level into Chapter IV. These run:^
0054              ^  north into Room 10 (the Halls of Sense and Direction),
0055              ^  south along Corridor 12 (doors) to Room 13 (switches),
0056              ^  @00 to Room 11 (the Wonderful World of Containers)
0057              ^  and @01 to Room 14 (which houses larger exhibits).^^
0058              (And a plain ladder descends into the basement; you can also 
0059               step out onto a balcony.)",
0060          e_to Room11, u_to Second_Floor, n_to Room10,
0061          s_to Corridor12, w_to Room14,
0062          d_to basement, out_to balcony;
0063   
0064  Object -> "map"
0065    with name "map" "ground" "floor",
0066         initial "A map of the ground floor is embossed in one wall.",
0067         description
0068         [;  font off;
0069             print
0070            "^+------------------------------------------+
0071             ^|                              (mirror)    |
0072             ^|   Weights      Room 10  ---  Room 10a    |
0073             ^|    Room         senses      directions   |
0074             ^|      |            |                      |
0075             ^|   Room 14 ---   Foyer   ---   Room 11    |
0076             ^|  (changing  (you are here)   containers  |
0077             ^|  character)       |                      |
0078             ^|                   |                      |
0079             ^|   Room 15 --- Corridor 12                |
0080             ^|  (MS room)  (door, curator)              |
0081             ^|   (Bible)         |                      |
0082             ^|             Switches Hall 13             |
0083             ^|                (chasm)                   |
0084             ^|                   |                      |
0085             ^|           Far Side of Room 13            |
0086             ^+------------------------------------------+^";
0087             font on;
0088         ],
0089    has  static;
0090   
0091  ! --------------------------------------------------------------------------
0092   
0093  Object basement "Museum Basement"
0094    with u_to Foyer,
0095         description
0096            "Once Room 17, this space has been abandoned by the curators,
0097             who have simply sprayed its walls with moth-repellent and
0098             abandoned it.",
0099         before
0100         [;  Smell: "Napthalene.";
0101         ];
0102   
0103  ! --------------------------------------------------------------------------
0104   
0105  Object Room10 "Hall of Senses"
0106    with description
0107            "This is Room 10, north of the foyer. If you try going further 
0108             north, a string will be printed instead. The exit to the @00 
0109             has a routine attached, and randomly leads either to the 
0110             Directions Room or back to the foyer.",
0111         s_to Foyer,
0112         n_to "This string is the ~n_to~ value for this room.",
0113         e_to
0114         [;  if (random(2)==1) return Foyer; return Room10a; ],
0115    has  light;
0116   
0117  Object -> "TRAP lever"
0118    with name "trap" "lever",
0119         before
0120         [;  Pull, Push:
0121                 if (self has on) <<SwitchOff self>>;
0122                 <<SwitchOn self>>;
0123         ],
0124         after
0125         [;  SwitchOn: move orange_cloud to location;
0126                "Clunk! An orange cloud suddenly descends upon you.";
0127             SwitchOff: remove orange_cloud;
0128                "Click! The orange cloud vanishes.";
0129         ],
0130    has  switchable static;
0131   
0132  Object -> "gold watch"
0133    with name "gold" "watch",
0134         description "The watch has no hands, oddly.",
0135         react_before
0136         [;  Listen: if (noun==0 or self) "The watch ticks loudly."; ];
0137   
0138  Object -> "sprig of lavender"
0139    with name "sprig" "of" "lavender",
0140         react_before
0141         [;  Smell: if (noun==0 or self) "Lavender-perfume. Ahh!"; ];
0142   
0143  Object orange_cloud "orange cloud"
0144    with name "orange" "cloud",
0145         react_before
0146         [;  Look: "You can't see for the orange cloud surrounding you.";
0147             Go, Exit: "You wander round in circles, choking.";
0148             Smell: if (noun==0 or self) "Cinnamon? No, nutmeg.";
0149         ],
0150    has  scenery;
0151   
0152  ! --------------------------------------------------------------------------
0153  !   For east-west reflection
0154  ! --------------------------------------------------------------------------
0155   
0156  Lowstring east_str "east"; Lowstring west_str "west";
0157  [ NormalWorld; string 0 east_str; string 1 west_str;
0158    e_obj.door_dir = e_to; w_obj.door_dir = w_to;
0159  ];
0160  [ ReversedWorld; string 0 west_str; string 1 east_str;
0161    w_obj.door_dir = e_to; e_obj.door_dir = w_to;
0162  ];
0163   
0164  Object Room10a "Hall of Directions"
0165    with name "mirror",
0166         description
0167            "An annexe to Room 10: the main exit is back @01, and there's a 
0168             curiously misty mirror on the north wall. Also, there's an exit 
0169             in the fourth, ~hyper~ dimension (which is only visible in the 
0170             weird geometry of this room).",
0171         initial
0172         [;  move hyper to compass; StartDaemon(hyper);
0173         ],
0174         w_to Room10,
0175         n_to
0176         [;  print "Walking through the mirror is confusing...^";
0177             if (self has general) NormalWorld(); else ReversedWorld();
0178             if (self has general) give self ~general; else give self general;
0179             <<Look>>;
0180         ],
0181         in_to [; print "Amazing! Your body corkscrews as you pass.^";
0182                  return Room11; ],
0183    has  light;
0184   
0185  Object hyper "hyper-dimensional direction"
0186    with name "hyper" "fourth" "dimension", article "the", door_dir in_to,
0187         daemon
0188         [;  if (location ~= Room10a) { remove self; StopDaemon(self); }
0189         ],
0190    has  scenery;
0191   
0192  ! --------------------------------------------------------------------------
0193   
0194  Object Room11 "Wonderful World of Containers"
0195    with description
0196            "This is Room 11, @00 of the foyer. You notice a typical piece 
0197             of scenery which turns out to be a supporter: a mantelpiece.",
0198         w_to Foyer,
0199    has  light;
0200   
0201  Object -> "bearded psychiatrist"
0202    with name "bearded" "doctor" "psychiatrist" "psychologist" "shrink",
0203         initial "A bearded psychiatrist has you under observation.",
0204         life
0205         [;  "He is fascinated by your behaviour, but makes no attempt to 
0206              interfere with it.";
0207         ],
0208         react_after
0209         [;  Insert: print "~Subject puts ", (a) noun, " in ", (the) second,
0210                        ". Interesting.~^";
0211             PutOn:  print "~Subject puts ", (a) noun, " in ", (the) second,
0212                        ". Interesting.~^";
0213         ],
0214         react_before
0215         [;  Take, Remove: print "~Subject feels lack of ", (the) noun,
0216                 ". Suppressed Oedipal complex? Mmm.~^";
0217         ],
0218    has  animate;
0219   
0220  Object -> "mantelpiece"
0221    with name "mantel" "mantle" "piece" "mantelpiece"
0222    has  scenery supporter;
0223   
0224  Object -> "green ball" with name "green" "ball";
0225  Object -> "red cone" with name "red" "cone";
0226  Object -> "blue pyramid" with name "blue" "pyramid";
0227   
0228  Object -> "plain shopping bag (which can only hold 2 things)"
0229    with name "plain" "shopping" "bag", capacity 2,
0230    has  container open;
0231   
0232  Object -> "glass box with a lid" with name "glass" "box" "with" "lid"
0233    has  container transparent openable open;
0234  Object -> "steel box with a lid" with name "steel" "box" "with" "lid"
0235    has  container openable open;
0236   
0237  Key -> bolted_key "bolted key" with name "bolted";
0238   
0239  Object -> "toothed bag"
0240    with name "toothed" "bag",
0241         description "A capacious bag with a toothed mouth.",
0242         before
0243         [; LetGo: "The bag defiantly bites itself 
0244                    shut on your hand until you desist.";
0245            Close: "The bag resists all attempts to close it.";
0246         ],
0247         after
0248         [; Receive:
0249                   "The bag wriggles hideously as it swallows ",
0250                   (the) noun, ".";
0251         ],
0252    has  container open;
0253   
0254  Object -> "bolted cupboard"
0255    with name "bolted" "cupboard",
0256         describe
0257         [; if (self hasnt open)
0258                "^A pretty typical shut cupboard is bolted to one wall.";
0259            "^Bolted up on one wall is an open cupboard.";
0260         ],
0261         with_key bolted_key
0262    has  locked container openable lockable static;
0263   
0264  Object -> "portable television set"
0265    with name "tv" "television" "set" "portable",
0266         initial "A portable television set has two sub-objects attached: 
0267                  a power button and a screen.",
0268         before
0269         [;  SwitchOn: <<SwitchOn power_button>>;
0270             SwitchOff: <<SwitchOff power_button>>;
0271             Examine: <<Examine screen>>;
0272         ],
0273    has  transparent;
0274  Object -> -> power_button "power button"
0275    with name "power" "button" "switch",
0276         after
0277         [;  SwitchOn, SwitchOff: <<Examine screen>>;
0278         ],
0279    has  switchable;
0280  Object -> -> screen "television screen"
0281    with name "screen",
0282         before
0283         [;  Examine: if (power_button hasnt on) "The screen is black.";
0284                 "The screen writhes with a strange Japanese cartoon.";
0285         ];
0286   
0287  Object -> "macrame bag"
0288    with name "macrame" "bag" "string" "net" "sack",
0289         react_before
0290         [;  Examine, Search, Listen, Smell: ;
0291             default:
0292                 if (inp1>1 && inp1 in self)
0293                     print_ret (The) inp1, " is tucked away in the bag.";
0294                 if (inp2>1 && inp2 in self)
0295                     print_ret (The) inp2, " is tucked away in the bag.";
0296         ],
0297         describe
0298         [;  print "^A macrame bag hangs from the ceiling, shut tight";
0299             if (child(self)==0) ".";
0300             print ". Inside you can make out ";
0301             WriteListFrom(child(self), ENGLISH_BIT); ".";
0302         ],
0303    has  container transparent static;
0304  Object -> -> "music box"
0305    with name "music" "box" "musical",
0306         description "Attractively lacquered.",
0307         react_before
0308         [;  Listen: if (noun==0 or self)
0309                "The musical box chimes some Tchaikovsky."; ];
0310   
0311  ! --------------------------------------------------------------------------
0312   
0313  Object Corridor12 "Corridor 12"
0314    with description
0315            "Runs south of the foyer. A side exit leads @01 to Room 15, 
0316             the manuscripts room.",
0317         n_to Foyer, s_to Oak_Door, w_to Room15,
0318    has  light;
0319   
0320  Object -> "sinister curator"
0321    with name "sinister" "curator",
0322         initial
0323         [;  if (self hasnt general)
0324                "A sinister curator leans against the wall, asleep.";
0325            "The curator is here, casting menacing looks.";
0326         ],
0327         daemon
0328         [ i p j n k;
0329             if (random(3)~=1 || self hasnt general) rfalse;
0330             p=parent(self);
0331             objectloop (i in compass)
0332             {   j=p.(i.door_dir);
0333                 if (ZRegion(j)==1 && j hasnt door) n++;
0334             }
0335             if (n==0) rfalse;
0336             k=random(n); n=0;
0337             objectloop (i in compass)
0338             {   j=p.(i.door_dir);
0339                 if (ZRegion(j)==1 && j hasnt door) n++;
0340                 if (n==k)
0341                 {   move self to j;
0342                     if (p==location) "^The curator stalks away.";
0343                     if (j==location) "^The curator stalks in.";
0344                     rfalse;
0345                 }
0346             }
0347         ],
0348         orders
0349         [;  if (self hasnt general) "The curator only snores.";
0350            "He raises a skeletal finger to his lips. ~Shh!~";
0351         ],
0352         life
0353         [;  WakeOther:
0354                 if (self hasnt general)
0355                 {   give self general; move self to Foyer;
0356                    "He wakes and rouses to his feet, pushes past you 
0357                     and stalks away.";
0358                 }
0359             default: "He rears back with disdain.";
0360         ],
0361    has  animate;
0362   
0363  Object Oak_Door "oaken door"
0364    with name "oak" "door" "oaken",
0365         description "Despite appearances, there is no key to this door.",
0366         door_dir
0367         [; if (location==Corridor12) return s_to; return n_to; ],
0368         door_to
0369         [; if (location==Corridor12) return Room13; return Corridor12; ],
0370         describe
0371         [; if (self has open) "^The oaken door stands open.";
0372            if (self hasnt locked) "^The corridor ends in an oaken door.";
0373         ],
0374         found_in  Corridor12  Room13
0375    has  static door openable lockable;
0376   
0377  ! --------------------------------------------------------------------------
0378   
0379  Object Room15 "Manuscripts Room"
0380    with description
0381            "This is Room 15, adjoining a corridor to the @00.",
0382         e_to Corridor12,
0383    has  light;
0384   
0385  Object -> "black Tyndale Bible"
0386    with name "bible" "black" "book",
0387         initial "A black Bible rests on a spread-eagle lectern.",
0388         description "A splendid foot-high Bible, which must have survived 
0389             the burnings of 1520.",
0390         before
0391         [ w x; Consult:
0392                 wn = consult_from; w = NextWord();
0393                 switch(w)
0394                 {   'matthew': x="Gospel of St Matthew";
0395                     'mark': x="Gospel of St Mark";
0396                     'luke': x="Gospel of St Luke";
0397                     'john': x="Gospel of St John";
0398                     default: "There are only the four Gospels.";
0399                 }
0400                 if (consult_words==1)
0401                     "You read the ", (string) x, " right through.";
0402                 w = TryNumber(wn);
0403                 if (w==-1000)
0404                     "I was expecting a chapter number in the ",
0405                               (string) x, ".";
0406                 "Chapter ", (number) w, " of the ", (string) x,
0407                       " is too sacred for you to understand now.";
0408         ];
0409   
0410  ! --------------------------------------------------------------------------
0411   
0412  Object Room13 "Switches Hall"
0413    with description
0414            "This is Room 13, at the south end of a long corridor leading 
0415             north. Progress further south is blocked by a chasm.",
0416         n_to Oak_Door, s_to PlankBridge,
0417    has  light;
0418   
0419  Object -> "Gotham City searchlight"
0420    with name "gotham" "city" "search" "light" "template" "searchlight",
0421         article "the",
0422         description "It has some kind of template on it.",
0423         when_on "The old city searchlight shines out a bat against 
0424                  the alabaster ceiling of the Museum.",
0425         when_off "The old Gotham city searchlight has been lovingly 
0426                  restored and housed here."
0427    has  switchable static;
0428   
0429  Object -> "basement light switch"
0430    with name "basement" "light" "switch",
0431         after
0432         [;  SwitchOn: give basement light; "Click!";
0433             SwitchOff: give basement ~light; "Click!";
0434         ],
0435    has  switchable static;
0436   
0437  Object -> PlankBridge "plank bridge"
0438    with description "Extremely fragile and precarious.",
0439         name "precarious" "fragile" "wooden" "plank" "bridge",
0440         when_open
0441             "A precarious plank bridge spans the chasm.",
0442         door_to
0443         [;  if (children(player)~=0)
0444              {   deadflag=1;
0445                 "You step gingerly across the plank, which bows under 
0446                  your weight. But your meagre possessions are the straw 
0447                  which breaks the camel's back! There is a horrid crack...";
0448              }
0449              print "You step gingerly across the plank, grateful that 
0450                     you're not burdened.^";
0451             if (location==Room13) return FarSide; return Room13;
0452         ],
0453         door_dir
0454         [;  if (location==Room13) return s_to; return n_to;
0455         ],
0456         found_in Room13 FarSide,
0457    has  static door open;
0458   
0459  Object FarSide "Far Side of Chasm in Room 13"
0460    with description
0461            "This side of the chasm is dull and dusty after all.",
0462         n_to PlankBridge,
0463    has  light;
0464   
0465  ! --------------------------------------------------------------------------
0466   
0467  Object Room14 "Large Exhibits Room"
0468    with description
0469            "This is Room 14, @01 of the foyer, which gives onto the Weights 
0470             Room to the north.",
0471         e_to Foyer, n_to Weights_Room,
0472    has  light;
0473   
0474  Object -> "hypnotic portrait"
0475    with name "hypnotic" "portrait" "warthog" "picture" "of" "hog",
0476         initial "A somewhat hypnotic full-length portrait of a warthog hangs 
0477             on the wall.",
0478         before
0479         [;  Examine: <Examine hog>; print "^...and somehow, so do you...^";
0480                 ChangePlayer(hog); <<Look>>;
0481         ],
0482    has  static;
0483   
0484  Object -> "Louis XV chair"
0485    with name "louis" "xv" "quinze" "chair",
0486         initial "A valuable Louis XV chair takes pride of place.",
0487    has  enterable supporter;
0488   
0489  Object -> car "little red car"
0490    with name "little" "red" "car" "kar1",
0491         description "Large enough to sit inside. Among the controls is a 
0492                   prominent on/off switch. The numberplate is KAR 1.",
0493         when_on  "The red car sits here, its engine still running.",
0494         when_off "A little red car is parked here.",
0495         before
0496         [; PushDir: AllowPushDir(); rtrue;
0497            Go: if (car has on) { Achieved(1); "Brmm! Brmm!"; }
0498                print "(The ignition is off at the moment.)^";
0499         ],
0500         after
0501         [; PushDir: "The car rolls very slowly as you push it.";
0502         ],
0503    has  switchable enterable static container open;
0504   
0505  Object -> -> "small note"
0506    with name "small" "note",
0507         description
0508             "  !!!! FROBOZZ MAGIC CAR COMPANY !!!!^
0509             ^Hello, Driver!^
0510             ^Instructions for use:^
0511             ^Switch on the ignition and off you go!^
0512             ^Warranty:^
0513             ^This car is guaranteed against all defects for a period of 
0514              76 milliseconds from date of purchase or until used, 
0515              whichever comes first.^
0516             ^Good Luck!";
0517   
0518  Object -> "Giant"
0519    with name "giant",
0520         initial "A Giant is here. (And you know the old legend... push a 
0521             Giant, become a Giant!)",
0522         before
0523         [;  Push: ChangePlayer(self); <<Look>>;
0524             Take: rtrue;
0525         ],
0526         number 0,
0527         orders
0528         [;  if (player==self)
0529             {   if (actor~=self)
0530                    "You only become tongue-tied and gabble.";
0531                 if (action==##Push && noun==selfobj)
0532                 {   ChangePlayer(selfobj); <<Look>>; }
0533                 rfalse;
0534             }
0535             Attack: "The Giant looks at you with doleful eyes. 
0536                      ~Me not be so bad!~";
0537             default: "The Giant is unable to comprehend your instructions.";
0538         ],
0539    has  animate;
0540   
0541   
0542  ! --------------------------------------------------------------------------
0543   
0544  Object "Caldera"
0545    with description
0546            "An old volcanic crater of mud and ash, from which there is 
0547             nowhere to go.",
0548    has  light;
0549   
0550  Object -> hog "Warthog"
0551    with name "wart" "hog" "warthog",
0552         description "Muddy, sniffing and grunting.",
0553         number,
0554         orders
0555         [;  if (player~=self || actor~=self) rfalse;
0556   
0557             ! So now we have just the case where the player
0558             ! is currently the warthog, ordering himself about:
0559   
0560             Go, Look, Examine, Eat, Smell, Taste, Touch: rfalse;
0561             default: "Warthogs can't do anything as tricky as that!";
0562         ],
0563    has  animate proper;
0564   
0565  Object -> "red berry"
0566    with name "red" "berry" "magic",
0567         initial "A magic red berry is half-uncovered in the mud.",
0568         before
0569         [;  Smell, Taste, Touch:
0570                 print "The blood-smell of the berry brings you back, 
0571                      back...^";
0572                  ChangePlayer(selfobj); <<Look>>;
0573         ];
0574   
0575  ! --------------------------------------------------------------------------
0576   
0577  Constant CARRYING_STRENGTH = 500;
0578  Constant HEAVINESS_THRESHOLD = 100;
0579   
0580  Object Weights_Room "Weights Room"
0581    with description
0582            "This is an annexe, south of Room 14. In here (though nowhere 
0583             else) objects have given weights, and 
0584             you can carry only a limited total weight. (Items from elsewhere 
0585             in the museum all weigh 10 zobs, regardless of what they are.)
0586             The longer you carry heavy objects, the more tired you become,
0587             until you're forced to drop them; your strength recovers once
0588             you're carrying only a light load.",
0589         initial [; weight_monitor.activate(); ],
0590         s_to Room14,
0591    has  light;
0592   
0593  Object -> "feather" with name "feather", weight 1;
0594  Object -> "iron anvil" with name "iron" "anvil", article "an", weight 300;
0595  Object -> "five-zob weight" with name "five" "zob" "weight", weight 5;
0596  Object -> "ten-zob weight" with name "ten" "zob" "weight", weight 10;
0597  Object -> "twenty-zob weight" with name "twenty" "zob" "weight", weight 20;
0598  Object -> "fifty-zob weight" with name "fifty" "zob" "weight", weight 50;
0599  Object -> "hundred-zob weight" with name "hundred" "zob" "weight", weight 100;
0600   
0601  [ WeightOf obj t i;
0602     t = obj.weight;
0603     objectloop (i in obj) t = t + WeightOf(i);
0604     return t;
0605  ];
0606   
0607  Object weight_monitor
0608    with
0609         players_strength,
0610         warning_level 5,
0611   
0612         activate
0613         [;  self.players_strength = CARRYING_STRENGTH; StartDaemon(self);
0614         ],
0615         daemon
0616         [ w s b bw;
0617              if (location ~= Weights_Room) { StopDaemon(self); return; }
0618   
0619              s = self.players_strength
0620                  - WeightOf(player) + HEAVINESS_THRESHOLD;
0621              if (s<0) s=0; if (s>CARRYING_STRENGTH) s=CARRYING_STRENGTH;
0622              self.players_strength = s;
0623   
0624              if (s==0)
0625              {   bw=-1;
0626                  objectloop(b in player)
0627                      if (WeightOf(b) > bw) { bw = WeightOf(b); w=b; }
0628                  self.players_strength = self.players_strength + bw;
0629                  print "^Exhausted with carrying so much, you decide 
0630                      to discard ", (the) w, ": "; <<Drop w>>;
0631              }
0632   
0633              w=s/100; if (w==self.warning_level) return;
0634   
0635              self.warning_level = w;
0636              switch(w)
0637              {   3: "^You are feeling a little tired.";
0638                  2: "^You possessions are weighing you down.";
0639                  1: "^Carrying so much weight is wearing you out.";
0640                  0: "^You're nearly exhausted enough to drop everything
0641                       at an inconvenient moment.";
0642              }
0643         ];
0644   
0645  ! --------------------------------------------------------------------------
0646   
0647  Constant SUNRISE  360;  ! i.e., 6 am
0648  Constant SUNSET  1140;  ! i.e., 7 pm
0649  Global day_state = 2;
0650   
0651  Object balcony "Balcony"
0652    with description
0653         [;  print "An open-air balcony on the cliffside wall of the 
0654                 cathedral-like Museum, hundreds of feet above ";
0655             if (day_state==1) "sunlit plains of farms and settlements.";
0656             "a darkling plain. Dim light from the walls above is 
0657              the only beacon in this vast night.";
0658         ],
0659         in_to Foyer,
0660         cant_go "The only way is back inside.",
0661         each_turn
0662         [ f;
0663             if (the_time >= SUNRISE && the_time < SUNSET) f=1;
0664             if (day_state == f) return;
0665             if (day_state==2) { day_state = f; return; }
0666             day_state = f;
0667             if (f==1) "^The sun rises, illuminating the landscape!";
0668           "^As the sun sets, the landscape is plunged into darkness.";
0669         ],
0670    has  light;
0671   
0672  Object -> "giant clock"
0673    with name "giant" "clock" "face" "clockface" "clock-face",
0674         before
0675         [;  Examine: "According to the giant clockface on the wall 
0676                 above, it is now ", the_time/60, ":", (the_time%60)/10,
0677                 the_time%10, ".";
0678             default: "The giant clock-face is too high above you.";
0679         ],
0680         react_after [; Look: new_line; <Examine self>; ],
0681    has  static concealed;
0682   
0683  Object -> moth "moth"
0684    with name "moth",
0685         initial "A catchable moth flits about.";
0686   
0687  [ GoMothGo;
0688     if (moth in player)
0689     {   remove moth;
0690        "As your eyes try to adjust, you feel a ticklish sensation 
0691         and hear a tiny fluttering sound.";
0692     }
0693  ];
0694   
0695  Object -> "Commander Data"
0696    with name "data" "commander",
0697         orders
0698         [; "~I regret that I am only here to make an example work elsewhere. 
0699              Please proceed upstairs to 10 Forward to see.~";
0700         ],
0701    has  proper animate crewmember;
0702   
0703  ! ==========================================================================
0704   
0705  Object Second_Floor "Mezzanine"
0706    with description
0707            "Halfway up the marble staircase of the building, a second floor 
0708             mezzanine which leads south into Grammar Hall (an extension 
0709             purpose-built for the Room 16 exhibition).",
0710         d_to Foyer,
0711         s_to Grammar_Hall,
0712         u_to Third_Floor,
0713    has  light;
0714   
0715  Object -> "map"
0716    with name "map" "mezzanine" "level",
0717         initial "A map of the mezzanine level is embossed in one wall.",
0718         description
0719         [;  font off;
0720             print
0721            "^+------------------------------------------+
0722             ^|                                          |
0723             ^|                                          |
0724             ^|                                          |
0725             ^|                                          |
0726             ^|               Mezzanine                  |
0727             ^|             (you are here)               |
0728             ^|                   |                      |
0729             ^|                   |                      |
0730             ^|             Grammar Hall 16              |
0731             ^|       (telepathy, clock)                 |
0732             ^|       (Charlotte, Dan)   --- Ten Forward |
0733             ^|                   |         (replicator) |
0734             ^|               Liberator     (computer)   |
0735             ^|                Bridge       (tricorder)  |
0736             ^|                 (Zen)                    |
0737             ^+------------------------------------------+^";
0738             font on;
0739         ],
0740    has  static;
0741   
0742  Object -> "Room 16 exhibition leaflet"
0743    with name "leaflet" "exhibition" "guide" "room" "sixteen",
0744         initial "An exhibition leaflet has fallen to the floor.",
0745         description
0746            "Among the rare & fascinating exhibits in Room 16 are:...^^
0747             Telekinetic (and telepathic) Martha. In the telepathy
0748             booth, you can speak to her as though she were in Room 16
0749             with you -- but she's not, she is far away. Tell her to
0750             ~look~ to find out where, and you can also ask her to give
0751             you things (by telekinesis).^^
0752             Charlotte, who is playing Simon Says. She'll obey
0753             instructions you give as long as you preface it with
0754             ~simon says~. (Though she only knows how to wave, or how to
0755             clap many times (just tell her a number).)^^
0756             Dyslexic Dan knows how to take and drop things and how to
0757             perform an inventory, but unfortunately confuses Take and
0758             Drop orders.^^
0759             The alarm clock can be told ~on~, ~off~ or a time of day
0760             (to set its alarm to).";
0761             
0762  ! --------------------------------------------------------------------------
0763   
0764  Object Grammar_Hall "Grammar Hall"
0765    has  light,
0766    with description
0767            "The main exhibit on the second floor: Room 16, south of the 
0768             mezzanine. A Jeffreys Tube runs @00 into a Star Trek: The
0769             Next Generation room, while a hexagonal corridor to the south
0770             leads to the bridge of the spaceship ~Liberator~.",
0771         n_to Second_Floor, e_to Star_Trek, s_to Blakes_Seven;
0772   
0773  Object -> booth "telepathy booth"
0774    with name "booth" "telepathy",
0775         initial
0776            "A telepathy booth stands invitingly open: 
0777             ~Talk To Telekinetic Martha~.",
0778    has  enterable static;
0779   
0780  Object -> "Charlotte"
0781    with name "charlotte" "charlie" "chas",
0782         number 0,
0783         grammar
0784         [;  give self ~general;
0785             wn=verb_wordnum;
0786             if (NextWord()=='simon' && NextWord()=='says')
0787             {   give self general;
0788                 verb_wordnum=verb_wordnum+2;
0789             }
0790             self.number=TryNumber(verb_wordnum);
0791             if (self.number~=-1000)
0792             {    action=##Clap; noun=0; second=0; rtrue; }
0793         ],
0794         orders
0795         [ i;  if (self hasnt general) "Charlotte sticks her tongue out.";
0796             WaveHands: "Charlotte waves energetically.";
0797             Clap: if (self.number==0) "Charlotte folds her arms.";
0798                   for (i=0:i<self.number:i++)
0799                   {   print "Clap! ";
0800                       if (i==100)
0801                           print "(You must be regretting this by now.) ";
0802                       if (i==200)
0803                           print "(What a determined girl she is.) ";
0804                   }
0805                   if (self.number>100)
0806                       "^^Charlotte's a bit out of breath now.";
0807                  "^^~Easy!~ says Charlotte.";
0808             default: "~Don't know how,~ says Charlotte.";
0809         ],
0810         initial "Charlotte wants to play Simon Says.",
0811    has  animate female proper crewmember;
0812   
0813  Object -> "Dyslexic Dan"
0814    with name "dan" "dyslexic",
0815         grammar
0816         [;  if (verb_word == 'take') { verb_wordnum++; return 'drop'; }
0817             if (verb_word == 'drop') { verb_wordnum++; return 'take'; }
0818         ],
0819         orders
0820         [;
0821             Take: "~What,~ says Dan, ~ you want me to take ",
0822                       (the) noun, "?~";
0823             Drop: "~What,~ says Dan, ~ you want me to drop ",
0824                       (the) noun, "?~";
0825             Inv: "~That I can do,~ says Dan. ~I'm empty-handed.~";
0826             default: "~Don't know how,~ says Dan.";
0827         ],
0828         initial "Dyslexic Dan is here.",
0829    has  animate proper crewmember;
0830   
0831  [ PrintTime x;
0832    print (x/60), ":", (x%60)/10, (x%60)%10;
0833  ];
0834   
0835  Object -> "alarm clock"
0836    with name "alarm" "clock", article "an",
0837         number 480,
0838         description
0839         [;  print "The alarm is ";
0840             if (self has general) print "on, "; else print "off, but ";
0841             "the clock reads ", (PrintTime) the_time,
0842             " and the alarm is set for ", (PrintTime) self.number, ".";
0843         ],
0844         react_after
0845         [;  Inv:  if (self in player)   { new_line; <<Examine self>>; }
0846             Look: if (self in location) { new_line; <<Examine self>>; }
0847         ],
0848         daemon
0849         [;  if (the_time >= self.number && the_time <= self.number+3
0850                 && self has general) "^Beep! Beep! The alarm goes off.";
0851         ],
0852         grammar
0853         [;  return 'alarm,';
0854         ],
0855         orders
0856         [;  SwitchOn: give self general; StartDaemon(self); "~Alarm set.~";
0857             SwitchOff: give self ~general; StopDaemon(self);
0858                 "~Alarm cancelled.~";
0859             SetTo:   self.number=noun; <<Examine self>>;
0860             default: "~Commands are on, off or a time of day only, pliz.~";
0861         ],
0862         life
0863         [;  Ask, Answer, Tell:
0864             "[Try ~clock, something~ to address the clock.]";
0865         ],
0866    has  talkable;
0867   
0868  ! --------------------------------------------------------------------------
0869   
0870  Object Blakes_Seven "Spaceship Liberator: Bridge"
0871    has  light,
0872    with description
0873            "The great serried bridge of the alien spaceship Liberator,
0874             captured by Blake's group of revolutionary criminals on the
0875             run from the oppressive Earth Federation.  (Don't worry --
0876             it's just a convincing replica, and the museum still lies
0877             back north.)",
0878         n_to Grammar_Hall;
0879   
0880  Object -> "informative plaque"
0881    with name "informative" "plaque",
0882         article "an",
0883         description
0884            "[Among the commands which Zen was often given by the hard-pressed
0885             Liberator crew were:^^
0886             zen, scan 360 orbital^
0887             zen, speed standard by six^
0888             zen, clear the neutron blasters for firing^
0889             zen, raise the force wall^
0890             zen, set course for centauro]",
0891    has  static;
0892   
0893  Object -> "Zen"
0894    with name "zen" "flight" "computer",
0895         initial
0896            "Square lights flicker unpredictably across a hexagonal fascia 
0897             on one wall, indicating that the flight computer Zen is on-line.",
0898         grammar
0899         [;  return -'zen,';
0900         ],
0901         orders
0902         [;  Show: "The main screen shows a starfield, 
0903                    turning through ", noun, " degrees.";
0904             Go:  "~Confirmed.~  The ship turns to a new bearing.";
0905             SetTo: if (noun==0) "~Confirmed.~  The ship comes to a stop.";
0906                 if (noun>12) "~Standard by ", (number) noun,
0907                              " exceeds design tolerances.~";
0908                 "~Confirmed.~  The ship's engines step to 
0909                  standard by ", (number) noun, ".";
0910             Take: if (noun~=force_wall) "~Please clarify.~";
0911                  "~Force wall raised.~";
0912             Drop: if (noun~=blasters)   "~Please clarify.~";
0913                "~Battle-computers on line. 
0914                  Neutron blasters cleared for firing.~";
0915             NotUnderstood: "~Language banks unable to decode.~";
0916             default: "~Information. That function is unavailable.~";
0917         ],
0918    has  talkable proper static;
0919  Object -> -> force_wall "force wall"     with name "force" "wall" "shields";
0920  Object -> -> blasters "neutron blasters" with name "neutron" "blasters";
0921   
0922  ! --------------------------------------------------------------------------
0923   
0924  Object "Captain Picard"
0925    with name "captain" "picard",
0926    has  proper animate crewmember;
0927   
0928  Object Star_Trek "10 Forward"
0929    has  light,
0930    with description
0931            "The starswept observation lounge forward of deck 10
0932             of the Starship Enterprise, where many milkshakes have
0933             been consumed in crisis situations. (It's only a replica,
0934             of course, and the museum lies back @01.)",
0935         w_to Grammar_Hall;
0936   
0937  Object -> "informative plaque"
0938    with name "informative" "plaque",
0939         article "an",
0940         description
0941            "[The computer, called just ~computer~, is useful for locating
0942             crew-members: try ~computer, where is commander data~, or
0943             ~...captain picard~, or any of the other people who can be
0944             found in the Museum.^^
0945             The tricorder will scan something if you tell it the name of
0946             whom or what you wish to scan.^^
0947             The replicator is a superior drinks machine: for instance,
0948             Captain Picard is fond of saying ~replicator, tea earl grey~.
0949             There's also brandy and distilled water.]",
0950    has  static;
0951   
0952  Object -> "computer"
0953    with name "computer",
0954         initial "The computer, of course, always responds to your voice here.",
0955         grammar
0956         [;  return 'stc,';
0957         ],
0958         orders
0959         [;  Examine:
0960                 if (parent(noun)==0)
0961                     "~", (name) noun,
0962                     " is no longer aboard this demonstration game.~";
0963                 "~", (name) noun, " is in ", (name) parent(noun), ".~";
0964             default: "The computer's only really good for locating the crew.";
0965         ],
0966         life
0967         [;  Ask, Answer, Tell: "The computer is too simple.";
0968         ],
0969    has  talkable static;
0970   
0971  Object -> "tricorder"
0972    with name "tricorder",
0973         grammar
0974         [;  return 'tc,';
0975         ],
0976         orders
0977         [;  Examine: if (noun==player) "~You radiate life signs.~";
0978                 print "~", (The) noun, " radiates ";
0979                 if (noun hasnt animate) print "no ";
0980                "life signs.~";
0981             default: "The tricorder bleeps. It can only accept commands 
0982                 ~tricorder, ~.";
0983         ],
0984         life
0985         [;  Ask, Answer, Tell: "The tricorder is too simple.";
0986         ],
0987    has  talkable;
0988   
0989  Object -> "replicator"
0990    with name "replicator",
0991         initial
0992            "A replicator (i.e. Star Trek drinks machine) occupies a niche 
0993             in one wall.",
0994         grammar
0995         [;  return 'rc,';
0996         ],
0997         orders
0998         [;  Give:
0999                 "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   ~ : 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 
1110             (go out onto the Balcony to see sunrise at 6 AM);^
1111             ~fp ~ : shows how floating-point
1112             numbers can be parsed;^
1113             ~dial ~ : 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   


Last updated 23 June 2004. This site is no longer supported; information may be out of date.
Maintained as a historical archive by the Interactive Fiction Technology Foundation. Copyright 1993-2018 IFTF, CC-BY-SA unless otherwise noted.
This page was originally managed by Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight.