Inform - Resources - Examples

Back to List

Inventory
Complete

Backward
Forward

Plain
Coloured
Gaudy

This code
in plain text

Browsing Museum.inf

Ground Floor (lines 105-704)

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   


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.