home *** CD-ROM | disk | FTP | other *** search
/ Atari FTP / ATARI_FTP_0693.zip / ATARI_FTP_0693 / Games / Tads / tads.lzh / ADV.T next >
Text File  |  1990-08-06  |  57KB  |  2,315 lines

  1. /* Copyright (c) 1988, 1990 by Michael J. Roberts.  All Rights Reserved. */
  2. /*
  3.    adv.t  - standard adventure definitions for TADS games
  4.    Version 1.0
  5.    
  6.    This file defines the basic classes and functions used by most TADS
  7.    adventure games.  It is generally #include'd at the start of each game.
  8.    
  9.    Please see the TADS Shareware License for information on using and
  10.    copying this file.
  11. */
  12.  
  13. checkDoor: function;
  14. checkReach: function;
  15. itemcnt: function;
  16. listcont: function;
  17. listcontcont: function;
  18. turncount: function;
  19. addweight: function;
  20. addbulk: function;
  21. incscore: function;
  22. darkTravel: function;
  23. scoreRank: function;
  24. terminate: function;
  25. die: function;
  26. init: function;
  27. pardon: function;
  28. preinit: function;
  29. sleepDaemon: function;
  30. eatDaemon: function;
  31. goToSleep: function;
  32.  
  33. checkDoor: function( d, r )
  34. {
  35.     if ( d.isopen ) return( r );
  36.     else
  37.     {
  38.         setit( d );
  39.     caps(); d.thedesc; " is closed. ";
  40.     return( nil );
  41.     }
  42. }
  43. checkReach: function( loc, actor, v, obj )
  44. {
  45.     if ( obj=numObj or obj=strObj ) return;
  46.     if ( not ( actor.isCarrying( obj ) or obj.isIn( actor.location )))
  47.     {
  48.         if (find( loc.reachable, obj ) <> nil ) return;
  49.         "You can't reach "; obj.thedesc; " from "; loc.thedesc; ". ";
  50.         exit;
  51.     }
  52. }
  53. itemcnt: function( list )     // count of takeable items in list
  54. {
  55.     local cnt, tot, i;
  56.     tot := length( list );
  57.     cnt := 0;
  58.     i := 1;
  59.     while ( i <= tot )
  60.     {
  61.         if (not list[i].isfixed)
  62.             cnt := cnt+1;
  63.         i := i+1;
  64.     }
  65.     return( cnt );
  66. }
  67. listcont: function( obj )     // list contents of object
  68. {
  69.     local i, count, tot, list, cur, disptot;
  70.     count := 0;
  71.     list := obj.contents;
  72.     tot := length( list );
  73.     disptot := itemcnt( list );
  74.     i := 1;
  75.     while ( i <= tot )
  76.     {
  77.         cur := list[i];
  78.         if ( not cur.isfixed )
  79.         {
  80.             if ( count > 0 )
  81.             {
  82.                 if ( count+1 < disptot )
  83.                     ", ";
  84.                 else if (count = 1)
  85.                     " and ";
  86.                 else
  87.                     ", and ";
  88.             }
  89.             count := count + 1;
  90.             cur.adesc;               // list this object
  91.             if ( cur.isworn ) " (being worn)";
  92.             else if ( cur.islit ) " (providing light)";
  93.         }
  94.         i := i + 1;
  95.     }
  96. }
  97. listcontcont: function( obj )   // list contents of contents of object
  98. {
  99.     local list, i, tot;
  100.     list := obj.contents;
  101.     tot := length( list );
  102.     i := 1;
  103.     while ( i <= tot )
  104.     {
  105.         obj := list[i];
  106.         if (itemcnt( obj.contents ))
  107.         {
  108.             if ((( obj.isopenable and obj.isopen ) or
  109.              ( not obj.isopenable and obj.iscontainer )) and
  110.              not obj.isqcontainer )
  111.             {
  112.                 caps();           // Built-in; forces cap on next word output
  113.                 obj.thedesc; " seems to contain ";
  114.                 listcont( obj );  // List contents of this object.
  115.                 ". ";
  116.             }
  117.             else if ( obj.issurface and not obj.isqsurface )
  118.             {
  119.                 "Sitting on "; obj.thedesc;" is "; listcont( obj );
  120.                 ". ";
  121.             }
  122.         }
  123.         i := i + 1;
  124.     }
  125. }
  126. turncount: function( parm )
  127. {
  128.     incturn();
  129.     global.turnsofar := global.turnsofar + 1;
  130.     setscore( global.score, global.turnsofar );
  131. }
  132. addweight: function( l )
  133. {
  134.     local tot, i, c, totweight;
  135.  
  136.     tot := length( l );
  137.     i := 1;
  138.     totweight := 0;
  139.     while ( i <= tot )
  140.     {
  141.         c := l[i];
  142.         totweight := totweight + c.weight;
  143.         if (length( c.contents ))
  144.             totweight := totweight + addweight( c.contents );
  145.         i := i + 1;
  146.     }
  147.     return( totweight );
  148. }
  149. addbulk: function( list )
  150. {
  151.     local i, tot, totbulk, rem, cur;
  152.  
  153.     tot := length( list );
  154.     i := 1;
  155.     totbulk := 0;
  156.     while( i <= tot )
  157.     {
  158.         cur := list[i];
  159.         if ( not cur.isworn )
  160.             totbulk := totbulk + cur.bulk;
  161.         i := i + 1;
  162.     }
  163.     return( totbulk );
  164. }
  165. incscore: function( amount )
  166. {
  167.     global.score := global.score + amount;
  168.     setscore( global.score, global.turnsofar );
  169. }
  170. chairitem: fixeditem, nestedroom, surface
  171.     reachable = []          // list of all containers reachable from here;
  172.                             //  normally, you can only reach carried items
  173.                             //  from a chair, but this makes special allowances
  174.     ischair = true          // it is a chair by default; for beds or other
  175.                             //  things you lie down on, make it false
  176.     roomAction( actor, v, do, prep, io ) =
  177.     {
  178.         if ( do<>nil and v<>inspectVerb )
  179.             checkReach( self, actor, v, do );
  180.         if ( io<>nil and v<>askVerb and v<>tellVerb )
  181.             checkReach( self, actor, v, io );
  182.     }
  183.     enterRoom( actor ) = {}
  184.     noexit =
  185.     {
  186.         "You're not going anywhere until you get out of "; self.thedesc; ". ";
  187.         return( nil );
  188.     }
  189.     verDoBoard( actor ) = { self.verDoSiton( actor ); }
  190.     doBoard( actor ) = { self.doSiton( actor ); }
  191.     verDoSiton( actor ) =
  192.     {
  193.         if ( actor.location = self )
  194.         {
  195.             "You're already on "; self.thedesc; "! ";
  196.         }
  197.     }
  198.     doSiton( actor ) =
  199.     {
  200.         "Okay, you're now sitting on "; self.thedesc; ". ";
  201.         actor.travelTo( self );
  202.     }
  203.     verDoLieon( actor ) =
  204.     {
  205.         self.doVerSiton( actor );
  206.     }
  207.     doLieon( actor ) =
  208.     {
  209.         self.doSiton( actor );
  210.     }
  211. ;
  212. fixeditem: thing            // An immovable object
  213.     verDoTakeOut( actor, io ) =
  214.     {
  215.         self.verDoTake( actor );
  216.     }
  217.     verDoTakeOff( actor, io ) =
  218.     {
  219.         self.verDoTake( actor );
  220.     }
  221.     verDoTake( actor ) =
  222.     {
  223.         "You can't have "; self.thedesc; ". ";
  224.     }
  225.     verDoPutIn( actor, io ) =
  226.     {
  227.         "You can't put "; self.thedesc; " anywhere. ";
  228.     }
  229.     verDoPutOn( actor, io ) =
  230.     {
  231.         "You can't put "; self.thedesc; " anywhere. ";
  232.     }
  233.     verDoMove( actor ) =
  234.     {
  235.         "You can't move "; self.thedesc; ". ";
  236.     }
  237.     isfixed = true          // Item can't be taken
  238.     weight = 0              // no actual weight
  239.     bulk = 0
  240. ;
  241. nestedroom: room
  242.     islit =
  243.     {
  244.         if ( self.location ) return( self.location.islit );
  245.         return( nil );
  246.     }
  247.     statusLine =
  248.     {
  249.         self.location.sdesc; ", in "; self.thedesc; "\n\t";
  250.     }
  251.     lookAround( verbosity ) =
  252.     {
  253.         self.statusLine;
  254.     self.location.nrmLkAround( verbosity );
  255.     }
  256. ;
  257. surface: item
  258.     issurface = true        // Item can hold objects on its surface
  259.     ldesc =
  260.     {
  261.         if (itemcnt( self.contents ))
  262.         {
  263.             "On "; self.thedesc; " you see "; listcont( self ); ". ";
  264.         }
  265.         else
  266.         {
  267.             "There's nothing on "; self.thedesc; ". ";
  268.         }
  269.     }
  270.     verIoPutOn( actor ) = {}
  271.     ioPutOn( actor, do ) =
  272.     {
  273.         do.doPutOn( actor, self );
  274.     }
  275. ;
  276. inspectVerb: deepverb
  277.     verb = 'inspect' 'examine' 'look at' 'x'
  278.     sdesc = "inspect"
  279.     doAction = 'Inspect'
  280. ;
  281. askVerb: deepverb
  282.     verb = 'ask'
  283.     sdesc = "ask"
  284.     prepDefault = aboutPrep
  285.     ioAction( aboutPrep ) = 'AskAbout'
  286.     validIo( actor, obj, seqno ) = { return( seqno = 1 ); }
  287. ;
  288. tellVerb: deepverb
  289.     verb = 'tell'
  290.     sdesc = "tell"
  291.     prepDefault = aboutPrep
  292.     ioAction( aboutPrep ) = 'TellAbout'
  293.     validIo( actor, obj, seqno ) = { return( seqno = 1 ); }
  294. ;
  295. thing: object               // Basic "thing" object.  Comprises rooms,
  296.                             // fixed objects, actors, and moveable objects.
  297.     contents = []           // nothing inside it yet
  298.     verGrab( actor ) = {}   // we allow objects within to be taken out
  299.     Grab( obj ) = {}        // ...and doing so has no effect
  300.     adesc =
  301.     {
  302.         "a "; self.sdesc;   // default is "a <name>"; "self" is current object
  303.     }
  304.     thedesc =
  305.     {
  306.         "the "; self.sdesc; // default is "the <name>"
  307.     }
  308.     ldesc = { "It looks like an ordinary "; self.sdesc; " to me."; }
  309.     readdesc = { "You can't read "; self.adesc; ". "; }
  310.     actorAction( v, d, p, i ) =
  311.     {
  312.         "You have lost your mind. ";
  313.         exit;
  314.     }
  315.     isIn( obj ) =
  316.     {
  317.         local myloc;
  318.         
  319.         myloc := self.location;
  320.         if ( myloc )
  321.         {
  322.             if ( myloc = obj ) return( true );
  323.             if ( myloc.isopenable )
  324.             {
  325.                 if ( myloc.isopen )
  326.                     return( myloc.isIn( obj ));
  327.                 return( nil );
  328.             }
  329.             return( myloc.isIn( obj ));
  330.         }
  331.         return( nil );
  332.     }    
  333.     thrudesc = { "You can't see much through "; self.thedesc; ".\n"; }
  334.     moveInto( obj ) =
  335.     {
  336.         local loc;
  337.     
  338.     /*
  339.      *   For the object containing me, and its container, and so forth,
  340.      *   tell it via a Grab message that I'm going away.
  341.      */
  342.     loc := self.location;
  343.     while ( loc )
  344.     {
  345.         loc.Grab( self );
  346.         loc := loc.location;
  347.     }
  348.     
  349.         if ( self.location )
  350.             self.location.contents := self.location.contents - self;
  351.         self.location := obj;
  352.         if ( obj ) obj.contents := obj.contents + self;
  353.     }
  354.     verDoSave( actor ) =
  355.     {
  356.         "Please specify the name of the game to save in double quotes,
  357.         for example, SAVE \"GAME1\". ";
  358.     }
  359.     verDoRestore( actor ) =
  360.     {
  361.         "Please specify the name of the game to restore in double quotes,
  362.         for example, SAVE \"GAME1\". ";
  363.     }
  364.     verDoScript( actor ) =
  365.     {
  366.         "You should type the name of a file to write the transcript to
  367.         in quotes, for example, SCRIPT \"LOG1\". ";
  368.     }
  369.     verDoSay( actor ) =
  370.     {
  371.         "You should say what you want to say in double quotes, for example,
  372.         SAY \"HELLO\". ";
  373.     }
  374.     verDoPush( actor ) = 
  375.     { 
  376.         "Pushing "; self.thedesc; " doesn't do anything. "; 
  377.     }
  378.     verDoWear( actor ) =
  379.     {
  380.         "You can't wear "; self.thedesc; ". ";
  381.     }
  382.     verDoTake( actor ) =
  383.     {
  384.         local loc;
  385.  
  386.         loc := self.location;
  387.  
  388.         if ( loc = actor )
  389.         {
  390.             "You already have "; self.thedesc; "! ";
  391.         }
  392.         else
  393.     {
  394.         /*
  395.          *   Check with each container to make sure that the container
  396.          *   doesn't object to the object's removal.
  397.          */
  398.         while ( loc )
  399.             {
  400.                 if ( loc <> actor ) loc.verGrab( self );
  401.                 loc := loc.location;
  402.         }
  403.         }
  404.     }
  405.     doTake( actor ) =
  406.     {
  407.         local totbulk, totweight;
  408.  
  409.         totbulk := addbulk( actor.contents ) + self.bulk;
  410.         totweight := addweight( actor.contents );
  411.         if ( not actor.isCarrying( self ))
  412.             totweight := totweight + self.weight;
  413.  
  414.         if ( totweight > actor.maxweight )
  415.             "Your load is too heavy. ";
  416.         else if ( totbulk > actor.maxbulk )
  417.             "You've already got your hands full. ";
  418.         else
  419.         {
  420.             self.moveInto( actor );
  421.             "Taken. ";
  422.         }
  423.     }
  424.     verDoDrop( actor ) =
  425.     {
  426.         if ( not actor.isCarrying( self ))
  427.         {
  428.             "You're not carrying "; self.thedesc; "! ";
  429.         }
  430.     }
  431.     doDrop( actor ) =
  432.     {
  433.         local loc;
  434.  
  435.         loc := actor.location;
  436.         while ( loc.location and not loc.isdroploc ) loc := loc.location;
  437.         self.moveInto( loc );
  438.         "Dropped. ";
  439.     }
  440.     verDoUnwear( actor ) =
  441.     {
  442.         "You're not wearing "; self.thedesc; "! ";
  443.     }
  444.     verIoPutIn( actor ) =
  445.     {
  446.         "I don't know how to put anything into "; self.thedesc; ". ";
  447.     }
  448.     verDoPutIn( actor, io ) =
  449.     {
  450.         if ( io = nil ) return;
  451.     
  452.         if ( self.location = io )
  453.         {
  454.             caps(); self.thedesc; " is already in "; io.thedesc; "! ";
  455.         }
  456.         else if ( io = self or io.isIn( self ))
  457.         {
  458.             "You can't put "; self.thedesc; " in itself! ";
  459.         }
  460.     }
  461.     doPutIn( actor, io ) =
  462.     {
  463.         self.moveInto( io );
  464.         "Done. ";
  465.     }
  466.     verIoPutOn( actor ) =
  467.     {
  468.         "There's no good surface on "; self.thedesc; ". ";
  469.     }
  470.     verDoPutOn( actor, io ) =
  471.     {
  472.         if ( io = nil ) return;
  473.     
  474.         if ( self.location = io )
  475.         {
  476.             caps(); self.thedesc; " is already on "; io.thedesc; "! ";
  477.         }
  478.         else if ( io = self or io.isIn( self ))
  479.         {
  480.             "You can't put "; self.thedesc; " on itself! ";
  481.         }
  482.     }
  483.     doPutOn( actor, io ) =
  484.     {
  485.         self.moveInto( io );
  486.         "Done. ";
  487.     }
  488.     verIoTakeOut( actor ) = {}
  489.     ioTakeOut( actor, do ) =
  490.     {
  491.         do.doTakeOut( actor, self );
  492.     }
  493.     verDoTakeOut( actor, io ) =
  494.     {
  495.         if ( io <> nil and not self.isIn( io ))
  496.         {
  497.             caps(); self.thedesc; " isn't in "; io.thedesc; ". ";
  498.         }
  499.     }
  500.     doTakeOut( actor, io ) =
  501.     {
  502.         self.doTake( actor );
  503.     }
  504.     verIoTakeOff( actor ) = {}
  505.     ioTakeOff( actor, do ) =
  506.     {
  507.         do.doTakeOff( actor, self );
  508.     }
  509.     verDoTakeOff( actor, io ) =
  510.     {
  511.         if ( io <> nil and not self.isIn( io ))
  512.         {
  513.             caps(); io.thedesc; " isn't on "; self.thedesc; "! ";
  514.         }
  515.     }
  516.     doTakeOff( actor, io ) =
  517.     {
  518.         self.doTake( actor );
  519.     }
  520.     verIoPlugIn( actor ) =
  521.     {
  522.         "You can't plug anything into "; self.thedesc; ". ";
  523.     }
  524.     verDoPlugIn( actor, do ) =
  525.     {
  526.         "You can't plug "; self.thedesc; " into anything. ";
  527.     }
  528.     verIoUnplugFrom( actor ) =
  529.     {
  530.         "It's not plugged into "; self.thedesc; ". ";
  531.     }
  532.     verDoUnplugFrom( actor, io ) =
  533.     {
  534.         if ( io <> nil ) { "It's not plugged into "; io.thedesc; ". "; }
  535.     }
  536.     verDoLookin( actor ) =
  537.     {
  538.         "There's nothing in "; self.thedesc; ". ";
  539.     }
  540.     verDoLookthru( actor ) =
  541.     {
  542.         "You can't see anything through "; self.thedesc; ". ";
  543.     }
  544.     verDoLookunder( actor ) =
  545.     {
  546.         "There's nothing under "; self.thedesc; ". ";
  547.     }
  548.     verDoInspect( actor ) = {}
  549.     doInspect( actor ) =
  550.     {
  551.         self.ldesc;
  552.     }
  553.     verDoRead( actor ) =
  554.     {
  555.         "I don't know how to read "; self.thedesc; ". ";
  556.     }
  557.     verDoLookbehind( actor ) =
  558.     {
  559.         "There's nothing behind "; self.thedesc; ". ";
  560.     }
  561.     verDoTurn( actor ) =
  562.     {
  563.         "Turning "; self.thedesc; " doesn't have any effect. ";
  564.     }
  565.     verDoTurnWith( actor, io ) =
  566.     {
  567.         "Turning "; self.thedesc; " doesn't have any effect. ";
  568.     }
  569.     verDoTurnTo( actor, io ) =
  570.     {
  571.         "Turning "; self.thedesc; " doesn't have any effect. ";
  572.     }
  573.     verIoTurnTo( actor ) =
  574.     {
  575.         "I don't know how to do that. ";
  576.     }
  577.     verDoTurnon( actor ) =
  578.     {
  579.         "I don't know how to turn "; self.thedesc; " on. ";
  580.     }
  581.     verDoTurnoff( actor ) =
  582.     {
  583.         "I don't know how to turn "; self.thedesc; " off. ";
  584.     }
  585.     verIoAskAbout( actor ) = {}
  586.     ioAskAbout( actor, do ) =
  587.     {
  588.         do.doAskAbout( actor, self );
  589.     }
  590.     verDoAskAbout( actor, io ) =
  591.     {
  592.         "Surely, you can't think "; self.thedesc; " knows anything
  593.         about it! ";
  594.     }
  595.     verIoTellAbout( actor ) = {}
  596.     ioTellAbout( actor, do ) =
  597.     {
  598.         do.doTellAbout( actor, self );
  599.     }
  600.     verDoTellAbout( actor, io ) =
  601.     {
  602.         "It doesn't look as though "; self.thedesc; " is interested. ";
  603.     }
  604.     verDoUnboard( actor ) =
  605.     {
  606.         if ( actor.location <> self )
  607.         {
  608.             "You're not in "; self.thedesc; "! ";
  609.         }
  610.         else if ( self.location=nil )
  611.         {
  612.             "You can't get out of "; self.thedesc; "! ";
  613.         }
  614.     }
  615.     doUnboard( actor ) =
  616.     {
  617.         if ( self.fastenitem )
  618.     {
  619.         "You'll have to unfasten "; actor.location.fastenitem.thedesc;
  620.         " first. ";
  621.     }
  622.     else
  623.     {
  624.             "Okay, you're no longer in "; self.thedesc; ". ";
  625.             self.leaveRoom( actor );
  626.         actor.moveInto( self.location );
  627.     }
  628.     }
  629.     verDoAttachWith( actor, io ) =
  630.     {
  631.         "Attacking "; self.thedesc; " doesn't appear productive. ";
  632.     }
  633.     verIoAttackWith( actor ) =
  634.     {
  635.         "It's not very effective to attack with "; self.thedesc; ". ";
  636.     }
  637.     verDoEat( actor ) =
  638.     {
  639.         caps(); self.thedesc; " doesn't appear appetizing. ";
  640.     }
  641.     verDoDrink( actor ) =
  642.     {
  643.         caps(); self.thedesc; " doesn't appear appetizing. ";
  644.     }
  645.     verDoGiveTo( actor, io ) =
  646.     {
  647.         if ( not actor.isCarrying( self ))
  648.         {
  649.             "You're not carrying "; self.thedesc; ". ";
  650.         }
  651.     }
  652.     doGiveTo( actor, io ) =
  653.     {
  654.         self.moveInto( io );
  655.         "Done. ";
  656.     }
  657.     verDoPull( actor ) =
  658.     {
  659.         "Pulling "; self.thedesc; " doesn't have any effect. ";
  660.     }
  661.     verDoThrowAt( actor, io ) =
  662.     {
  663.         if ( not actor.isCarrying( self ))
  664.         {
  665.             "You're not carrying "; self.thedesc; ". ";
  666.         }
  667.     }
  668.     doThrowAt( actor, io ) =
  669.     {
  670.         "You miss. ";
  671.         self.moveInto( actor.location );
  672.     }
  673.     verIoThrowAt( actor ) =
  674.     {
  675.         if ( actor.isCarrying( self ))
  676.         {
  677.             "You could at least drop "; self.thedesc; " first. ";
  678.         }
  679.     }
  680.     ioThrowAt( actor, do ) =
  681.     {
  682.         do.doThrowAt( actor, self );
  683.     }
  684.     verDoThrowTo( actor, io ) =
  685.     {
  686.         if ( not actor.isCarrying( self ))
  687.         {
  688.             "You're not carrying "; self.thedesc; ". ";
  689.         }
  690.     }
  691.     doThrowTo( actor, io ) =
  692.     {
  693.         "You miss. ";
  694.         self.moveInto( actor.location );
  695.     }
  696.     verDoThrow( actor ) =
  697.     {
  698.         if ( not actor.isCarrying( self ))
  699.         {
  700.             "You're not carrying "; self.thedesc; ". ";
  701.         }
  702.     }
  703.     doThrow( actor ) =
  704.     {
  705.         "Thrown. ";
  706.         self.moveInto( actor.location );
  707.     }
  708.     verDoShowTo( actor, io ) =
  709.     {
  710.     }
  711.     doShowTo( actor, io ) =
  712.     {
  713.         if ( io <> nil ) { caps(); io.thedesc; " isn't impressed. "; }
  714.     }
  715.     verIoShowTo( actor ) =
  716.     {
  717.         caps(); self.thedesc; " isn't impressed. ";
  718.     }
  719.     verDoClean( actor ) =
  720.     {
  721.         caps(); self.thedesc; " looks a bit cleaner now. ";
  722.     }
  723.     verDoCleanWith( actor, io ) = {}
  724.     doCleanWith( actor, io ) =
  725.     {
  726.         caps(); self.thedesc; " looks a bit cleaner now. ";
  727.     }
  728.     verDoMove( actor ) =
  729.     {
  730.         "Moving "; self.thedesc; " doesn't reveal anything. ";
  731.     }
  732.     verDoMoveTo( actor, io ) =
  733.     {
  734.         "Moving "; self.thedesc; " doesn't reveal anything. ";
  735.     }
  736.     verIoMoveTo( actor ) =
  737.     {
  738.         "That doesn't get us anywhere. ";
  739.     }
  740.     verDoMoveWith( actor, do ) =
  741.     {
  742.         "Moving "; self.thedesc; " doesn't reveal anything. ";
  743.     }
  744.     verIoMoveWith( actor ) =
  745.     {
  746.         caps(); self.thedesc; " doesn't seem to help. ";
  747.     }
  748.     verDoTypeOn( actor, do ) =
  749.     {
  750.         "You should say what you want to type in double quotes, for
  751.         example, TYPE \"HELLO\" ON KEYBOARD. ";
  752.     }
  753.     verDoTouch( actor ) =
  754.     {
  755.         "Touching "; self.thedesc; " doesn't seem to have any effect. ";
  756.     }
  757.     verDoPoke( actor ) =
  758.     {
  759.         "Poking "; self.thedesc; " doesn't seem to have any effect. ";
  760.     }
  761.     genMoveDir = { "You can't seem to do that. "; }
  762.     verDoMoveN( actor ) = { self.genMoveDir; }
  763.     verDoMoveS( actor ) = { self.genMoveDir; }
  764.     verDoMoveE( actor ) = { self.genMoveDir; }
  765.     verDoMoveW( actor ) = { self.genMoveDir; }
  766.     verDoMoveNE( actor ) = { self.genMoveDir; }
  767.     verDoMoveNW( actor ) = { self.genMoveDir; }
  768.     verDoMoveSE( actor ) = { self.genMoveDir; }
  769.     verDoMoveSW( actor ) = { self.genMoveDir; }
  770.     verDoSearch( actor ) =
  771.     {
  772.         "You find nothing of interest. ";
  773.     }
  774. ;
  775. room: thing                 // An enterable area
  776.     roomCheck( v ) =        // true if verb is OK in room, first pass
  777.     {                       // (generally, only disallow commands when dark)
  778.         return( true );     // everything is OK in a lit room
  779.     }
  780.     islit = true            // rooms are lit unless otherwise specified
  781.     isseen = nil            // room has not been seen yet
  782.     enterRoom( actor ) =    // sent to room as actor is entering it
  783.     {
  784.         self.lookAround(( not self.isseen ) or global.verbose );
  785.         if ( self.islit ) self.isseen := true;
  786.     }
  787.     roomAction( a, v, d, p, i ) =
  788.     {
  789.         if ( self.location ) self.location.roomAction( a, v, d, p, i );
  790.     }
  791.     /*
  792.      *   Whenever an actor leaves this room, we run through the leaveList.
  793.      *   This is a list of objects that have registered themselves with us
  794.      *   via addLeaveList().  For each object in the leaveList, we send
  795.      *   a "leaving" message, with the actor as the parameter.  It should
  796.      *   return true if it wants to be removed from the leaveList, nil
  797.      *   if it wants to stay.
  798.      */
  799.     leaveList = []
  800.     addLeaveList( obj ) =
  801.     {
  802.         self.leaveList := self.leaveList + obj;
  803.     }
  804.     leaveRoom( actor ) =
  805.     {
  806.         local tmplist, thisobj, i, tot;
  807.         
  808.         tmplist := self.leaveList;
  809.     tot := length( tmplist );
  810.     i := 1;
  811.         while ( i <= tot )
  812.         {
  813.         thisobj := tmplist[i];
  814.             if ( thisobj.leaving( actor ))
  815.                 self.leaveList := self.leaveList - thisobj;
  816.             i := i + 1;
  817.         }
  818.     }
  819.     /*
  820.      *   lookAround describes the room.  If verbosity is true, the full
  821.      *   description is given, otherwise an abbreviated description (without
  822.      *   the room's ldesc) is displayed.
  823.      */
  824.     nrmLkAround( verbosity ) =      // lookAround without location status
  825.     {
  826.         local l, cur, i, tot;
  827.  
  828.         if ( verbosity )
  829.         {
  830.             "\n\t"; self.ldesc;
  831.         }
  832.         "\n\t";
  833.         if (itemcnt( self.contents ))
  834.         {
  835.             "You see "; listcont( self ); " here. ";
  836.         }
  837.         listcontcont( self ); "\n";
  838.  
  839.         l := self.contents;
  840.     tot := length( l );
  841.     i := 1;
  842.         while ( i <= tot )
  843.         {
  844.         cur := l[i];
  845.             if ( cur.isactor )
  846.             {
  847.                 if ( cur <> Me )
  848.                 {
  849.                     "\n\t";
  850.                     cur.actorDesc;
  851.                 }
  852.             }
  853.             i := i + 1;
  854.         }
  855.     }
  856.     statusLine =
  857.     {
  858.         self.sdesc; "\n\t";
  859.     }
  860.     lookAround( verbosity ) =
  861.     {
  862.         self.statusLine;
  863.         self.nrmLkAround( verbosity );
  864.     }
  865.     north = { return( self.noexit ); }
  866.     south = { return( self.noexit ); }
  867.     east  = { return( self.noexit ); }
  868.     west  = { return( self.noexit ); }
  869.     up    = { return( self.noexit ); }
  870.     down  = { return( self.noexit ); }
  871.     ne    = { return( self.noexit ); }
  872.     nw    = { return( self.noexit ); }
  873.     se    = { return( self.noexit ); }
  874.     sw    = { return( self.noexit ); }
  875.     in    = { return( self.noexit ); }
  876.     out   = { return( self.noexit ); }
  877.     noexit = { "You can't go that way. "; return( nil ); }
  878. ;
  879. item: thing                 // A standard takeable object
  880.     weight = 0              // Default weight of an object
  881.     bulk = 1                // Default bulk of an object
  882. ;
  883. deepverb: object                // A deep-structure verb.
  884.     validDo( actor, obj, seqno ) =
  885.     {
  886.     return( obj.isIn( actor.location.location ? actor.location.location :
  887.      actor.location ));
  888.     }
  889.     validIo( actor, obj, seqno ) =
  890.     {
  891.     return( obj.isIn( actor.location.location ? actor.location.location :
  892.      actor.location ));
  893.     }
  894.     doDefault( actor, prep, io ) =
  895.     {
  896.         return( actor.contents + actor.location.contents );
  897.     }
  898.     ioDefault( actor, prep ) =
  899.     {
  900.         return( actor.contents + actor.location.contents );
  901.     }
  902. ;
  903. aboutPrep: Prep
  904.     preposition = 'about'
  905.     sdesc = "about"
  906. ;
  907. Prep: object
  908. ;
  909. Actor: fixeditem            // A character in the game
  910.     weight = 10             // actors are pretty heavy
  911.     bulk = 10               // and pretty bulky
  912.     maxweight = 50          // Weight that can be carried at once
  913.     maxcnt = 20             // Number of objects that can be carried at once
  914.     totecnt = 0             // No objects, so count is zero
  915.     toteweight = 0          // and weight is zero as well
  916.     isactor = true          // flag that this is an actor
  917.     actorAction( v, d, p, i ) =
  918.     {
  919.         caps(); self.thedesc; " doesn't appear interested. ";
  920.         exit;
  921.     }
  922.     isCarrying( obj ) = { return( obj.isIn( self )); }
  923.     actorDesc =
  924.     {
  925.         caps(); self.adesc; " is here. ";
  926.     }
  927.     verGrab( item ) =
  928.     {
  929.         caps(); self.thedesc; " is carrying "; item.thedesc;
  930.         " and won't let you have it. ";
  931.     }
  932.     verDoFollow( actor ) =
  933.     {
  934.         "But "; self.thedesc; " is right here! ";
  935.     }
  936.     moveInto( obj ) =
  937.     {
  938.         if ( self.myfollower ) self.myfollower.moveInto( self.location );
  939.     pass moveInto;
  940.     }
  941. ;
  942. class follower: Actor
  943.     sdesc = { self.myactor.sdesc; }
  944.     isfollower = true
  945.     ldesc = { caps(); self.thedesc; " is no longer here. "; }
  946.     actorAction( v, d, p, i ) = { self.ldesc; }
  947.     actorDesc = {}
  948.     myactor = nil   // set to the Actor to be followed
  949.     verDoFollow( actor ) = {}
  950.     doFollow( actor ) =
  951.     {
  952.         actor.travelTo( self.myactor.location );
  953.     }
  954. ;
  955. followVerb: deepverb
  956.     sdesc = "follow"
  957.     verb = 'follow'
  958.     doAction = 'Follow'
  959. ;
  960. class buttonitem: fixeditem
  961.     noun = 'button'
  962.     plural = 'buttons'
  963.     verDoPush( actor ) = {}
  964. ;
  965. class clothingItem: item
  966.     checkDrop =
  967.     {
  968.         if ( self.isworn )
  969.     {
  970.         "(Taking off "; self.thedesc; " first)\n";
  971.     }
  972.     }
  973.     doDrop( actor ) =
  974.     {
  975.         self.checkDrop;
  976.     pass doDrop;
  977.     }
  978.     doPutIn( actor, io ) =
  979.     {
  980.         self.checkDrop;
  981.     pass doPutIn;
  982.     }
  983.     doPutOn( actor, io ) =
  984.     {
  985.         self.checkDrop;
  986.     pass doPutOn;
  987.     }
  988.     doGiveTo( actor, io ) =
  989.     {
  990.         self.checkDrop;
  991.     pass doGiveTo;
  992.     }
  993.     doThrowAt( actor, io ) =
  994.     {
  995.         self.checkDrop;
  996.     pass doThrowAt;
  997.     }
  998.     doThrowTo( actor, io ) =
  999.     {
  1000.         self.checkDrop;
  1001.     pass doThrowTo;
  1002.     }
  1003.     doThrow( actor ) =
  1004.     {
  1005.         self.checkDrop;
  1006.     pass doThrow;
  1007.     }
  1008.     moveInto( obj ) =
  1009.     {
  1010.         /*
  1011.      *   Catch any other movements with moveInto; this won't stop the
  1012.      *   movement from happening, but it will prevent any anamolous
  1013.      *   consequences caused by the object moving but still being worn.
  1014.      */
  1015.         self.isworn := nil;
  1016.     pass moveInto;
  1017.     }
  1018.     verDoWear( actor ) =
  1019.     {
  1020.         if ( self.isworn )
  1021.         {
  1022.             "You're already wearing "; self.thedesc; "! ";
  1023.         }
  1024.         else if ( not actor.isCarrying( self ))
  1025.         {
  1026.             "You don't have "; self.thedesc; ". ";
  1027.         }
  1028.     }
  1029.     doWear( actor ) =
  1030.     {
  1031.         "Okay, you're now wearing "; self.thedesc; ". ";
  1032.         self.isworn := true;
  1033.     }
  1034.     verDoUnwear( actor ) =
  1035.     {
  1036.         if ( not self.isworn )
  1037.         {
  1038.             "You're not wearing "; self.thedesc; ". ";
  1039.         }
  1040.     }
  1041.     doUnwear( actor ) =
  1042.     {
  1043.         "Okay, you're no longer wearing "; self.thedesc; ". ";
  1044.         self.isworn := nil;
  1045.     }
  1046. ;
  1047. doorway: fixeditem
  1048.     isdoor = true           // Item can be opened and closed
  1049.     verDoOpen( actor ) =
  1050.     {
  1051.         if ( self.isopen ) "It's already open. ";
  1052.     }
  1053.     doOpen( actor ) =
  1054.     {
  1055.         "Opened. ";
  1056.     self.isopen := true;
  1057.     if ( self.otherside ) self.otherside.isopen := true;
  1058.     }
  1059.     verDoClose( actor ) =
  1060.     {
  1061.         if ( not self.isopen ) "It's already closed. ";
  1062.     }
  1063.     doClose( actor ) =
  1064.     {
  1065.         "Closed. ";
  1066.     self.isopen := nil;
  1067.     if ( self.otherside ) self.otherside.isopen := nil;
  1068.     }
  1069.     ldesc =
  1070.     {
  1071.         "It's "; if ( self.isopen ) "open. "; else "closed. ";
  1072.     }
  1073. ;
  1074. vehicle: item, nestedroom
  1075.     reachable = []
  1076.     isvehicle = true
  1077.     verDoEnter( actor ) = { self.verDoBoard( actor ); }
  1078.     doEnter( actor ) = { self.doBoard( actor ); }
  1079.     verDoBoard( actor ) =
  1080.     {
  1081.         if ( actor.location = self )
  1082.         {
  1083.             "You're already in "; self.thedesc; "! ";
  1084.         }
  1085.     }
  1086.     doBoard( actor ) =
  1087.     {
  1088.         "Okay, you're now in "; self.thedesc; ". ";
  1089.         actor.moveInto( self );
  1090.     }
  1091.     noexit =
  1092.     {
  1093.         "You're not going anywhere until you get out of "; self.thedesc; ". ";
  1094.         return( nil );
  1095.     }
  1096.     out = ( self.location )
  1097. ;
  1098. digVerb: deepverb
  1099.     verb = 'dig' 'dig in'
  1100.     sdesc = "dig in"
  1101.     prepDefault = withPrep
  1102.     ioAction( withPrep ) = 'DigWith'
  1103. ;
  1104. withPrep: Prep
  1105.     preposition = 'with'
  1106.     sdesc = "with"
  1107. ;
  1108. uVerb: travelVerb
  1109.     action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1110.     verb = 'u' 'up' 'go up'
  1111.     travelDir( actor ) = { return( actor.location.up ); }
  1112. ;
  1113. class travelVerb: deepverb
  1114.     isTravelVerb = true
  1115. ;
  1116. jumpVerb: deepverb
  1117.     verb = 'jump' 'jump over' 'jump off'
  1118.     doAction = 'Jump'
  1119.     action = { "Wheeee!"; }
  1120. ;
  1121. dVerb: travelVerb
  1122.     action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1123.     verb = 'd' 'down' 'go down'
  1124.     travelDir( actor ) = { return( actor.location.down ); }
  1125. ;
  1126. container: item
  1127.     maxbulk = 10            // maximum bulk the container can contain
  1128.     isopen = true           // in fact, it can't be closed at all
  1129.     iscontainer = true      // Item can contain other items
  1130.     ldesc =
  1131.     {
  1132.         if (itemcnt( self.contents ))
  1133.         {
  1134.             "In "; self.thedesc; " you see "; listcont( self ); ". ";
  1135.         }
  1136.         else
  1137.         {
  1138.             "There's nothing in "; self.thedesc; ". ";
  1139.         }
  1140.     }
  1141.     verIoPutIn( actor ) =
  1142.     {
  1143.     }
  1144.     ioPutIn( actor, do ) =
  1145.     {
  1146.         if (addbulk( self.contents ) + do.bulk > self.maxbulk )
  1147.         {
  1148.             "You can't fit that in "; self.thedesc; ". ";
  1149.         }
  1150.         else
  1151.         {
  1152.         do.doPutIn( actor, self );
  1153.         }
  1154.     }
  1155.     verDoLookin( actor ) = {}
  1156.     doLookin( actor ) =
  1157.     {
  1158.         self.ldesc;
  1159.     }
  1160. ;
  1161. eVerb: travelVerb
  1162.     action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1163.     verb = 'e' 'east' 'go east'
  1164.     travelDir( actor ) = { return( actor.location.east ); }
  1165. ;
  1166. sVerb: travelVerb
  1167.     action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1168.     verb = 's' 'south' 'go south'
  1169.     travelDir( actor ) = { return( actor.location.south ); }
  1170. ;
  1171. openable: container
  1172.     isopenable = true
  1173.     ldesc =
  1174.     {
  1175.         if ( self.isopen ) pass ldesc;
  1176.     else
  1177.     {
  1178.         caps(); self.thedesc; " is closed. ";
  1179.     }
  1180.     }
  1181.     isopen = true
  1182.     verDoOpen( actor ) =
  1183.     {
  1184.         if ( self.isopen )
  1185.     {
  1186.         caps(); self.thedesc; " is already open! ";
  1187.     }
  1188.     }
  1189.     doOpen( actor ) =
  1190.     {
  1191.         if (itemcnt( self.contents ))
  1192.     {
  1193.         "Opening "; self.thedesc; " reveals "; listcont( self ); ". ";
  1194.     }
  1195.     else "Opened. ";
  1196.     self.isopen := true;
  1197.     }
  1198.     verDoClose( actor ) =
  1199.     {
  1200.         if ( not self.isopen )
  1201.     {
  1202.         caps(); self.thedesc; " is already closed! ";
  1203.     }
  1204.     }
  1205.     doClose( actor ) =
  1206.     {
  1207.         "Closed. ";
  1208.     self.isopen := nil;
  1209.     }
  1210.     verIoPutIn( actor ) =
  1211.     {
  1212.         if ( not self.isopen )
  1213.     {
  1214.         caps(); self.thedesc; " is closed. ";
  1215.     }
  1216.     }
  1217.     verDoLookin( actor ) =
  1218.     {
  1219.         if ( not self.isopen ) "It's closed. ";
  1220.     }
  1221. ;
  1222. decoration: fixeditem       // An immovable object for decoration only
  1223. ;
  1224. nVerb: travelVerb
  1225.     action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1226.     verb = 'n' 'north' 'go north'
  1227.     travelDir( actor ) = { return( actor.location.north ); }
  1228. ;
  1229. wVerb: travelVerb
  1230.     action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1231.     verb = 'w' 'west' 'go west'
  1232.     travelDir( actor ) = { return( actor.location.west ); }
  1233. ;
  1234. neVerb: travelVerb
  1235.     action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1236.     verb = 'ne' 'northeast' 'go ne' 'go northeast'
  1237.     travelDir( actor ) = { return( actor.location.ne ); }
  1238. ;
  1239. nwVerb: travelVerb
  1240.     action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1241.     verb = 'nw' 'northwest' 'go nw' 'go northwest'
  1242.     travelDir( actor ) = { return( actor.location.nw ); }
  1243. ;
  1244. seVerb: travelVerb
  1245.     action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1246.     verb = 'se' 'southeast' 'go se' 'go southeast'
  1247.     travelDir( actor ) = { return( actor.location.se ); }
  1248. ;
  1249. swVerb: travelVerb
  1250.     action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1251.     verb = 'sw' 'southwest' 'go sw' 'go southwest'
  1252.     travelDir( actor ) = { return( actor.location.sw ); }
  1253. ;
  1254. inVerb: travelVerb
  1255.     action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1256.     verb = 'in' 'go in' 'enter'
  1257.     sdesc = "enter"
  1258.     doAction = 'Enter'
  1259.     travelDir( actor ) = { return( actor.location.in ); }
  1260. ;
  1261. outVerb: travelVerb
  1262.     action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1263.     verb = 'out' 'go out' 'exit' 'leave'
  1264.     travelDir( actor ) = { return( actor.location.out ); }
  1265. ;
  1266. pushVerb: deepverb
  1267.     verb = 'push' 'press'
  1268.     sdesc = "push"
  1269.     doAction = 'Push'
  1270. ;
  1271. attachVerb: deepverb
  1272.     verb = 'attach' 'connect'
  1273.     sdesc = "attach"
  1274.     prepDefault = toPrep
  1275.     ioAction( toPrep ) = 'AttachTo'
  1276. ;
  1277. toPrep: Prep
  1278.     preposition = 'to'
  1279.     sdesc = "to"
  1280. ;
  1281. wearVerb: deepverb
  1282.     verb = 'wear' 'put on'
  1283.     sdesc = "wear"
  1284.     doAction = 'Wear'
  1285. ;
  1286. dropVerb: deepverb
  1287.     verb = 'drop' 'put down'
  1288.     sdesc = "drop"
  1289.     ioAction( onPrep ) = 'PutOn'
  1290.     doAction = 'Drop'
  1291.     doDefault( actor, prep, io ) =
  1292.     {
  1293.         return( actor.contents );
  1294.     }
  1295. ;
  1296. onPrep: Prep
  1297.     preposition = 'on' 'onto' 'downon' 'upon'
  1298.     sdesc = "on"
  1299. ;
  1300. removeVerb: deepverb
  1301.     verb = 'take off'
  1302.     sdesc = "take off"
  1303.     doAction = 'Unwear'
  1304.     ioAction( fromPrep ) = 'RemoveFrom'
  1305. ;
  1306. openVerb: deepverb
  1307.     verb = 'open'
  1308.     sdesc = "open"
  1309.     doAction = 'Open'
  1310. ;
  1311. closeVerb: deepverb
  1312.     verb = 'close'
  1313.     sdesc = "close"
  1314.     doAction = 'Close'
  1315. ;
  1316. putVerb: deepverb
  1317.     verb = 'put' 'place'
  1318.     sdesc = "put"
  1319.     prepDefault = inPrep
  1320.     ioAction( inPrep ) = 'PutIn'
  1321.     ioAction( onPrep ) = 'PutOn'
  1322.     doDefault( actor, prep, io ) =
  1323.     {
  1324.         return( takeVerb.doDefault( actor, prep, io ) + actor.contents );
  1325.     }
  1326. ;
  1327. inPrep: Prep
  1328.     preposition = 'in' 'into' 'downin'
  1329.     sdesc = "in"
  1330. ;
  1331. takeVerb: deepverb                   // This object defines how to take things
  1332.     verb = 'take' 'pick up' 'get' 'remove'
  1333.     sdesc = "take"
  1334.     ioAction( offPrep ) = 'TakeOff'
  1335.     ioAction( outPrep ) = 'TakeOut'
  1336.     ioAction( fromPrep ) = 'TakeOut'
  1337.     ioAction( inPrep ) = 'TakeOut'
  1338.     ioAction( onPrep ) = 'TakeOff'
  1339.     doAction = 'Take'
  1340.     doDefault( actor, prep, io ) =
  1341.     {
  1342.         local ret, rem, cur, rem2, cur2, tot, i, tot2, j;
  1343.     
  1344.     ret := [];
  1345.         
  1346.     /*
  1347.      *   For "take all out/off of <iobj>", return the (non-fixed)
  1348.      *   contents of the indirect object.  Same goes for "take all in
  1349.      *   <iobj>", "take all on <iobj>", and "take all from <iobj>".
  1350.      */
  1351.     if (( prep=outPrep or prep=offPrep or prep=inPrep or prep=onPrep
  1352.      or prep=fromPrep ) and io<>nil )
  1353.     {
  1354.         rem := io.contents;
  1355.         i := 1;
  1356.         tot := length( rem );
  1357.         while ( i <= tot )
  1358.         {
  1359.             cur := rem[i];
  1360.             if ( not cur.isfixed ) ret := ret + cur;
  1361.         i := i + 1;
  1362.         }
  1363.             return( ret );
  1364.     }
  1365.  
  1366.         /*
  1367.      *   In the general case, return everything that's not fixed
  1368.      *   in the actor's location, or everything inside fixed containers
  1369.      *   that isn't itself fixed.
  1370.      */
  1371.         rem := actor.location.contents;
  1372.     tot := length( rem );
  1373.     i := 1;
  1374.         while ( i <= tot )
  1375.         {
  1376.         cur := rem[i];
  1377.             if ( cur.isfixed )
  1378.             {
  1379.                 if ((( cur.isopenable and cur.isopen ) or
  1380.                   ( not cur.isopenable )) and ( not cur.isactor ))
  1381.                 {
  1382.                     rem2 := cur.contents;
  1383.             tot2 := length( rem2 );
  1384.             j := 1;
  1385.                     while ( j <= tot2 )
  1386.                     {
  1387.                 cur2 := rem2[j];
  1388.                         if ( not cur2.isfixed and not cur2.notakeall )
  1389.             {
  1390.                 ret := ret + cur2;
  1391.             }
  1392.                         j := j + 1;
  1393.                     }
  1394.                 }
  1395.             }
  1396.             else if ( not cur.notakeall )
  1397.         {
  1398.             ret := ret + cur;
  1399.         }
  1400.  
  1401.         i := i + 1;            
  1402.         }
  1403.         return( ret );
  1404.     }
  1405. ;
  1406. offPrep: Prep
  1407.     preposition = 'off' 'offof' 'offof'
  1408.     sdesc = "off"
  1409. ;
  1410. outPrep: Prep
  1411.     preposition = 'out' 'outof'
  1412.     sdesc = "out"
  1413. ;
  1414. plugVerb: deepverb
  1415.     verb = 'plug'
  1416.     sdesc = "plug"
  1417.     prepDefault = inPrep
  1418.     ioAction( inPrep ) = 'PlugIn'
  1419. ;
  1420. fromPrep: Prep
  1421.     preposition = 'from'
  1422.     sdesc = "from"
  1423. ;
  1424. qcontainer: container
  1425.     isqcontainer = true
  1426. ;
  1427. lockable: openable
  1428.     doOpen( actor ) =
  1429.     {
  1430.         if ( self.islocked )
  1431.         {
  1432.             "It's locked. ";
  1433.         }
  1434.         else pass doOpen;
  1435.     }
  1436.     verDoLock( actor ) =
  1437.     {
  1438.         if ( self.islocked )
  1439.         {
  1440.             "It's already locked! ";
  1441.         }
  1442.     }
  1443.     doLock( actor ) =
  1444.     {
  1445.         if ( self.isopen )
  1446.         {
  1447.             "You'll have to close "; self.thedesc; " first. ";
  1448.         }
  1449.         else
  1450.         {
  1451.             "Locked. ";
  1452.             self.islocked := true;
  1453.         }
  1454.     }
  1455.     verDoUnlock( actor ) =
  1456.     {
  1457.         if ( not self.islocked ) "It's not locked! ";
  1458.     }
  1459.     doUnlock( actor ) =
  1460.     {
  1461.         "Unlocked. ";
  1462.         self.islocked := nil;
  1463.     }
  1464.     verDoLockWith( actor, io ) =
  1465.     {
  1466.         if ( self.islocked ) "It's already locked. ";
  1467.     }
  1468.     verDoUnlockWith( actor, io ) =
  1469.     {
  1470.         if ( not self.islocked ) "It's not locked! ";
  1471.     }
  1472. ;
  1473. lookInVerb: deepverb
  1474.     verb = 'look in' 'look on'
  1475.     sdesc = "look in"
  1476.     doAction = 'Lookin'
  1477. ;
  1478. screwVerb: deepverb
  1479.     verb = 'screw'
  1480.     sdesc = "screw"
  1481.     ioAction( withPrep ) = 'ScrewWith'
  1482.     doAction = 'Screw'
  1483. ;
  1484. unscrewVerb: deepverb
  1485.     verb = 'unscrew'
  1486.     sdesc = "unscrew"
  1487.     ioAction( withPrep ) = 'UnscrewWith'
  1488.     doAction = 'Unscrew'
  1489. ;
  1490. turnVerb: deepverb
  1491.     verb = 'turn' 'rotate' 'twist'
  1492.     sdesc = "turn"
  1493.     ioAction( toPrep ) = 'TurnTo'
  1494.     ioAction( withPrep ) = 'TurnWith'
  1495.     doAction = 'Turn'
  1496. ;
  1497. articles: object
  1498.     article = 'the' 'a' 'an'
  1499. ;
  1500. betweenPrep: Prep
  1501.     preposition = 'between' 'inbetween'
  1502.     sdesc = "between"
  1503. ;
  1504. overPrep: Prep
  1505.     preposition = 'over'
  1506.     sdesc = "over"
  1507. ;
  1508. atPrep: Prep
  1509.     preposition = 'at'
  1510.     sdesc = "at"
  1511. ;
  1512. aroundPrep: Prep
  1513.     preposition = 'around'
  1514.     sdesc = "around"
  1515. ;
  1516. thruPrep: Prep
  1517.     preposition = 'through' 'thru'
  1518.     sdesc = "through"
  1519. ;
  1520. dirPrep: Prep
  1521.     preposition = 'north' 'south' 'east' 'west' 'up' 'down' 'northeast' 'ne'
  1522.                   'northwest' 'nw' 'southeast' 'se' 'southwest' 'sw'
  1523.     sdesc = "north"         // Shouldn't ever need this, but just in case
  1524. ;
  1525. switchVerb: deepverb
  1526.     verb = 'switch'
  1527.     sdesc = "switch"
  1528.     doAction = 'Switch'
  1529. ;
  1530. flipVerb: deepverb
  1531.     verb = 'flip'
  1532.     sdesc = "flip"
  1533.     doAction = 'Flip'
  1534. ;
  1535. turnOnVerb: deepverb
  1536.     verb = 'activate' 'turn on' 'switch on'
  1537.     sdesc = "turn on"
  1538.     doAction = 'Turnon'
  1539. ;
  1540. turnOffVerb: deepverb
  1541.     verb = 'turn off' 'deactiv' 'switch off'
  1542.     sdesc = "turn off"
  1543.     doAction = 'Turnoff'
  1544. ;
  1545. lookVerb: deepverb
  1546.     verb = 'look' 'l' 'look around'
  1547.     action( actor ) =
  1548.     {
  1549.         actor.location.lookAround( true );
  1550.     }
  1551. ;
  1552. darkroom: room              // An enterable area which might be dark
  1553.     islit =                 // true ONLY if something is lighting the room
  1554.     {
  1555.         local rem, cur, tot, i;
  1556.     
  1557.     rem := global.lamplist;
  1558.     tot := length( rem );
  1559.     i := 1;
  1560.     while ( i <= tot )
  1561.     {
  1562.         cur := rem[i];
  1563.         if ( cur.isIn( self ) and cur.islit ) return( true );
  1564.         i := i + 1;
  1565.     }
  1566.     return( nil );
  1567.     }
  1568.     roomAction( actor, v, do, prep, io ) =
  1569.     {
  1570.         if ( not self.islit and not v.isTravelVerb and not v.issysverb )
  1571.     {
  1572.         "You can't see a thing. ";
  1573.         exit;
  1574.     }
  1575.     else pass roomAction;
  1576.     }
  1577.     statusLine =
  1578.     {
  1579.         if ( self.islit ) pass statusLine;
  1580.     else "In the dark.";
  1581.     }
  1582.     lookAround( verbosity ) =
  1583.     {
  1584.         if ( self.islit ) pass lookAround;
  1585.     else "It's pitch black. ";
  1586.     }
  1587.     noexit =
  1588.     {
  1589.         if ( self.islit ) pass noexit;
  1590.     else
  1591.     {
  1592.         darkTravel();
  1593.         return( nil );
  1594.     }
  1595.     }
  1596.     roomCheck( v ) =
  1597.     {
  1598.         if ( self.islit or v.issysverb or v.isTravelVerb ) return( true );
  1599.     else
  1600.     {
  1601.         "It's pitch black.\n";
  1602.         return( nil );
  1603.     }
  1604.     }
  1605. ;
  1606. sitVerb: deepverb
  1607.     verb = 'sit on' 'sit in' 'sit' 'sit down' 'sit downin' 'sit downon'
  1608.     sdesc = "sit on"
  1609.     doAction = 'Siton'
  1610. ;
  1611. lieVerb: deepverb
  1612.     verb = 'lie' 'lie on' 'lie in' 'lie down' 'lie downon' 'lie downin'
  1613.     sdesc = "lie on"
  1614.     doAction = 'Lieon'
  1615. ;
  1616. theFloor: beditem
  1617.     noun = 'floor' 'ground'
  1618.     sdesc = "ground"
  1619.     adesc = "the ground"
  1620.     location =
  1621.     {
  1622.         if ( Me.location = self )
  1623.             return( self.sitloc );
  1624.         else
  1625.             return( Me.location );
  1626.     }
  1627.     locationOK = true         // suppress warning about location being a method
  1628.     doSiton( actor ) =
  1629.     {
  1630.         "Okay, you're now sitting on "; self.thedesc; ". ";
  1631.         self.sitloc := actor.location;
  1632.         actor.moveInto( self );
  1633.     }
  1634.     doLieon( actor ) =
  1635.     {
  1636.         self.doSiton( actor );
  1637.     }
  1638.     ioPutOn( actor, do ) =
  1639.     {
  1640.         do.doDrop( actor );
  1641.     }
  1642.     ioPutIn( actor, do ) =
  1643.     {
  1644.         do.doDrop( actor );
  1645.     }
  1646. ;
  1647. beditem: chairitem
  1648.     ischair = nil
  1649.     isbed = true
  1650.     sdesc = "bed"
  1651. ;
  1652. getOutVerb: deepverb
  1653.     verb = 'get out' 'get outof' 'get off' 'get offof'
  1654.     sdesc = "get out of"
  1655.     doAction = 'Unboard'
  1656.     doDefault( actor, prep, io ) =
  1657.     {
  1658.         if ( actor.location and actor.location.location )
  1659.             return( [] + actor.location );
  1660.         else return( [] );
  1661.     }
  1662. ;
  1663. boardVerb: deepverb
  1664.     verb = 'get in' 'get into' 'board'
  1665.     sdesc = "get on"
  1666.     doAction = 'Board'
  1667. ;
  1668. againVerb: deepverb         // Required verb:  repeats last command.  No
  1669.                             // action routines are necessary; this one's
  1670.                             // handled internally by the parser.
  1671.     verb = 'again' 'g'
  1672. ;
  1673. waitVerb: deepverb
  1674.     verb = 'wait' 'z'
  1675.     action( actor ) =
  1676.     {
  1677.         "Time passes...\n";
  1678.     }
  1679. ;
  1680. iVerb: deepverb
  1681.     verb = 'inventory' 'i'
  1682.     action( actor ) =
  1683.     {
  1684.         if (length( actor.contents ))
  1685.         {
  1686.             "You have "; listcont( actor ); ". ";
  1687.             listcontcont( actor );
  1688.         }
  1689.     else
  1690.             "You are empty-handed.\n";
  1691.     }
  1692. ;
  1693. lookThruVerb: deepverb
  1694.     verb = 'look through' 'look thru'
  1695.     sdesc = "look through"
  1696.     doAction = 'Lookthru'
  1697. ;
  1698. sysverb: deepverb
  1699.     issysverb = true
  1700. ;
  1701. quitVerb: sysverb
  1702.     verb = 'quit'
  1703.     action( actor ) =
  1704.     {
  1705.         local yesno;
  1706.  
  1707.         scoreRank();
  1708.         "\bDo you really want to quit? (YES or NO) > ";
  1709.         yesno := yorn();
  1710.         "\b";
  1711.         if ( yesno = 1 )
  1712.         {
  1713.             terminate();    // allow user good-bye message
  1714.         quit();
  1715.         }
  1716.         else
  1717.         {
  1718.             "Okay. ";
  1719.         }
  1720.     abort;
  1721.     }
  1722. ;
  1723. verboseVerb: sysverb
  1724.     verb = 'verbose'
  1725.     action( actor ) =
  1726.     {
  1727.         "Okay, now in VERBOSE mode.\n";
  1728.         global.verbose := true;
  1729.     Me.location.lookAround( true );
  1730.     abort;
  1731.     }
  1732. ;
  1733. terseVerb: sysverb
  1734.     verb = 'brief' 'terse'
  1735.     action( actor ) =
  1736.     {
  1737.         "Okay, now in TERSE mode.\n";
  1738.         global.verbose := nil;
  1739.     abort;
  1740.     }
  1741. ;
  1742. scoreVerb: sysverb
  1743.     verb = 'score' 'status'
  1744.     action( actor ) =
  1745.     {
  1746.         scoreRank();
  1747.     abort;
  1748.     }
  1749. ;
  1750. saveVerb: sysverb
  1751.     verb = 'save'
  1752.     sdesc = "save"
  1753.     doAction = 'Save'
  1754.     action( actor ) =
  1755.     {
  1756.         local savefile;
  1757.     
  1758.     savefile := askfile( 'File to save game in' );
  1759.     if ( savefile = nil or savefile = '' )
  1760.         "Failed. ";
  1761.     else if (save( savefile ))
  1762.         "Saved failed. ";
  1763.     else
  1764.         "Saved. ";
  1765.     abort;
  1766.     }
  1767. ;
  1768. restoreVerb: sysverb
  1769.     verb = 'restore'
  1770.     sdesc = "save"
  1771.     doAction = 'Restore'
  1772.     action( actor ) =
  1773.     {
  1774.         local savefile;
  1775.     
  1776.     savefile := askfile( 'File to restore game from' );
  1777.     if ( savefile = nil or savefile = '' )
  1778.         "Failed. ";
  1779.     else if (restore( savefile ))
  1780.         "Restore failed. ";
  1781.     else
  1782.     {
  1783.         setscore( global.score, global.turnsofar );
  1784.         "Restored. ";
  1785.     }
  1786.     abort;
  1787.     }
  1788. ;
  1789. scriptVerb: deepverb
  1790.     verb = 'script'
  1791.     doAction = 'Script'
  1792.     action( actor ) =
  1793.     {
  1794.         local scriptfile;
  1795.     
  1796.     scriptfile := askfile( 'File to write transcript to' );
  1797.     if ( scriptfile = nil or scriptfile = '' )
  1798.         "Failed. ";
  1799.     else
  1800.     {
  1801.         logging( scriptfile );
  1802.         "Writing script file. ";
  1803.     }
  1804.     abort;
  1805.     }
  1806. ;
  1807. unscriptVerb: sysverb
  1808.     verb = 'unscript'
  1809.     action( actor ) =
  1810.     {
  1811.         logging( nil );
  1812.         "Script closed.\n";
  1813.         abort;
  1814.     }
  1815. ;
  1816. restartVerb: sysverb
  1817.     verb = 'restart'
  1818.     action( actor ) =
  1819.     {
  1820.         local yesno;
  1821.         while ( true )
  1822.         {
  1823.             "Are you sure you want to start over? (YES or NO) > ";
  1824.             yesno := yorn();
  1825.             if ( yesno = 1 )
  1826.             {
  1827.                 "\n";
  1828.         setscore( 0, 0 );
  1829.                 restart();
  1830.                 abort;
  1831.             }
  1832.             else if ( yesno = 0 )
  1833.             {
  1834.                 "\nOkay.\n";
  1835.                 abort;
  1836.             }
  1837.         }
  1838.     }
  1839. ;
  1840. attackVerb: deepverb
  1841.     verb = 'attack' 'kill' 'hit'
  1842.     sdesc = "attack"
  1843.     prepDefault = withPrep
  1844.     ioAction( withPrep ) = 'AttackWith'
  1845. ;
  1846. climbVerb: deepverb
  1847.     verb = 'climb'
  1848.     sdesc = "climb"
  1849.     doAction = 'Climb'
  1850. ;
  1851. eatVerb: deepverb
  1852.     verb = 'eat' 'consume'
  1853.     sdesc = "eat"
  1854.     doAction = 'Eat'
  1855. ;
  1856. drinkVerb: deepverb
  1857.     verb = 'drink'
  1858.     sdesc = "drink"
  1859.     doAction = 'Drink'
  1860. ;
  1861. giveVerb: deepverb
  1862.     verb = 'give' 'offer'
  1863.     sdesc = "give"
  1864.     prepDefault = toPrep
  1865.     ioAction( toPrep ) = 'GiveTo'
  1866. ;
  1867. pullVerb: deepverb
  1868.     verb = 'pull'
  1869.     sdesc = "pull"
  1870.     doAction = 'Pull'
  1871. ;
  1872. readVerb: deepverb
  1873.     verb = 'read'
  1874.     sdesc = "read"
  1875.     doAction = 'Read'
  1876. ;
  1877. throwVerb: deepverb
  1878.     verb = 'throw' 'toss'
  1879.     sdesc = "throw"
  1880.     prepDefault = atPrep
  1881.     ioAction( atPrep ) = 'ThrowAt'
  1882.     ioAction( toPrep ) = 'ThrowTo'
  1883. ;
  1884. standOnVerb: deepverb
  1885.     verb = 'stand on'
  1886.     sdesc = "stand on"
  1887.     doAction = 'Standon'
  1888. ;
  1889. standVerb: deepverb
  1890.     verb = 'stand' 'stand up' 'get up'
  1891.     sdesc = "stand"
  1892.     action( actor ) =
  1893.     {
  1894.         if ( actor.location=nil )
  1895.             "You're already standing! ";
  1896.         else if ( actor.location.location=nil )
  1897.             "You're already standing! ";
  1898.         else
  1899.         {
  1900.         actor.location.doUnboard( actor );
  1901.         }
  1902.     }
  1903. ;
  1904. helloVerb: deepverb
  1905.     verb = 'hello' 'hi' 'greetings'
  1906.     action( actor ) =
  1907.     {
  1908.         "Nice weather we've been having.\n";
  1909.     }
  1910. ;
  1911. versionVerb: sysverb
  1912.     verb = 'version'
  1913.     action( actor ) =
  1914.     {
  1915.         version.sdesc;
  1916.         abort;
  1917.     }
  1918. ;
  1919. showVerb: deepverb
  1920.     verb = 'show'
  1921.     sdesc = "show"
  1922.     prepDefault = toPrep
  1923.     ioAction( toPrep ) = 'ShowTo'
  1924. ;
  1925. cleanVerb: deepverb
  1926.     verb = 'clean'
  1927.     sdesc = "clean"
  1928.     ioAction( withPrep ) = 'CleanWith'
  1929.     doAction = 'Clean'
  1930. ;
  1931. sayVerb: deepverb
  1932.     verb = 'say'
  1933.     sdesc = "say"
  1934.     doAction = 'Say'
  1935. ;
  1936. yellVerb: deepverb
  1937.     verb = 'yell' 'shout' 'yell at' 'shout at'
  1938.     action( actor ) =
  1939.     {
  1940.         "Your throat is a bit sore now. ";
  1941.     }
  1942. ;
  1943. moveVerb: deepverb
  1944.     verb = 'move'
  1945.     sdesc = "move"
  1946.     ioAction( withPrep ) = 'MoveWith'
  1947.     ioAction( toPrep ) = 'MoveTo'
  1948.     doAction = 'Move'
  1949. ;
  1950. fastenVerb: deepverb
  1951.     verb = 'fasten' 'buckle' 'buckle up'
  1952.     sdesc = "fasten"
  1953.     doAction = 'Fasten'
  1954. ;
  1955. unfastenVerb: deepverb
  1956.     verb = 'unfasten' 'unbuckle'
  1957.     sdesc = "unfasten"
  1958.     doAction = 'Unfasten'
  1959. ;
  1960. unplugVerb: deepverb
  1961.     verb = 'unplug'
  1962.     sdesc = "unplug"
  1963.     ioAction( fromPrep ) = 'UnplugFrom'
  1964.     doAction = 'Unplug'
  1965. ;
  1966. prepUnder: Prep
  1967.     preposition = 'under' 'beneath'
  1968.     sdesc = "under"
  1969. ;
  1970. lookUnderVerb: deepverb
  1971.     verb = 'look under' 'look beneath'
  1972.     sdesc = "look under"
  1973.     doAction = 'Lookunder'
  1974. ;
  1975. behindPrep: Prep
  1976.     preposition = 'behind'
  1977.     sdesc = "behind"
  1978. ;
  1979. lookBehindVerb: deepverb
  1980.     verb = 'look behind'
  1981.     sdesc = "look behind"
  1982.     doAction = 'Lookbehind'
  1983. ;
  1984. typeVerb: deepverb
  1985.     verb = 'type'
  1986.     sdesc = "type"
  1987.     prepDefault = onPrep
  1988.     ioAction( onPrep ) = 'TypeOn'
  1989. ;
  1990. lockVerb: deepverb
  1991.     verb = 'lock'
  1992.     sdesc = "lock"
  1993.     ioAction( withPrep ) = 'LockWith'
  1994.     doAction = 'Lock'
  1995.     prepDefault = withPrep
  1996. ;
  1997. unlockVerb: deepverb
  1998.     verb = 'unlock'
  1999.     sdesc = "unlock"
  2000.     ioAction( withPrep ) = 'UnlockWith'
  2001.     doAction = 'Unlock'
  2002.     prepDefault = withPrep
  2003. ;
  2004. readable: item
  2005.     verDoRead( actor ) =
  2006.     {
  2007.     }
  2008.     doRead( actor ) =
  2009.     {
  2010.         self.readdesc;
  2011.     }
  2012.     readdesc =
  2013.     {
  2014.         self.ldesc;
  2015.     }
  2016. ;
  2017. detachVerb: deepverb
  2018.     verb = 'detach' 'disconnect'
  2019.     prepDefault = fromPrep
  2020.     ioAction( fromPrep ) = 'DetachFrom'
  2021.     doAction = 'Detach'
  2022.     sdesc = "detach"
  2023. ;
  2024. sleepVerb: deepverb
  2025.     action( actor ) =
  2026.     {
  2027.         if ( actor.cantSleep )
  2028.             "You are much too anxious worrying about your continued
  2029.             survival to fall asleep now. ";
  2030.         else if ( global.awakeTime+1 < global.sleepTime )
  2031.             "You're not tired. ";
  2032.         else if ( not ( actor.location.isbed or actor.location.ischair ))
  2033.             "I don't know about you, but I can never sleep
  2034.             standing up. You should find a nice comfortable
  2035.             bed somewhere. ";
  2036.         else
  2037.         {
  2038.             "You quickly drift off into dreamland...\b";
  2039.             goToSleep();
  2040.         }
  2041.     }
  2042.     verb = 'sleep'
  2043. ;
  2044. fooditem: item
  2045.     verDoEat( actor ) = {}
  2046.     doEat( actor ) =
  2047.     {
  2048.         "That was delicious! ";
  2049.         global.lastMealTime := 0;
  2050.         self.moveInto( nil );
  2051.     }
  2052. ;
  2053. pokeVerb: deepverb
  2054.     verb = 'poke' 'jab'
  2055.     sdesc = "poke"
  2056.     doAction = 'Poke'
  2057. ;
  2058. touchVerb: deepverb
  2059.     verb = 'touch'
  2060.     sdesc = "touch"
  2061.     doAction = 'Touch'
  2062. ;
  2063. moveNVerb: deepverb
  2064.     verb = 'move north' 'move n' 'push north' 'push n'
  2065.     sdesc = "move north"
  2066.     doAction = 'MoveN'
  2067. ;
  2068. moveSVerb: deepverb
  2069.     verb = 'move south' 'move s' 'push south' 'push s'
  2070.     sdesc = "move south"
  2071.     doAction = 'MoveS'
  2072. ;
  2073. moveEVerb: deepverb
  2074.     verb = 'move east' 'move e' 'push east' 'push e'
  2075.     sdesc = "move east"
  2076.     doAction = 'MoveE'
  2077. ;
  2078. moveWVerb: deepverb
  2079.     verb = 'move west' 'move w' 'push west' 'push w'
  2080.     sdesc = "move west"
  2081.     doAction = 'MoveW'
  2082. ;
  2083. moveNEVerb: deepverb
  2084.     verb = 'move northeast' 'move ne' 'push northeast' 'push ne'
  2085.     sdesc = "move northeast"
  2086.     doAction = 'MoveNE'
  2087. ;
  2088. moveNWVerb: deepverb
  2089.     verb = 'move northwest' 'move nw' 'push northwest' 'push nw'
  2090.     sdesc = "move west"
  2091.     doAction = 'MoveNW'
  2092. ;
  2093. moveSEVerb: deepverb
  2094.     verb = 'move southeast' 'move se' 'push southeast' 'push se'
  2095.     sdesc = "move southeast"
  2096.     doAction = 'MoveSE'
  2097. ;
  2098. moveSWVerb: deepverb
  2099.     verb = 'move southwest' 'move sw' 'push southwest' 'push sw'
  2100.     sdesc = "move southwest"
  2101.     doAction = 'MoveSW'
  2102. ;
  2103. centerVerb: deepverb
  2104.     verb = 'center'
  2105.     sdesc = "center"
  2106.     doAction = 'Center'
  2107. ;
  2108. searchVerb: deepverb
  2109.     verb = 'search'
  2110.     sdesc = "search"
  2111.     doAction = 'Search'
  2112. ;
  2113. class basicMe: Actor
  2114.     roomCheck( v ) = { return( self.location.roomCheck( v )); }
  2115.     noun = 'me' 'i' 'myself'
  2116.     sdesc = "you"
  2117.     thedesc = "yourself"
  2118.     adesc = "yourself"
  2119.     maxweight = 10
  2120.     maxbulk = 10
  2121.     verDoFollow( actor ) =
  2122.     {
  2123.         if ( actor = self ) "You can't follow yourself! ";
  2124.     }
  2125.     actorAction( verb, dobj, prep, iobj ) = 
  2126.     {
  2127.     }
  2128.     travelTo( room ) =
  2129.     {
  2130.         if ( room )
  2131.         {
  2132.         if ( not ( self.location.islit or room.islit ))
  2133.         {
  2134.             darkTravel();
  2135.         }
  2136.         else
  2137.         {
  2138.                 if ( self.location ) self.location.leaveRoom( self );
  2139.                 self.location := room;
  2140.                 room.enterRoom( self );
  2141.         }
  2142.         }
  2143.     }
  2144.     moveInto( room ) =
  2145.     {
  2146.         self.location := room;
  2147.     }
  2148. ;
  2149. dialItem: fixeditem
  2150.     maxsetting = 10 // it has settings from 1 to this number
  2151.     setting = 1     // the current setting
  2152.     ldesc =
  2153.     {
  2154.         caps(); self.thedesc; " can be turned to settings
  2155.         numbered from 1 to << self.maxsetting >>. It's
  2156.         currently set to << self.setting >>. ";
  2157.     }
  2158.     verDoTurn( actor ) = {}
  2159.     doTurn( actor ) =
  2160.     {
  2161.         askio( toPrep );
  2162.     }
  2163.     verDoTurnTo( actor, io ) = {}
  2164.     doTurnTo( actor, io ) =
  2165.     {
  2166.         if ( io = numObj )
  2167.         {
  2168.             if ( numObj.value < 1 or numObj.value > self.maxsetting )
  2169.             {
  2170.                 "There's no such setting! ";
  2171.             }
  2172.             else if ( numObj.value <> self.setting )
  2173.             {
  2174.                 self.setting := numObj.value;
  2175.                 "Okay, it's now turned to "; say( self.setting ); ". ";
  2176.             }
  2177.             else
  2178.             {
  2179.                 "It's already set to "; say( self.setting ); "! ";
  2180.             }
  2181.         }
  2182.         else
  2183.         {
  2184.             "I don't know how to turn "; self.thedesc;
  2185.             " to that. ";
  2186.         }
  2187.     }
  2188. ;
  2189. keyedLockable: lockable
  2190.     mykey = nil     // set 'mykey' to the key which locks/unlocks me
  2191.     doLock( actor ) =
  2192.     {
  2193.         askio( withPrep );
  2194.     }
  2195.     doUnlock( actor ) =
  2196.     {
  2197.         askio( withPrep );
  2198.     }
  2199.     doLockWith( actor, io ) =
  2200.     {
  2201.         if ( self.isopen )
  2202.         {
  2203.             "You can't lock << self.thedesc >> when it's open. ";
  2204.         }
  2205.         else if ( io = self.mykey )
  2206.         {
  2207.             "Locked. ";
  2208.             self.islocked := true;
  2209.         }
  2210.         else "It doesn't fit the lock. ";
  2211.     }
  2212.     doUnlockWith( actor, io ) =
  2213.     {
  2214.         if ( io = self.mykey )
  2215.         {
  2216.             "Unlocked. ";
  2217.             self.islocked := nil;
  2218.         }
  2219.         else "It doesn't fit the lock. ";
  2220.     }
  2221. ;
  2222. keyItem: item
  2223.     verIoUnlockWith( actor ) = {}
  2224.     ioUnlockWith( actor, do ) =
  2225.     {
  2226.         do.doUnlockWith( actor, self );
  2227.     }
  2228.     verIoLockWith( actor ) = {}
  2229.     ioLockWith( actor, do ) =
  2230.     {
  2231.         do.doLockWith( actor, self );
  2232.     }
  2233. ;
  2234. switchItem: fixeditem
  2235.     verDoSwitch( actor ) = {}
  2236.     doSwitch( actor ) =
  2237.     {
  2238.         self.isActive := not self.isActive;
  2239.         "Okay, "; self.thedesc; " is now switched ";
  2240.         if ( self.isActive ) "on"; else "off";
  2241.         ". ";
  2242.     }
  2243.     verDoTurnon( actor ) =
  2244.     {
  2245.         if ( self.isActive ) "It's already turned on! ";
  2246.     }
  2247.     doTurnon( actor ) =
  2248.     {
  2249.         self.isActive := true;
  2250.         "Okay, it's now turned on. ";
  2251.     }
  2252.     verDoTurnoff( actor ) =
  2253.     {
  2254.         if ( not self.isActive ) "It's already turned off! ";
  2255.     }
  2256.     doTurnoff( actor ) =
  2257.     {
  2258.         self.isActive := nil;
  2259.         "Okay, it's now turned off. ";
  2260.     }
  2261. ;
  2262.  
  2263. basicStrObj: object              // when a string is used in a player command,
  2264.     value = ''              //  this is set to its value
  2265.     sdesc = "that"
  2266.     adesc = "that"
  2267.     thedesc = "that"
  2268.     verDoTypeOn( actor, io ) = {}
  2269.     doTypeOn( actor, io ) = { "\"Tap, tap, tap, tap...\" "; }
  2270.     verDoSave( actor ) = {}
  2271.     doSave( actor ) =
  2272.     {
  2273.         if (save( self.value ))
  2274.             "Save failed. ";
  2275.         else
  2276.             "Saved. ";
  2277.     abort;
  2278.     }
  2279.     verDoRestore( actor ) = {}
  2280.     doRestore( actor ) =
  2281.     {
  2282.         if (restore( self.value ))
  2283.             "Restore failed. ";
  2284.         else
  2285.     {
  2286.             "Restored. ";
  2287.         setscore( global.score, global.turnsofar );
  2288.     }
  2289.         abort;
  2290.     }
  2291.     verDoScript( actor ) = {}
  2292.     doScript( actor ) =
  2293.     {
  2294.         logging( self.value );
  2295.         "Writing script file. ";
  2296.         abort;
  2297.     }
  2298.     verDoSay( actor ) = {}
  2299.     doSay( actor ) =
  2300.     {
  2301.         "Okay, \""; say( self.value ); "\".";
  2302.     }
  2303. ;
  2304.  
  2305. basicNumObj: object              // when a number is used in a player command,
  2306.     value = 0               //  this is set to its value
  2307.     sdesc = "that"
  2308.     adesc = "that"
  2309.     thedesc = "that"
  2310.     verDoTypeOn( actor, io ) = {}
  2311.     doTypeOn( actor, io ) = { "\"Tap, tap, tap, tap...\" "; }
  2312.     verIoTurnTo( actor ) = {}
  2313.     ioTurnTo( actor, do ) = { do.doTurnTo( actor, self ); }
  2314. ;
  2315.