!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! CIA Adventure - Original Author Unknown
! Ported from CPMNET BBS to GWBASIC by Pete Wohlmut in 1982
! Ported to Inform by J. Kevin Thomas in 1996 ([email protected])
!
! See the end of this source for porter's notes.
!______________________________________________________________________________

Switches xv5s;

Constant Story "C.I.A. Adventure";
Constant Headline "^Original Author Unknown.^
  Ported from TRS-80 version on CPMNET BBS to GWBASIC by Pete Wohlmut (1982)^
  Ported to Inform by J. Kevin Thomas (jkthomas@@64unity.ncsu.edu)^";

Release 1;
Serial "961218";

Constant MAX_CARRIED 5;

! Constant DEBUG;

Include "Parser";
Include "VerbLib";

global elevator_at = 1; ! The floor that the elevator is located at.
global combo;           ! The combination number for the lock.
global sleep_for;       ! The guard will sleep for this many turns.

Attribute hidden;       ! Hide object from CiaRoom (like 'concealed').
Attribute poisoned;     ! Guard drank from cup? On, yes. Off, no.

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! CiaRoom class, which was taken from Graham Nelson's ScottRoom class in his
! port of Adventureland, with some minor changes of my own.
!______________________________________________________________________________

Class CiaRoom
with initial
     [;  give self ~visited;
     ],
     describe
     [ i c d;  print (string) self.description;
         objectloop (i in self)
             if (i ~= player) { c++; give i concealed; }
         if (c~=0)
           {
            objectloop (i in self)
               if (i ~= player)
                 {   if (i hasnt hidden) print "^You can see ", (a) i, ".";
                 }
           }
         c=0; d=0;
         print "^^Exits are: ";
         for (i=n_to: i<=d_to: i++)
             if (self.i ~= 0) c++;
         if (c==0) print "None!";
         else
         {   for (i=n_to: i<=d_to: i++)
                 if (self.i ~= 0)
                 {   if (d++>0) print " ";
                     if (i==n_to) print "North";
                     if (i==s_to) print "South";
                     if (i==e_to) print "East";
                     if (i==w_to) print "West";
                     if (i==u_to) print "Up";
                     if (i==d_to) print "Down";
                 }
             print ".";
         }
         new_line;
     ],
     each_turn
     [;
       if (turns==400)
         {
         deadflag = 1;
         "^Oh No! They've caught up to you! They pull out guns!";
         }
       if (turns ~= 400 && turns >= 375)
         {
         print "^You think that they are on to you... You hear noises.^";
         }
     ];


!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Busy Street
!______________________________________________________________________________

CiaRoom Busy_Street "Busy Street"
 with description "You are on a busy street.",
      s_to Building;

Object -> Building "tall office building"
 with name "building" "office",
      door_to Lobby, door_dir s_to,
  has open door static;

Object Badge "C.I.A identification badge"
 with name "badge", article "a";


!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Lobby
!______________________________________________________________________________

CiaRoom Lobby "Lobby"
 with description "You are in the lobby of the building.",
      after
      [;
         Go: if (badge in player)
               {
                 <Look self>;
                 print "^The door man looks at your badge and then throws you
                        out.^";
                 PlayerTo(Busy_Street, 2);
                 rtrue;
               }
      ],
      n_to Busy_Street, e_to Dingy, w_to Visitors, s_to Sliding_Doors;

! This /has/ to be the silliest puzzle of the game - giving you an object
! and forcing you to drop it on your first turn. Crazy.

Object -> Sculpture "sculpture"
 with name "sculpture",
      before
      [; Open: if (self has openable && self hasnt general)
                 {
                  move Quarter to location;
                  move Blank_Card to location;
                  give self ~openable general;
                  "^You open the sculpture, and two things fall
                   out!";
                 }
                "^You try, but you can't.";
      ],
  has static;

Object -> -> Quarter "quarter"
 with name "quarter",
      before
      [; Insert: if (second==Coffee_Maker && self in player)
                   {
                    move Cup to location;
                    remove self;
                    "^Pop! A cup of coffee comes out of the machine.";
                   }
      ];

Object -> -> Blank_Card "blank credit card"
 with name "blank" "credit" "card",
      before
      [; Insert:
                 if (Guard in location && guard hasnt general)
                   {
                   "^The guard won't let you!";
                   }

                 if (Slit in location && second == Slit)
                   {
                    move Lock to location;
                    remove Blank_Card;
                    "^Pop! A section of the wall opens.... ^Revealing
                    something very interesting.";
                   }
      ];

Object -> Sliding_Doors "pair of sliding doors"
 with name "door" "doors",
      description "There's a button near the doors.",
      before
      [; Open: "^You can't.";
      ],
      door_to Elevator, door_dir s_to,
  has static door;

Object -> Call_Button "call button"
 with name "button" "call",
      before
      [; Push: if (Sliding_Doors hasnt open)
                 {
                  give Sliding_Doors open;
                  "^The doors slide open with a woosh!";
                 }
                "^The doors are already open.";
      ],
  has static scenery hidden;


!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Elevator
!______________________________________________________________________________

CiaRoom Elevator "Small Room"
 with description "You are in a small room.",
      n_to
      [;
         if (elevator_at==1) return Lobby;
         if (elevator_at==2) return Hallway;
         if (elevator_at==3) return Short_Corridor;
      ];

Object -> Button_Panel "panel of buttons marked 'first', 'second' and 'third'"
 with name "panel",
  has static;

Object -> Button_1 "first button"
 with name "button" "first",
      before
      [;
         Push:   elevator_at = 1;
                  "^The doors close and you feel as if the room is \
                   moving.^Suddenly the doors open again.";
      ],
  has static scenery hidden;

Object -> Button_2 "second button"
 with name "button" "second",
      before
      [;
         Push:   elevator_at = 2;
                  "^The doors close and you feel as if the room is
                   moving.^Suddenly the doors open again.";

      ],
  has static scenery hidden;

Object -> Button_3 "third button"
 with name "button" "third",
      before
      [;
         Push:   elevator_at = 3;
                  "^The doors close and you feel as if the room is
                   moving.^Suddenly the doors open again.";

      ],
  has static scenery hidden;

Object -> Old_Key "olde fashioned key"
 with name "key" "olde", article "an";


!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Visitor's Room
!______________________________________________________________________________

CiaRoom Visitors "Visiting Room"
 with description "You are in a visitors room.",
      e_to Lobby;

Object -> VCR "video cassette recorder"
 with name "recorder" "vcr",
      description
      [; if (Battery notin self)
           {
            "^There's no power for it.";
           }
         if (Battery in self && TV hasnt general)
           {
            "^There's no T.V. to watch on.";
           }
      ],
  has static;


!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Dingy Anteroom
!______________________________________________________________________________

CiaRoom Dingy "Dingy Anteroom"
 with description "You are in a dingy anteroom.",
      w_to Lobby,
      e_to Dingy_Door;

Object -> Dingy_Door "door"
 with name "door",
      door_dir e_to,
      door_to Pres_Office,
      before [; Unlock: <<Open Dingy_Door>>;
                Open: if (Old_Key in player)
                         {
                         give Dingy_Door open;
                         "^O.K. You've opened the door.";
                         }
                      "^Its locked!";
             ],
  has static door;


!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! President's Office
!______________________________________________________________________________

CiaRoom Pres_Office "President's Office"
 with description "You are in the president's office.",
      w_to Dingy;

Object -> Desk "mahogany desk"
 with name "desk",
      description [; if (Drawer has static) "You can see it has a drawer
                         in it.";
                  ],
  has static;

Object -> Drawer "drawer"
 with name "drawer",
      description "It looks fragile.",
      before
      [; Take, Push, Pull: "^It is in the desk and locked.";

         Attack: if (Weight in player && Drawer has static)
                 {
                   move Notebook to location;
                   move Battery to location;
                   give self ~static ~hidden;
                   "^Its hard.. But you break it. Two things fall out.";
                  }
                  "^You try, but can't.";
         Open: if (self has hidden)
                 {
                 "^Its stuck!";
                 }
      ],
  has static hidden;

Object -> Weight "heavy paper weight"
 with name "weight",
      description "It looks heavy.";

Object -> -> Notebook "notebook"
 with name "notebook",
      description
      [; if (self hasnt general) give self general;
         "It says:^
          We have discovered one of CHAOS' secret words.^
          It is: BOND007.  To be used in a -tasteful- situation.";
      ];

Object -> -> Battery "large battery"
 with name "battery" "large",
      before
      [; Insert: if (second==VCR && VCR in location)
                   {
                    move self to VCR;
                    "^You put the battery into the VCR.";
                   }
      ];

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Hallway
!______________________________________________________________________________

CiaRoom Hallway "Hallway"
 with description "You are in a hallway.",
      e_to Elevator,
      w_to Security_Office,
      s_to Cafeteria;

Object -> Coffee_Maker "coffee maker"
 with name "maker" "coffee",
  has static;

Object -> -> Cup "cup of steaming hot coffee"
 with name "cup" "hot" "steaming" "coffee",
      description "It looks fragile.",
      before
      [; Drop: remove Cup; "^You drop the cup and it breaks into small
                pieces.^The coffee soaked into the ground.";
      ];

! The cup originally had no description, but I added the 'fragile' part
! to make the 'dropping the cup' rule more fair.  Always helpful to have
! hints.

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Security Office
!______________________________________________________________________________

CiaRoom Security_Office "Security Office"
 with description "You are in a security office.",
      e_to Hallway;

Object -> TV "portable television"
 with name "tv" "television" "portable" "telly",
      description
      [;
       if (self has general && Tape in VCR && Battery in VCR)
         {
           if (sculpture hasnt general) give sculpture openable;
           print "^The tape is playing a message:^^
           We have uncovered a number that will help you. That number
           is: ", combo, ". Please watch
           out for hidden traps. Also, there is something in the sculpture.^";
           rtrue;
         }
        "^The screen is dark.";
      ],
      before
      [; Tie:
               if (second==VCR && location == Visitors && self hasnt general)
                 {
                  give self general;
                  print "^You connect the TV to the VCR";
                  if (self in player)
                    {
                     move self to location;
                     print " and set it down.";
                     rtrue;
                    }
                  else print "."; rtrue;
                 }
               if (second == VCR && location == Visitors && self has general)
                 {
                 "^You already did that.";
                 }
               "^You can't connect the TV to that.";
         Take: if (self has general)
              {
               give self ~general;
               print "^You disconnect the TV from the VCR.^";
              }
      ];

Object -> Monitor1 "bank of monitors"
 with name "bank" "monitor" "monitors",
      description
      [; if (Large_Button hasnt general)
           {
            "^You see a metal pit 1000's of feet deep on one monitor.
             On the other side of the pit, you see a large hook.";
           }
           "^The screen is dark.";
       ],
  has static;

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Cafeteria
!______________________________________________________________________________

CiaRoom Cafeteria "Cafeteria"
 with description "You are in a cafeteria.",
      w_to Closet_Door,
      n_to Hallway;

Object -> Closet_Door "closet door"
 with name "door",
      door_dir w_to,
      door_to Closet,
      before [; Unlock: <<Open Closet_Door>>;
                Open: if (Old_Key in player)
                         {
                         give self open;
                         "^O.K. You've opened the door.";
                         }
                      else "^Its locked!";
             ],
  has static door;


!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Closet
!______________________________________________________________________________

CiaRoom Closet "Closet"
 with description "You are in a maintenance closet.",
      e_to Cafeteria;

Object -> Bag "plastic bag"
 with name "plastic" "bag" "sack",
      description "Its a very strong bag.",
      before
      [; Cut: if (Razor in player)
                {
                 move Tape to location;
                 remove self;
                 "^Rip! The bag goes to pieces, and something falls out!";
                }
              "^There isn't anything sharp enough.";
         Open: "^You can't. It is too strong.";
      ];

Object -> -> Tape "video tape"
 with name "tape" "video",
      before
      [; Insert: if (second==VCR && VCR in location)
                   {
                   move Tape to VCR;
                   "^You put the video tape into the recorder.";
                   }
      ];

Object -> Broom "broom"
 with name "broom";

Object -> Dustpan "dustpan"
 with name "dustpan";

Object -> Gloves "pair of rubber gloves"
 with name "gloves" "rubber",
  has clothing;

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Short Corridor
!______________________________________________________________________________

CiaRoom Short_Corridor "Short Corridor"
 with description "You are in a short corridor.",
      after
      [;
         Go: if (Guard hasnt general && ID_Card notin player)
               {
                 <Look self>;
                 print "^The guard looks at you suspiciously and then throws
                        you back.^";
                 PlayerTo(Elevator, 2);
                 rtrue;
               }
             if (Guard hasnt general && Cup in player && Cup has general)
               {
                give Guard general poisoned;
                remove Cup;
                Guard.short_name = "sleeping guard";
                StartDaemon(Guard);
                print "^The guard takes your coffee and drinks it. He falls
                 asleep right away.^";
               }
      ],
      w_to Elevator,
      s_to Side_Corridor,
      e_to Solid_Door;

Object -> Solid_Door "solid-looking door"
 with name "solid" "door" "solid-looking",
      description "There is a small slit beside the door.",
      before
      [; Open: "^You can't. It doesn't work.";
      ],
      door_to Metal_Hall, door_dir e_to,
  has static door locked;

Object -> Guard "security guard"
 with name "guard" "security",
      short_name "security guard",
      react_before
      [; if (self hasnt general && self has poisoned)
           {
            deadflag = 1;
            "^The guard draws his gun and shoots you!";
           }
      ],
      daemon
      [ t ;
        t = sleep_for - 1;
        sleep_for = t;
        if (t==1 && location==Short_Corridor)
          {
           print "^You can hear someone yawning.^";
          }
        if (t==0)
          {
            StopDaemon(self); give self ~general;
            Guard.short_name = "security guard";
            if (location==Short_Corridor) {print "^The guard wakes up!^";}
          }
      ],
  has animate;

Object -> Slit "slit"
 with name "slit" "slot",
  has static hidden;

Object -> -> Lock "electronic lock with dial"
 with name "lock" "electronic" "dial",
      before
      [; SetTo: print "You set the dial to ", second, ".^";
                if (second == combo)
                  {
                   remove Lock;
                   give Solid_Door open ~locked;
                   "^The door opens slowly..";
                  }
                "^You've got the combination wrong!";
      ];

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Metal_Hall
!______________________________________________________________________________

CiaRoom Metal_Hall "Metal Hall"
 with description "You are in a hallway made of metal.",
      after
      [; Go: if (Lever hasnt general)
               {
               <Look Self>;
               deadflag = 1;
               "^The floor is wired with electricity! You're being
                 electrocuted!^";
               }
      ],
      e_to Plain,
      w_to Short_Corridor;


!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Plain Room
!______________________________________________________________________________

CiaRoom Plain "Plain Room"
 with description "You are in a small plain room.",
      n_to Cubicle,
      w_to Metal_Hall;


!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Cubicle
!______________________________________________________________________________

CiaRoom Cubicle "Cubicle"
 with description "You are in a small sound-proofed cubicle.",
      after
      [; Go: if (Large_Button hasnt general)
               {
                <Look self>;
                deadflag = 1;
                "^Sirens go off all around you! Guards run in and shoot you
                 to death!";
               }
               <Look self>; "A secret door slams shut behind you!";

      ];


Object -> Case "glass case on pedastal"
 with name "glass" "case" "pedastal",
      before
      [; Cut: if (Razor in player && Ruby in self)
                {
                 move Ruby to player;
                 "^You cut the case and reach in to pull something out.";
                }
              "You try, but it doesn't work.";
          Look: if (Ruby in self)
                  {
                   "^You can see a gleaming stone inside.";
                  }
       ],
   has static;

Object -> -> Ruby "very large ruby"
 with name "large" "ruby";



!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Side Corridor
!______________________________________________________________________________

CiaRoom Side_Corridor "Side Corridor"
 with description "You are in a side corridor.",
      n_to Short_Corridor,
      e_to Gen_Room;


!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Gen_Room
!______________________________________________________________________________

CiaRoom Gen_Room "Power Generator Room"
 with description "You are in the power generator room.",
      w_to Side_Corridor;

Object -> Square "small metal square on wall"
 with name "square",
      before
      [; Push, Pull, Touch: if (Gloves hasnt worn && lever hasnt general)
                       {
                        deadflag = 1;
                        "^There is electricity coursing through the square!
                         You're being electrocuted!";
                       }
      ],
  has static;

Object -> Lever "lever on the square"
 with name "lever",
      before
      [; Push, Pull: if (Gloves has worn && self hasnt general)
                       {
                        give self general;
                        "^The lever goes all the way up and clicks.^
                        Something seems different now.";
                       }
                     if (self has general)
                       {
                        give self ~general;
                        "^The lever goes all the way down and clicks.^
                        Something seems different now.";
                       }
                     deadflag = 1;
                     "^The lever has electricty coursing through it! You're
                      being electrocuted!";
      ],
  has static;

Object -> Square_Sign "sign on the square"
 with name "sign",
      description "It says: Watch out! Dangerous!",
  has static;


!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Basement
!______________________________________________________________________________

CiaRoom Basement "Sub-Basement"
 with description "You are in a sub-basement below the chute.",
      e_to Complex;

Object -> Rope "strong nylon rope"
 with name "rope" "nylon" "strong",
      before
      [; ThrowAt: if (second==Hook && location==Ledge)
                  {
                   move Rope to Ledge;
                   give Rope door open;
                   Ledge.in_to=Rope;
                   self.door_dir=in_to;
                   self.door_to=Other_Side;
                   "^You throw the rope and it snags on the hook.";
                  }
         Take:    if (Rope has door)
                  {
                   give Rope ~door ~open;
                   Rope.door_dir=0;
                   self.door_to=0;
                   Ledge.in_to=0;
                  }
         Swing:   if (Rope has door) <<Enter Rope>>;
      ],
      door_to 0, door_dir 0;


!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Complex
!______________________________________________________________________________

CiaRoom Complex "Entrance to Secret Complex"
 with description "You are in the entrance to the secret complex.",
      w_to Basement,
      s_to Ledge,
      e_to Monitoring_Room;


!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Monitoring_Room
!______________________________________________________________________________

CiaRoom Monitoring_Room "Monitoring Room"
 with description "You are in a secret monitoring room.",
      w_to Complex;

Object -> Bank "bank of monitors"
 with name "bank" "monitor" "monitors",
      description "You see a room with a case on a pedestal in it.",
  has static;

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Ledge
!______________________________________________________________________________

CiaRoom Ledge "Ledge"
 with description "You are on a ledge in front of a metal pit 1000's of
         feet deep.",
      n_to Complex,
      in_to 0;

Object -> Hook "hook"
 with name "hook",
  has static scenery hidden;

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Other_Side of ledge.
!______________________________________________________________________________

CiaRoom Other_Side "Other Side"
 with description "You are on the other side of the pit.",
      e_to Long_Corridor;

Object -> Hook_Rope "large hook with rope hanging from it"
 with name "hook" "rope" "large",
      before
      [; Take, Go: "^You can't reach it."; ],
  has static scenery;

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Long Corridor
!______________________________________________________________________________

CiaRoom Long_Corridor "Long Corridor"
 with description "You are in a long corridor.",
      w_to Other_Side,
      s_to Narrow,
      e_to Large_Room;

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Narrow
!______________________________________________________________________________

CiaRoom Narrow "Narrow Cross Corridor"
 with description "You are in a narrow cross corridor.",
      n_to Long_Corridor,
      s_to Lab;

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Lab
!______________________________________________________________________________

CiaRoom Lab "Secret Laboratory"
 with description "You are in a secret laboratory.",
      e_to Narrow;

Object -> Box "box with a small button on it"
 with name "box" "button" "small",
      before
      [; Push: print "^You push the button on the box and...^";
               if (location == Cubicle || location == Control)
                 {
                  print "There is a blinding flash!^";
                  if (Ruby in Player)
                    {
                      deadflag = 2;
                      PlayerTo(Busy_Street,2);
                      "^Hooray! You've recovered the ruby!^You win!";
                    }
                  PlayerTo(Busy_Street,2); rtrue;
                 }
               "^Nothing Happens.";
       ];

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Large Room
!______________________________________________________________________________

CiaRoom Large_Room "Large Room"
 with description "You are in a large room.",
      w_to Long_Corridor,
      s_to Cross_Exam;

Object -> Painting "small painting"
 with name "small" "painting" "jackal",
      description "You see a picture of a grinning jackal.",
      after
      [; Take, Push:
               if (Pill in self)
                 {
                 move Pill to location;
                 "^Something fell from the frame!";
                 }
      ];

Object -> -> Pill "small capsule"
 with name "capsule" "small" "pill",
      before
      [; Insert: if (second==Cup && Pill in player)
                   {
                    remove Pill;
                    give Cup general;
                    "^You put the small capsule into the cup of steaming
                      hot coffee.";
                   }
         Drop:  if (Cup in player)
                  {
                   remove Pill;
                   give Cup general;
                   "^You try to drop it but if falls into the cup of coffee!";
                  }
      ];

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Cross_Exam
!______________________________________________________________________________

CiaRoom Cross_Exam "Cross Examination Room"
 with description "You are in a cross-examination room.",
      n_to Large_Room,
      s_to Chief;

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Chief
!______________________________________________________________________________

CiaRoom Chief "Office"
 with description "You are in the office of the chief of CHAOS.",
      n_to Cross_Exam,
      s_to Near_End,
      w_to Bathroom;

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Bathroom
!______________________________________________________________________________

CiaRoom Bathroom "Bathroom"
 with description "You are in a small bathroom.",
      e_to Chief;

Object -> Razor "razor blade"
 with name "razor" "blade";

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Control
!______________________________________________________________________________

CiaRoom Control "Control Room",
 with description "You are in the CHAOS control room.",
      e_to Near_End;

Object -> Large_Button "large button on the wall"
 with name "large" "button",
      before
      [; Push: if (self hasnt general) give self general;
               else give self ~general;

               "^The button on the wall goes in .....^Click! Something
                seems different now.";
      ],
  has static;

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Near_End
!______________________________________________________________________________

CiaRoom Near_End "Near the End"
 with description "You are near the end of the complex.",
      n_to Chief,
      w_to Control;

Object -> ID_Card "CHAOS ID card"
 with name "chaos" "id" "card";

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Game Routines and such forth.
!______________________________________________________________________________

[ Initialise;
   location=Busy_Street;
   move Badge to player;
   give player light;
   while (combo < 1000) combo=random(9999);
   sleep_for = 5 + random(10);
   "^^Writing on wall says:^
      For instructions, type 'orders' please.^";
];

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! GamePostRoutine - Also taken from Graham Nelson's port of Adventureland
!______________________________________________________________________________

[ GamePostRoutine i;
   if (action==##Look)
       objectloop (i in location)
           if (i ~= player && i has concealed)
               give i ~concealed;
   rfalse;
];

[ MissionSub;
"^Your mission is to recover a ruby that is being used in top secret
 government projects as a part in a laser projector.^^The ruby has been
 captured by a secret spy ring known as CHAOS. We suspect they are under
 cover somewhere in this neighborhood. Good luck!";
];

[ Bond007Sub;
 if (player in Cafeteria && notebook has general)
 {
   print "^Whoops! A trap door opens underneath you and you find yourself
       falling!^";
   PlayerTo(Basement, 2);
   elevator_at = 1;            ! Tidy, tidy.
   rtrue;
 }
 "^Nothing happens.";
];


!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Gramar and Verbs
!______________________________________________________________________________

Include "Grammar";

Verb "bond007" *                                -> Bond007;
Verb "orders"  *                                -> Mission;
Verb "connect"
              * noun                           -> Tie
              * noun "to" noun                 -> Tie;

end;

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Porter's Notes:
!------------------------------------------------------------------------------
! I first came across this game on a BBS while looking for text adventure
! materials in 1994.  It was written in GWBASIC by Pete Wohlmut. I originally
! ported it to MicroSoft's QuickBasic because of a personal loathing to the
! GWBASIC environment.  A simple text game of approximately an hour's
! diversion, I believed it would help me learn more about Inform if I tried
! porting it.  And it has.  I'm now working on a game of my own.
!
! The game is originally a simple two word parser, and some of the more
! complex actions (such as inserting things) were achieved with a follow-up
! query.  The text is simplistic, and originally was written in a first person
! point-of-view.  I took the liberty of sprucing up the text as well as
! changing the point-of-view to second person. I tried to preserve the
! simplistic nature of the text, however.
!
! Special thanks to Graham Nelson for bringing us Inform, as well as for the
! use of his ScottRoom class.
!
! Also thanks to Gareth Rees for his fine tutorial and excellent examples
! (and the wonderful game of "Christminster").
!
! J. Kevin Thomas
! email: [email protected]
!______________________________________________________________________________