home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume18 / ccr / part01 < prev    next >
Encoding:
Internet Message Format  |  1993-07-18  |  58.7 KB

  1. Path: uunet!news.tek.com!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v18i016:  ccr - colossal cave (adventure) implemented in TADS, Part01/11
  5. Date: 12 Jul 1993 19:27:59 GMT
  6. Organization: Tektronix, Inc, Redmond, OR, USA
  7. Lines: 2137
  8. Approved: billr@saab.CNA.TEK.COM
  9. Message-ID: <21sdvv$1bk@ying.cna.tek.com>
  10. NNTP-Posting-Host: saab.cna.tek.com
  11. Xref: uunet comp.sources.games:1816
  12.  
  13. Submitted-by: David Baggett <dmb@xbar.ai.mit.edu>
  14. Posting-number: Volume 18, Issue 16
  15. Archive-name: ccr/part01
  16. Environment: TADS
  17.  
  18.     [This is a rewrite of the original Colossal Cave Adventure in the
  19.      TADS adventure writing language. A machine independant compiled
  20.      game file is provided for those systems that may already have
  21.      the TADS runtime program, but not the compiler. Note that the
  22.      game file is uuencoded and split. The built.sh shell script puts
  23.      it back together. Runtime executables can be obtain via ftp from
  24.      the archive sites listed in the README.1ST file.  -br]
  25.  
  26. #! /bin/sh
  27. # This is a shell archive.  Remove anything before this line, then unpack
  28. # it by saving it into a file and typing "sh file".  To overwrite existing
  29. # files, type "sh file -c".  You can also feed this as standard input via
  30. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  31. # will see the following message at the end:
  32. #        "End of archive 1 (of 11)."
  33. # Contents:  MANIFEST README.1ST src src/ccr-adv.t2 src/thingext.t
  34. # Wrapped by billr@saab on Mon Jul 12 12:02:42 1993
  35. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  36. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  37.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  38. else
  39. echo shar: Extracting \"'MANIFEST'\" \(1044 characters\)
  40. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  41. X   File Name        Archive #    Description
  42. X-----------------------------------------------------------
  43. X MANIFEST                   1    This shipping list
  44. X README.1ST                 1    
  45. X buildit.sh                 4    
  46. X catalog                   11    
  47. X ccr.gam.uu1                6    
  48. X ccr.gam.uu2                4    
  49. X ccr.gam.uu3                5    
  50. X ccr.gam.uu4                7    
  51. X contact.us                 6    
  52. X copying.doc               10    
  53. X general.doc               11    
  54. X readme                    11    
  55. X readme.unix                3    
  56. X src                        1    
  57. X src/ccr-adv.t1             8    
  58. X src/ccr-adv.t2             1    
  59. X src/ccr-item.t             9    
  60. X src/ccr-npc.t              9    
  61. X src/ccr-room.t1            3    
  62. X src/ccr-room.t2            2    
  63. X src/ccr-std.t             10    
  64. X src/ccr-verb.t            10    
  65. X src/ccr.t                  9    
  66. X src/close.t               11    
  67. X src/format.t               5    
  68. X src/help.t                11    
  69. X src/history.t              8    
  70. X src/makefile               9    
  71. X src/preparse.t             7    
  72. X src/thingext.t             1    
  73. END_OF_FILE
  74. if test 1044 -ne `wc -c <'MANIFEST'`; then
  75.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  76. fi
  77. # end of 'MANIFEST'
  78. fi
  79. if test -f 'README.1ST' -a "${1}" != "-c" ; then 
  80.   echo shar: Will not clobber existing file \"'README.1ST'\"
  81. else
  82. echo shar: Extracting \"'README.1ST'\" \(2683 characters\)
  83. sed "s/^X//" >'README.1ST' <<'END_OF_FILE'
  84. X
  85. X
  86. XDISTRIBUTION POLICY
  87. X-------------------
  88. X
  89. XThis source code is copylefted under the terms of the GNU Public
  90. XLicense.  Essentially, this means that you are allowed to do whatever
  91. Xyou wish with this source code, provided you do not charge any money
  92. Xfor it or for any derivative works.
  93. X
  94. XADVENTIONS distributes this game, but you are free to do what you will
  95. Xwith it, provided you adhere to the terms in the GNU Public License,
  96. Xwhich is in the file copying.doc.  Send correspondence regarding this
  97. Xgame or original works distributed by ADVENTIONS to
  98. X
  99. X    ADVENTIONS
  100. X    PO Box 851
  101. X    Columbia, MD 21044
  102. X
  103. XIf you would like a catalog of releases, please enclose a SASE.  Thanks!
  104. X
  105. X
  106. XIMPORTANT NOTE
  107. X--------------
  108. X
  109. XThis archive contains the machine-independent versions of the game.
  110. XThat means that the .GAM file enclosed here will run on any machine
  111. Xthat has a TADS 2.1.0 (or later) run-time program.  It also means,
  112. Xhowever, that the version of the run-time for *your* system is not
  113. Xincluded in this archive, and you will have to get it separately
  114. X(probably from the same place you got this archive).
  115. X
  116. XIf you're now extremely annoyed that you can't play the game you just
  117. Xdownloaded, we apologize!  But there are simply too many machines
  118. Xrunning TADS now for us to make an archive that will support all of
  119. Xthem "out of the box."  Also, packaging the games this way saves space,
  120. Xsince we don't have to include the run-time program in each archive.
  121. X
  122. XOnce you have the run-time program for your system (usually called "tr"
  123. Xor "tadsr"), you can run the game by typing
  124. X
  125. X    tadsr <game>
  126. X
  127. Xwhere <game> is the filename of the TADS .GAM file.
  128. X
  129. XIf you have access to the Internet, you can download the latest version
  130. Xof TADS for your system from ftp.gmd.de:
  131. X
  132. X    if-archive/programming/tads/*.tads2exe.*
  133. X
  134. XThis site is mirrored on wuarchive.wustl.edu in pub/mirrors/if-archive.
  135. X
  136. X
  137. XHelp!
  138. X-----
  139. X
  140. XIf you can't find the TADS system for your machine anywhere, contact
  141. XHigh Energy Software:
  142. X
  143. X
  144. X    High Energy BBS:
  145. X       The fastest way to reach us is through the High Energy BBS.  Set
  146. X       your modem to 14,400 bps (or any lower speed), N-8-1, and dial
  147. X       415-493-2420.  The BBS is open to the public -- you don't need to
  148. X       be a registered user of any our products to access the system.
  149. X       Feel free to browse the message conferences and libraries on the
  150. X       BBS; you may be able to find the answer to your question without
  151. X       having to wait for a reply.  Address specific questions to SYSOP.
  152. X
  153. X    Internet:
  154. X       support@hinrg.starconn.com
  155. X
  156. X    CompuServe:
  157. X       73737,417
  158. X
  159. X    GEnie:
  160. X       M.ROBERTS10
  161. X
  162. X    USPS:
  163. X       High Energy Software
  164. X       P.O. Box 50422
  165. X       Palo Alto, CA  94303
  166. X
  167. X
  168. END_OF_FILE
  169. if test 2683 -ne `wc -c <'README.1ST'`; then
  170.     echo shar: \"'README.1ST'\" unpacked with wrong size!
  171. fi
  172. # end of 'README.1ST'
  173. fi
  174. if test ! -d 'src' ; then
  175.     echo shar: Creating directory \"'src'\"
  176.     mkdir 'src'
  177. fi
  178. if test -f 'src/ccr-adv.t2' -a "${1}" != "-c" ; then 
  179.   echo shar: Will not clobber existing file \"'src/ccr-adv.t2'\"
  180. else
  181. echo shar: Extracting \"'src/ccr-adv.t2'\" \(47810 characters\)
  182. sed "s/^X//" >'src/ccr-adv.t2' <<'END_OF_FILE'
  183. X        actor.moveInto( self );
  184. X    }
  185. X    doLieon( actor ) =
  186. X    {
  187. X    // DMB changed so it says "lying."
  188. X        "Okay, %you're% now lying on "; self.thedesc; ". ";
  189. X        self.sitloc := actor.location;
  190. X        actor.moveInto( self );
  191. X    }
  192. X    ioPutOn( actor, dobj ) =
  193. X    {
  194. X        dobj.doDrop( actor );
  195. X    }
  196. X    ioPutIn( actor, dobj ) =
  197. X    {
  198. X        dobj.doDrop( actor );
  199. X    }
  200. X;
  201. X
  202. X/*
  203. X@Actor: fixeditem, movableActor
  204. XA character in the game.  The \tt maxweight\ property specifies
  205. Xthe maximum weight that the character can carry, and the \tt maxbulk\
  206. Xproperty specifies the maximum bulk the character can carry.  The
  207. X\tt actorAction( \it verb, directObject, preposition, indirectObject\ )\
  208. Xmethod specifies what happens when the actor is given a command by
  209. Xthe player; by default, the actor ignores the command and displays
  210. Xa message to this effect.  The \tt isCarrying( \it object\ )\
  211. Xmethod returns \tt true\ if the \it object\ is being carried by
  212. Xthe actor.  The \tt actorDesc\ method displays a message when the
  213. Xactor is in the current room; this message is displayed along with
  214. Xa room's description when the room is entered or examined.  The
  215. X\tt verGrab( \it object\ )\ method is called when someone tries to
  216. Xtake an object the actor is carrying; by default, an actor won't
  217. Xlet other characters take its possessions.
  218. X
  219. XIf you want the player to be able to follow the actor when it
  220. Xleaves the room, you should define a \tt follower\ object to shadow
  221. Xthe character, and set the actor's \tt myfollower\ property to
  222. Xthe \tt follower\ object.  The \tt follower\ is then automatically
  223. Xmoved around just behind the actor by the actor's \tt moveInto\
  224. Xmethod.
  225. X
  226. XThe \tt isHim\ property should return \tt true\ if the actor can
  227. Xbe referred to by the player as ``him,'' and likewise \tt isHer\
  228. Xshould be set to \tt true\ if the actor can be referred to as ``her.''
  229. XNote that both or neither can be set; if neither is set, the actor
  230. Xcan only be referred to as ``it,'' and if both are set, any of ``him,''
  231. X``her,'' or ``it'' will be accepted.
  232. X*/
  233. Xclass Actor: fixeditem, movableActor
  234. X;
  235. X
  236. X/*
  237. X@movableActor: qcontainer
  238. XJust like an \tt Actor\ object, except that the player can
  239. Xmanipulate the actor like an ordinary item.  Useful for certain
  240. Xtypes of actors, such as small animals.
  241. X*/
  242. Xclass movableActor: qcontainer // A character in the game
  243. X    isListed = nil          // described separately from room's contents
  244. X    weight = 10             // actors are pretty heavy
  245. X    bulk = 10               // and pretty bulky
  246. X    maxweight = 50          // Weight that can be carried at once
  247. X    maxbulk = 20            // Number of objects that can be carried at once
  248. X    isactor = true          // flag that this is an actor
  249. X    actorAction( v, d, p, i ) =
  250. X    {
  251. X        caps(); self.thedesc; " doesn't appear interested. ";
  252. X        exit;
  253. X    }
  254. X    isCarrying( obj ) = { return( obj.isIn( self )); }
  255. X    actorDesc =
  256. X    {
  257. X        caps(); self.adesc; " is here. ";
  258. X    }
  259. X    verGrab( item ) =
  260. X    {
  261. X        caps(); self.thedesc; " is carrying "; item.thedesc;
  262. X        " and won't let %youm% have it. ";
  263. X    }
  264. X    verDoFollow( actor ) =
  265. X    {
  266. X        "But "; self.thedesc; " is right here! ";
  267. X    }
  268. X    moveInto( obj ) =
  269. X    {
  270. X        if ( self.myfollower ) self.myfollower.moveInto( self.location );
  271. X    pass moveInto;
  272. X    }
  273. X    // these properties are for the format strings
  274. X    fmtYou = "he"
  275. X    fmtYour = "his"
  276. X    fmtYoure = "he's"
  277. X    fmtYoum = "him"
  278. X    fmtYouve = "he's"
  279. X    fmtS = "s"
  280. X    fmtEs = "es"
  281. X    fmtHave = "has"
  282. X    fmtDo = "does"
  283. X    fmtAre = "is"
  284. X;
  285. X
  286. X/*
  287. X@follower: Actor
  288. XThis is a special object that can ``shadow'' the movements of a
  289. Xcharacter as it moves from room to room.  The purpose of a \tt follower\
  290. Xis to allow the player to follow an actor as it leaves a room by
  291. Xtyping a ``follow'' command.  Each actor that is to be followed must
  292. Xhave its own \tt follower\ object.  The \tt follower\ object should
  293. Xdefine all of the same vocabulary words (nouns and adjectives) as the
  294. Xactual actor to which it refers.  The \tt follower\ must also
  295. Xdefine the \tt myactor\ property to be the \tt Actor\ object that
  296. Xthe \tt follower\ follows.  The \tt follower\ will always stay
  297. Xone room behind the character it follows; no commands are effective
  298. Xwith a \tt follower\ except for ``follow.''
  299. X*/
  300. Xclass follower: Actor
  301. X    sdesc = { self.myactor.sdesc; }
  302. X    isfollower = true
  303. X    ldesc = { caps(); self.thedesc; " is no longer here. "; }
  304. X    actorAction( v, d, p, i ) = { self.ldesc; }
  305. X    actorDesc = {}
  306. X    myactor = nil   // set to the Actor to be followed
  307. X    verDoFollow( actor ) = {}
  308. X    doFollow( actor ) =
  309. X    {
  310. X        actor.travelTo( self.myactor.location );
  311. X    }
  312. X;
  313. X
  314. X/*
  315. X@basicMe: Actor
  316. XA default implementation of the \tt Me\ object, which is the
  317. Xplayer character.  \tt adv.t\ defines \tt basicMe\ instead of
  318. X\tt Me\ to allow your game to override parts of the default
  319. Ximplementation while still using the rest, and without changing
  320. X\tt adv.t\ itself.  To use \tt basicMe\ unchanged as your player
  321. Xcharacter, include this in your game:  ``\tt Me: basicMe;\''.
  322. X
  323. XThe \tt basicMe\ object defines all of the methods and properties
  324. Xrequired for an actor, with appropriate values for the player
  325. Xcharacter.  The nouns ``me'' and ``myself'' are defined (``I''
  326. Xis not defined, because it conflicts with the ``inventory''
  327. Xcommand's minimal abbreviation of ``i'' in certain circumstances,
  328. Xand is generally not compatible with the syntax of most player
  329. Xcommands anyway).  The \tt sdesc\ is ``you''; the \tt thedesc\
  330. Xand \tt adesc\ are ``yourself,'' which is appropriate for most
  331. Xcontexts.  The \tt maxbulk\ and \tt maxweight\ properties are
  332. Xset to 10 each; a more sophisticated \tt Me\ might include the
  333. Xplayer's state of health in determining the \tt maxweight\ and
  334. X\tt maxbulk\ properties.
  335. X*/
  336. Xclass basicMe: Actor
  337. X    roomCheck( v ) = { return( self.location.roomCheck( v )); }
  338. X    noun = 'me' 'myself'
  339. X    sdesc = "you"
  340. X    thedesc = "yourself"
  341. X    adesc = "yourself"
  342. X    ldesc = "You look about the same as always. "
  343. X    maxweight = 10
  344. X    maxbulk = 10
  345. X    verDoFollow( actor ) =
  346. X    {
  347. X        if ( actor = self ) "You can't follow yourself! ";
  348. X    }
  349. X    actorAction( verb, dobj, prep, iobj ) = 
  350. X    {
  351. X    }
  352. X    travelTo( room ) =
  353. X    {
  354. X        if ( room )
  355. X        {
  356. X        if ( room.isobstacle )
  357. X        {
  358. X            self.travelTo( room.destination );
  359. X        }
  360. X        else if ( not ( self.location.islit or room.islit ))
  361. X        {
  362. X            darkTravel();
  363. X        }
  364. X        else
  365. X        {
  366. X                if ( self.location ) self.location.leaveRoom( self );
  367. X                self.location := room;
  368. X                room.enterRoom( self );
  369. X        }
  370. X        }
  371. X    }
  372. X    moveInto( room ) =
  373. X    {
  374. X        self.location := room;
  375. X    }
  376. X    // these properties are for the format strings
  377. X    fmtYou = "you"
  378. X    fmtYour = "your"
  379. X    fmtYoure = "you're"
  380. X    fmtYoum = "you"
  381. X    fmtYouve = "you've"
  382. X    fmtS = ""
  383. X    fmtEs = ""
  384. X    fmtHave = "have"
  385. X    fmtDo = "do"
  386. X    fmtAre = "are"
  387. X;
  388. X
  389. X/*
  390. X@decoration: fixeditem
  391. XAn item that doesn't have any function in the game, apart from
  392. Xhaving been mentioned in the room description.  These items
  393. Xare immovable and can't be manipulated in any way, but can be
  394. Xreferred to and inspected.  Liberal use of \tt decoration\ items
  395. Xcan improve a game's playability by helping the parser recognize
  396. Xall the words the game uses in its descriptions of rooms.
  397. X*/
  398. Xclass decoration: fixeditem
  399. X;
  400. X
  401. X/*
  402. X@buttonitem: fixeditem
  403. XA button (the type you push).  The individual button's method
  404. X\tt doPush( \it actor\ )\, which must be specified in
  405. Xthe button, carries out the function of the button.  Note that
  406. Xall buttons have the noun ``button'' defined.
  407. X*/
  408. Xclass buttonitem: fixeditem
  409. X    noun = 'button'
  410. X    plural = 'buttons'
  411. X    verDoPush( actor ) = {}
  412. X;
  413. X
  414. X/*
  415. X@clothingItem: item
  416. XSomething that can be worn.  By default, the only thing that
  417. Xhappens when the item is worn is that its \tt isworn\ property
  418. Xis set to \tt true\.  If you want more to happen, override the
  419. X\tt doWear( \it actor\ )\ property.  Note that, when a \tt clothingItem\
  420. Xis being worn, certain operations will cause it to be removed (for
  421. Xexample, dropping it causes it to be removed).  If you want
  422. Xsomething else to happen, override the \tt checkDrop\ method;
  423. Xif you want to disallow such actions while the object is worn,
  424. Xuse an \tt exit\ statement in the \tt checkDrop\ method.
  425. X*/
  426. Xclass clothingItem: item
  427. X    checkDrop =
  428. X    {
  429. X        if ( self.isworn )
  430. X    {
  431. X        "(Taking off "; self.thedesc; " first)\n";
  432. X    }
  433. X    }
  434. X    doDrop( actor ) =
  435. X    {
  436. X        self.checkDrop;
  437. X    pass doDrop;
  438. X    }
  439. X    doPutIn( actor, io ) =
  440. X    {
  441. X        self.checkDrop;
  442. X    pass doPutIn;
  443. X    }
  444. X    doPutOn( actor, io ) =
  445. X    {
  446. X        self.checkDrop;
  447. X    pass doPutOn;
  448. X    }
  449. X    doGiveTo( actor, io ) =
  450. X    {
  451. X        self.checkDrop;
  452. X    pass doGiveTo;
  453. X    }
  454. X    doThrowAt( actor, io ) =
  455. X    {
  456. X        self.checkDrop;
  457. X    pass doThrowAt;
  458. X    }
  459. X    doThrowTo( actor, io ) =
  460. X    {
  461. X        self.checkDrop;
  462. X    pass doThrowTo;
  463. X    }
  464. X    doThrow( actor ) =
  465. X    {
  466. X        self.checkDrop;
  467. X    pass doThrow;
  468. X    }
  469. X    moveInto( obj ) =
  470. X    {
  471. X        /*
  472. X     *   Catch any other movements with moveInto; this won't stop the
  473. X     *   movement from happening, but it will prevent any anamolous
  474. X     *   consequences caused by the object moving but still being worn.
  475. X     */
  476. X        self.isworn := nil;
  477. X    pass moveInto;
  478. X    }
  479. X    verDoWear( actor ) =
  480. X    {
  481. X        if ( self.isworn )
  482. X        {
  483. X            "%You're% already wearing "; self.thedesc; "! ";
  484. X        }
  485. X        else if ( not actor.isCarrying( self ))
  486. X        {
  487. X            "%You% %do%n't have "; self.thedesc; ". ";
  488. X        }
  489. X    }
  490. X    doWear( actor ) =
  491. X    {
  492. X        "Okay, %you're% now wearing "; self.thedesc; ". ";
  493. X        self.isworn := true;
  494. X    }
  495. X    verDoUnwear( actor ) =
  496. X    {
  497. X        if ( not self.isworn )
  498. X        {
  499. X            "%You're% not wearing "; self.thedesc; ". ";
  500. X        }
  501. X    }
  502. X    doUnwear( actor ) =
  503. X    {
  504. X        "Okay, %you're% no longer wearing "; self.thedesc; ". ";
  505. X        self.isworn := nil;
  506. X    }
  507. X;
  508. X
  509. X/*
  510. X@obstacle: object
  511. XAn \tt obstacle\ is used in place of a room for a direction
  512. Xproperty.  The \tt destination\ property specifies the room that
  513. Xis reached if the obstacle is successfully negotiated; when the
  514. Xobstacle is not successfully negotiated, \tt destination\ should
  515. Xdisplay an appropriate message and return \tt nil\.
  516. X*/
  517. Xclass obstacle: object
  518. X    isobstacle = true
  519. X;
  520. X
  521. X/*
  522. X@doorway: fixeditem, obstacle
  523. XA \tt doorway\ is an obstacle that impedes progress when it is closed.
  524. XWhen the door is open (\tt isopen\ is \tt true\), the user ends up in
  525. Xthe room specified in the \tt doordest\ property upon going through
  526. Xthe door.  Since a doorway is an obstacle, use the door object for
  527. Xa direction property of the room containing the door.
  528. X
  529. XIf \tt noAutoOpen\ is not set to \tt true\, the door will automatically
  530. Xbe opened when the player tries to walk through the door, unless the
  531. Xdoor is locked (\tt islocked\ = \tt true\).  If the door is locked,
  532. Xit can be unlocked simply by typing ``unlock door'', unless the
  533. X\tt mykey\ property is set, in which case the object specified in
  534. X\tt mykey\ must be used to unlock the door.  Note that the door can
  535. Xonly be relocked by the player under the circumstances that allow
  536. Xunlocking, plus the property \tt islockable\ must be set true.
  537. XBy default, the door is closed; set \tt isopen\ to true if the door
  538. Xis to start out open (and be sure to open the other side as well).
  539. X
  540. X\tt otherside\ specifies the corresponding doorway object in the
  541. Xdestination room (\tt doordest\), if any.  If \tt otherside\ is
  542. Xspecified, its \tt isopen\ and \tt islocked\ properties will be
  543. Xkept in sync automatically.
  544. X*/
  545. Xclass doorway: fixeditem, obstacle
  546. X    isdoor = true           // Item can be opened and closed
  547. X    destination =
  548. X    {
  549. X        if ( self.isopen ) return( self.doordest );
  550. X    else if ( not self.islocked and not self.noAutoOpen )
  551. X    {
  552. X        self.isopen := true;
  553. X        if ( self.otherside ) self.otherside.isopen := true;
  554. X        "(Opening << self.thedesc >>)\n";
  555. X        return( self.doordest );
  556. X    }
  557. X    else
  558. X    {
  559. X        "%You%'ll have to open << self.thedesc >> first. ";
  560. X        setit( self );
  561. X        return( nil );
  562. X    }
  563. X    }
  564. X    verDoOpen( actor ) =
  565. X    {
  566. X        if ( self.isopen ) "It's already open. ";
  567. X    else if ( self.islocked ) "It's locked. ";
  568. X    }
  569. X    doOpen( actor ) =
  570. X    {
  571. X        "Opened. ";
  572. X    self.isopen := true;
  573. X    if ( self.otherside ) self.otherside.isopen := true;
  574. X    }
  575. X    verDoClose( actor ) =
  576. X    {
  577. X        if ( not self.isopen ) "It's already closed. ";
  578. X    }
  579. X    doClose( actor ) =
  580. X    {
  581. X        "Closed. ";
  582. X    self.isopen := nil;
  583. X    if ( self.otherside ) self.otherside.isopen := nil;
  584. X    }
  585. X    verDoLock( actor ) =
  586. X    {
  587. X        if ( self.islocked ) "It's already locked! ";
  588. X    else if ( not self.islockable ) "It can't be locked. ";
  589. X    else if ( self.isopen ) "%You%'ll have to close it first. ";
  590. X    }
  591. X    doLock( actor ) =
  592. X    {
  593. X        if ( self.mykey = nil )
  594. X    {
  595. X        "Locked. ";
  596. X        self.islocked := true;
  597. X        if ( self.otherside ) self.otherside.islocked := true;
  598. X    }
  599. X    else
  600. X            askio( withPrep );
  601. X    }
  602. X    verDoUnlock( actor ) =
  603. X    {
  604. X        if ( not self.islocked ) "It's not locked! ";
  605. X    }
  606. X    doUnlock( actor ) =
  607. X    {
  608. X        if ( self.mykey = nil )
  609. X    {
  610. X        "Unlocked. ";
  611. X        self.islocked := nil;
  612. X        if ( self.otherside ) self.otherside.islocked := nil;
  613. X    }
  614. X    else
  615. X        askio( withPrep );
  616. X    }
  617. X    verDoLockWith( actor, io ) =
  618. X    {
  619. X        if ( self.islocked ) "It's already locked. ";
  620. X    else if ( not self.islockable ) "It can't be locked. ";
  621. X    else if ( self.mykey = nil )
  622. X        "%You% %do%n't need anything to lock it. ";
  623. X    else if ( self.isopen ) "%You%'ll have to close it first. ";
  624. X    }
  625. X    doLockWith( actor, io ) =
  626. X    {
  627. X        if ( io = self.mykey )
  628. X    {
  629. X        "Locked. ";
  630. X        self.islocked := true;
  631. X        if ( self.otherside ) self.otherside.islocked := true;
  632. X    }
  633. X    else "It doesn't fit the lock. ";
  634. X    }
  635. X    verDoUnlockWith( actor, io ) =
  636. X    {
  637. X        if ( not self.islocked ) "It's not locked! ";
  638. X    else if ( self.mykey = nil )
  639. X        "%You% %do%n't need anything to unlock it. ";
  640. X    }
  641. X    doUnlockWith( actor, io ) =
  642. X    {
  643. X        if ( io = self.mykey )
  644. X    {
  645. X        "Unlocked. ";
  646. X        self.islocked := nil;
  647. X        if ( self.otherside ) self.otherside.islocked := nil;
  648. X    }
  649. X    else "It doesn't fit the lock. ";
  650. X    }
  651. X    ldesc =
  652. X    {
  653. X    if ( self.isopen ) "It's open. ";
  654. X    else
  655. X    {
  656. X        if ( self.islocked ) "It's closed and locked. ";
  657. X        else "It's closed. ";
  658. X    }
  659. X    }
  660. X;
  661. X
  662. X/*
  663. X@lockableDoorway: doorway
  664. XThis is just a normal doorway with the \tt islockable\ and
  665. X\tt islocked\ properties set to \tt true\.  Fill in the other
  666. Xproperties (\tt otherside\ and \tt doordest\) as usual.  If
  667. Xthe door has a key, set property \tt mykey\ to the key object.
  668. X*/
  669. Xclass lockableDoorway: doorway
  670. X    islockable = true
  671. X    islocked = true
  672. X;
  673. X
  674. X/*
  675. X@vehicle: item, nestedroom
  676. XThis is an object that an actor can board.  An actor cannot go
  677. Xanywhere while on board a vehicle; the actor must get out first.
  678. X*/
  679. Xclass vehicle: item, nestedroom
  680. X    reachable = ([] + self)
  681. X    isvehicle = true
  682. X    verDoEnter( actor ) = { self.verDoBoard( actor ); }
  683. X    doEnter( actor ) = { self.doBoard( actor ); }
  684. X    verDoBoard( actor ) =
  685. X    {
  686. X        if ( actor.location = self )
  687. X        {
  688. X            "%You're% already in "; self.thedesc; "! ";
  689. X        }
  690. X    }
  691. X    doBoard( actor ) =
  692. X    {
  693. X        "Okay, %you're% now in "; self.thedesc; ". ";
  694. X        actor.moveInto( self );
  695. X    }
  696. X    noexit =
  697. X    {
  698. X        "%You're% not going anywhere until %you% get%s% out of ";
  699. X      self.thedesc; ". ";
  700. X        return( nil );
  701. X    }
  702. X    out = ( self.location )
  703. X;
  704. X
  705. X/*
  706. X@surface: item
  707. XObjects can be placed on a surface.  Apart from using the
  708. Xpreposition ``on'' rather than ``in'' to refer to objects
  709. Xcontained by the object, a \tt surface\ is identical to a
  710. X\tt container\.  Note: that an object cannot be both a
  711. X\tt surface\ and a \tt container\, because there is no
  712. Xdistinction between the two internally.
  713. X*/
  714. Xclass surface: item
  715. X    issurface = true        // Item can hold objects on its surface
  716. X    ldesc =
  717. X    {
  718. X        if (itemcnt( self.contents ))
  719. X        {
  720. X            "On "; self.thedesc; " %you% see%s% "; listcont( self ); ". ";
  721. X        }
  722. X        else
  723. X        {
  724. X            "There's nothing on "; self.thedesc; ". ";
  725. X        }
  726. X    }
  727. X    verIoPutOn( actor ) = {}
  728. X    ioPutOn( actor, dobj ) =
  729. X    {
  730. X        dobj.doPutOn( actor, self );
  731. X    }
  732. X;
  733. X
  734. X/*
  735. X@container: item
  736. XThis object can contain other objects.  The \tt iscontainer\ property
  737. Xis set to \tt true\.  The default \tt ldesc\ displays a list of the
  738. Xobjects inside the container, if any.  The \tt maxbulk\ property
  739. Xspecifies the maximum amount of bulk the container can contain.
  740. X*/
  741. Xclass container: item
  742. X    maxbulk = 10            // maximum bulk the container can contain
  743. X    isopen = true           // in fact, it can't be closed at all
  744. X    iscontainer = true      // Item can contain other items
  745. X    ldesc =
  746. X    {
  747. X        if ( self.contentsVisible and itemcnt( self.contents ) <> 0 )
  748. X        {
  749. X            "In "; self.thedesc; " %you% see%s% "; listcont( self ); ". ";
  750. X        }
  751. X        else
  752. X        {
  753. X            "There's nothing in "; self.thedesc; ". ";
  754. X        }
  755. X    }
  756. X    verIoPutIn( actor ) =
  757. X    {
  758. X    }
  759. X    ioPutIn( actor, dobj ) =
  760. X    {
  761. X        if (addbulk( self.contents ) + dobj.bulk > self.maxbulk )
  762. X        {
  763. X            "%You% can't fit that in "; self.thedesc; ". ";
  764. X        }
  765. X        else
  766. X        {
  767. X        dobj.doPutIn( actor, self );
  768. X        }
  769. X    }
  770. X    verDoLookin( actor ) = {}
  771. X    doLookin( actor ) =
  772. X    {
  773. X        self.ldesc;
  774. X    }
  775. X;
  776. X
  777. X/*
  778. X@openable: container
  779. XA container that can be opened and closed.  The \tt isopenable\
  780. Xproperty is set to \tt true\.  The default \tt ldesc\ displays
  781. Xthe contents of the container if the container is open, otherwise
  782. Xa message saying that the object is closed.
  783. X*/
  784. Xclass openable: container
  785. X    contentsReachable = { return( self.isopen ); }
  786. X    contentsVisible = { return( self.isopen ); }
  787. X    isopenable = true
  788. X    ldesc =
  789. X    {
  790. X        caps(); self.thedesc;
  791. X        if ( self.isopen )
  792. X    {
  793. X        " is open. ";
  794. X        pass ldesc;
  795. X    }
  796. X        else " is closed. ";
  797. X    }
  798. X    isopen = true
  799. X    verDoOpen( actor ) =
  800. X    {
  801. X        if ( self.isopen )
  802. X    {
  803. X        caps(); self.thedesc; " is already open! ";
  804. X    }
  805. X    }
  806. X    doOpen( actor ) =
  807. X    {
  808. X        if (itemcnt( self.contents ))
  809. X    {
  810. X        "Opening "; self.thedesc; " reveals "; listcont( self ); ". ";
  811. X    }
  812. X    else "Opened. ";
  813. X    self.isopen := true;
  814. X    }
  815. X    verDoClose( actor ) =
  816. X    {
  817. X        if ( not self.isopen )
  818. X    {
  819. X        caps(); self.thedesc; " is already closed! ";
  820. X    }
  821. X    }
  822. X    doClose( actor ) =
  823. X    {
  824. X        "Closed. ";
  825. X    self.isopen := nil;
  826. X    }
  827. X    verIoPutIn( actor ) =
  828. X    {
  829. X        if ( not self.isopen )
  830. X    {
  831. X        caps(); self.thedesc; " is closed. ";
  832. X    }
  833. X    }
  834. X    verDoLookin( actor ) =
  835. X    {
  836. X        if ( not self.isopen ) "It's closed. ";
  837. X    }
  838. X;
  839. X
  840. X/*
  841. X@qcontainer: container
  842. XA ``quiet'' container:  its contents are not listed when it shows
  843. Xup in a room description or inventory list.  The \tt isqcontainer\
  844. Xproperty is set to \tt true\.
  845. X*/
  846. Xclass qcontainer: container
  847. X    isqcontainer = true
  848. X;
  849. X
  850. X/*
  851. X@lockable: openable
  852. XA container that can be locked and unlocked.  The \tt islocked\
  853. Xproperty specifies whether the object can be opened or not.  The
  854. Xobject can be locked and unlocked without the need for any other
  855. Xobject; if you want a key to be involved, use a \tt keyedLockable\.
  856. X*/
  857. Xclass lockable: openable
  858. X    doOpen( actor ) =
  859. X    {
  860. X        if ( self.islocked )
  861. X        {
  862. X            "It's locked. ";
  863. X        }
  864. X        else pass doOpen;
  865. X    }
  866. X    verDoLock( actor ) =
  867. X    {
  868. X        if ( self.islocked )
  869. X        {
  870. X            "It's already locked! ";
  871. X        }
  872. X    }
  873. X    doLock( actor ) =
  874. X    {
  875. X        if ( self.isopen )
  876. X        {
  877. X            "%You%'ll have to close "; self.thedesc; " first. ";
  878. X        }
  879. X        else
  880. X        {
  881. X            "Locked. ";
  882. X            self.islocked := true;
  883. X        }
  884. X    }
  885. X    verDoUnlock( actor ) =
  886. X    {
  887. X        if ( not self.islocked ) "It's not locked! ";
  888. X    }
  889. X    doUnlock( actor ) =
  890. X    {
  891. X        "Unlocked. ";
  892. X        self.islocked := nil;
  893. X    }
  894. X    verDoLockWith( actor, io ) =
  895. X    {
  896. X        if ( self.islocked ) "It's already locked. ";
  897. X    }
  898. X    verDoUnlockWith( actor, io ) =
  899. X    {
  900. X        if ( not self.islocked ) "It's not locked! ";
  901. X    }
  902. X;
  903. X
  904. X/*
  905. X@keyedLockable: lockable
  906. XThis subclass of \tt lockable\ allows you to create an object
  907. Xthat can only be locked and unlocked with a corresponding key.
  908. XSet the property \tt mykey\ to the \tt keyItem\ object that can
  909. Xlock and unlock the object.
  910. X*/
  911. Xclass keyedLockable: lockable
  912. X    mykey = nil     // set 'mykey' to the key which locks/unlocks me
  913. X    doLock( actor ) =
  914. X    {
  915. X        askio( withPrep );
  916. X    }
  917. X    doUnlock( actor ) =
  918. X    {
  919. X        askio( withPrep );
  920. X    }
  921. X    doLockWith( actor, io ) =
  922. X    {
  923. X        if ( self.isopen )
  924. X        {
  925. X            "%You% can't lock << self.thedesc >> when it's open. ";
  926. X        }
  927. X        else if ( io = self.mykey )
  928. X        {
  929. X            "Locked. ";
  930. X            self.islocked := true;
  931. X        }
  932. X        else "It doesn't fit the lock. ";
  933. X    }
  934. X    doUnlockWith( actor, io ) =
  935. X    {
  936. X        if ( io = self.mykey )
  937. X        {
  938. X            "Unlocked. ";
  939. X            self.islocked := nil;
  940. X        }
  941. X        else "It doesn't fit the lock. ";
  942. X    }
  943. X;
  944. X
  945. X/*
  946. X@keyItem: item
  947. XThis is an object that can be used as a key for a \tt keyedLockable\
  948. Xor \tt lockableDoorway\ object.  It otherwise behaves as an ordinary item.
  949. X*/
  950. Xclass keyItem: item
  951. X    verIoUnlockWith( actor ) = {}
  952. X    ioUnlockWith( actor, dobj ) =
  953. X    {
  954. X        dobj.doUnlockWith( actor, self );
  955. X    }
  956. X    verIoLockWith( actor ) = {}
  957. X    ioLockWith( actor, dobj ) =
  958. X    {
  959. X        dobj.doLockWith( actor, self );
  960. X    }
  961. X;
  962. X
  963. X/*
  964. X@transparentItem: item
  965. XAn object whose contents are visible, even when the object is
  966. Xclosed.  Whether the contents are reachable is decided in the
  967. Xnormal fashion.  This class is useful for items such as glass
  968. Xbottles, whose contents can be seen when the bottle is closed
  969. Xbut cannot be reached.
  970. X*/
  971. Xclass transparentItem: item
  972. X    contentsVisible = { return( true ); }
  973. X    verGrab( obj ) =
  974. X    {
  975. X        if ( self.isopenable and not self.isopen )
  976. X            "%You% will have to open << self.thedesc >> first. ";
  977. X    }
  978. X    doOpen( actor ) =
  979. X    {
  980. X        self.isopen := true;
  981. X        "Opened. ";
  982. X    }
  983. X;
  984. X
  985. X/*
  986. X@basicNumObj: object
  987. XThis object provides a default implementation for \tt numObj\.
  988. XTo use this default unchanged in your game, include in your
  989. Xgame this line:  ``\tt numObj: basicNumObj\''.
  990. X*/
  991. Xclass basicNumObj: object   // when a number is used in a player command,
  992. X    value = 0               //  this is set to its value
  993. X    sdesc = "that"
  994. X    adesc = "that"
  995. X    thedesc = "that"
  996. X    verDoTypeOn( actor, io ) = {}
  997. X    doTypeOn( actor, io ) = { "\"Tap, tap, tap, tap...\" "; }
  998. X    verIoTurnTo( actor ) = {}
  999. X    ioTurnTo( actor, dobj ) = { dobj.doTurnTo( actor, self ); }
  1000. X;
  1001. X
  1002. X/*
  1003. X@basicStrObj: object
  1004. XThis object provides a default implementation for \tt strObj\.
  1005. XTo use this default unchanged in your game, include in your
  1006. Xgame this line:  ``\tt strObj: basicStrObj\''.
  1007. X*/
  1008. Xclass basicStrObj: object   // when a string is used in a player command,
  1009. X    value = ''              //  this is set to its value
  1010. X    sdesc = "that"
  1011. X    adesc = "that"
  1012. X    thedesc = "that"
  1013. X    verDoTypeOn( actor, io ) = {}
  1014. X    doTypeOn( actor, io ) = { "\"Tap, tap, tap, tap...\" "; }
  1015. X    verDoSave( actor ) = {}
  1016. X    doSave( actor ) =
  1017. X    {
  1018. X        if (save( self.value ))
  1019. X            "Save failed. ";
  1020. X        else
  1021. X            "Saved. ";
  1022. X    abort;
  1023. X    }
  1024. X    verDoRestore( actor ) = {}
  1025. X    doRestore( actor ) =
  1026. X    {
  1027. X        if (restore( self.value ))
  1028. X            "Restore failed. ";
  1029. X        else
  1030. X    {
  1031. X            "Restored. ";
  1032. X        setscore( global.score, global.turnsofar );
  1033. X    }
  1034. X        abort;
  1035. X    }
  1036. X    verDoScript( actor ) = {}
  1037. X    doScript( actor ) =
  1038. X    {
  1039. X        logging( self.value );
  1040. X        "Writing script file. ";
  1041. X        abort;
  1042. X    }
  1043. X    verDoSay( actor ) = {}
  1044. X    doSay( actor ) =
  1045. X    {
  1046. X        // DMB added ZOT code, etc.
  1047. X        if (upper(strObj.value) = 'XYZZY') {
  1048. X            xyzzyVerb.action(actor);
  1049. X        }
  1050. X            else if (upper(strObj.value) = 'PLUGH') {
  1051. X            plughVerb.action(actor);
  1052. X        }
  1053. X        else if (upper(strObj.value) = 'PLOVER') {
  1054. X            ploverVerb.action(actor);
  1055. X        }
  1056. X           else if (upper(strObj.value) = 'Y2') {
  1057. X            y2Verb.action(actor);
  1058. X        }
  1059. X           else if (upper(strObj.value) = 'FEE') {
  1060. X            feeVerb.action(actor);
  1061. X        }
  1062. X           else if (upper(strObj.value) = 'FIE') {
  1063. X            fieVerb.action(actor);
  1064. X        }
  1065. X           else if (upper(strObj.value) = 'FOE') {
  1066. X            foeVerb.action(actor);
  1067. X        }
  1068. X           else if (upper(strObj.value) = 'FOO') {
  1069. X            fooVerb.action(actor);
  1070. X        }
  1071. X           else if (upper(strObj.value) = 'FUM') {
  1072. X            fumVerb.action(actor);
  1073. X        }
  1074. X        else if (upper(strObj.value) = 'FEE FIE FOE FOO') {
  1075. X            "Try saying the words one at a time.";
  1076. X        }
  1077. X        else if (upper(strObj.value) = 'FEE FIE FOE FUM') {
  1078. X            "Try saying the words one at a time.";
  1079. X        }
  1080. X        else {
  1081. X            "That doesn't seem very productive.";
  1082. X        }
  1083. X    }
  1084. X;
  1085. X
  1086. X/*
  1087. X@deepverb: object
  1088. XA ``verb object'' that is referenced by the parser when the player
  1089. Xuses an associated vocabulary word.  A \tt deepverb\ contains both
  1090. Xthe vocabulary of the verb and a description of available syntax.
  1091. XThe \tt verb\ property lists the vocabulary words known as verbs;
  1092. Xone word (such as \tt 'take'\) or a pair (such as \tt 'pick up'\)
  1093. Xcan be used.  In the latter case, the second word must be a
  1094. Xpreposition, and may move to the end of the sentence in a player's
  1095. Xcommand, as in ``pick it up.''  The \tt action( \it actor\ )\
  1096. Xmethod specifies what happens when the verb is used without any
  1097. Xobjects; its absence specifies that the verb cannot be used without
  1098. Xan object.  The \tt doAction\ specifies the root of the message
  1099. Xnames (in single quotes) sent to the direct object when the verb
  1100. Xis used with a direct object; its absence means that a single object
  1101. Xis not allowed.  Likewise, the \tt ioAction( \it preposition\ )\
  1102. Xspecifies the root of the message name sent to the direct and
  1103. Xindirect objects when the verb is used with both a direct and
  1104. Xindirect object; its absence means that this syntax is illegal.
  1105. XSeveral \tt ioAction\ properties may be present:  one for each
  1106. Xpreposition that can be used with an indirect object with the verb.
  1107. X
  1108. XThe \tt validDo( \it actor, object, seqno\ )\ method returns \tt true\
  1109. Xif the indicated object is valid as a direct object for this actor.
  1110. XThe \tt validIo( \it actor, object, seqno\ )\ method does likewise
  1111. Xfor indirect objects.  The \it seqno\ parameter is a ``sequence
  1112. Xnumber,'' starting with 1 for the first object tried for a given
  1113. Xverb, 2 for the second, and so forth; this parameter is normally
  1114. Xignored, but can be used for some special purposes.  For example,
  1115. X\tt askVerb\ does not distinguish between objects matching vocabulary
  1116. Xwords, and therefore accepts only the first from a set of ambiguous
  1117. Xobjects.  These methods do not normally need to be changed; by
  1118. Xdefault, they return \tt true\ if the object is accessible to the
  1119. Xactor.
  1120. X
  1121. XThe \tt doDefault( \it actor, prep, indirectObject\ )\ and
  1122. X\tt ioDefault( \it actor, prep\ )\ methods return a list of the
  1123. Xdefault direct and indirect objects, respectively.  These lists
  1124. Xare used for determining which objects are meant by ``all'' and which
  1125. Xshould be used when the player command is missing an object.  These
  1126. Xnormally return a list of all objects that are applicable to the
  1127. Xcurrent command.
  1128. X*/
  1129. Xclass deepverb: object                // A deep-structure verb.
  1130. X    validDo( actor, obj, seqno ) =
  1131. X    {
  1132. X        return( obj.isReachable( actor ));
  1133. X    }
  1134. X    invalidObj( actor, obj, name ) =
  1135. X    {
  1136. X        if ( not obj.isVisible( actor ))
  1137. X            "I don't see any << name >> here. ";
  1138. X        else
  1139. X            "%You% can't do that with << obj.thedesc >>. ";
  1140. X    }
  1141. X    validIo( actor, obj, seqno ) =
  1142. X    {
  1143. X        return( obj.isReachable( actor ));
  1144. X    }
  1145. X    doDefault( actor, prep, io ) =
  1146. X    {
  1147. X    /* DMB */
  1148. X    //return( actor.contents + actor.location.contents );
  1149. X    return nil;
  1150. X    }
  1151. X    ioDefault( actor, prep ) =
  1152. X    {
  1153. X        /* DMB */
  1154. X    //return( actor.contents + actor.location.contents );
  1155. X    return nil;
  1156. X    }
  1157. X;
  1158. X
  1159. X/*
  1160. X *   Various verbs.
  1161. X */
  1162. XinspectVerb: deepverb
  1163. X    verb = 'inspect' 'examine' 'look at' 'x' /* DMB: */ 'search' 'ex'
  1164. X    sdesc = "inspect"
  1165. X    doAction = 'Inspect'
  1166. X    validDo( actor, obj, seqno ) =
  1167. X    {
  1168. X        return( obj.isVisible( actor ));
  1169. X    }
  1170. X;
  1171. XaskVerb: deepverb
  1172. X    verb = 'ask'
  1173. X    sdesc = "ask"
  1174. X    prepDefault = aboutPrep
  1175. X    ioAction( aboutPrep ) = 'AskAbout'
  1176. X    validIo( actor, obj, seqno ) = { return( seqno = 1 ); }
  1177. X;
  1178. XtellVerb: deepverb
  1179. X    verb = 'tell'
  1180. X    sdesc = "tell"
  1181. X    prepDefault = aboutPrep
  1182. X    ioAction( aboutPrep ) = 'TellAbout'
  1183. X    validIo( actor, obj, seqno ) = { return( seqno = 1 ); }
  1184. X;
  1185. XfollowVerb: deepverb
  1186. X    sdesc = "follow"
  1187. X    verb = 'follow'
  1188. X    doAction = 'Follow'
  1189. X;
  1190. X/*
  1191. X * DMB -- now defined in ccr-verbs.t
  1192. XdigVerb: deepverb
  1193. X    verb = 'dig' 'dig in'
  1194. X    sdesc = "dig in"
  1195. X    prepDefault = withPrep
  1196. X    ioAction( withPrep ) = 'DigWith'
  1197. X;
  1198. X */
  1199. X/*
  1200. X * DMB -- now defined in ccr-verbs.t
  1201. X *
  1202. XjumpVerb: deepverb
  1203. X    verb = 'jump' 'jump over' 'jump off'
  1204. X    doAction = 'Jump'
  1205. X    action(actor) = { "Wheeee!"; }
  1206. X;
  1207. X*/
  1208. XpushVerb: deepverb
  1209. X    verb = 'push' 'press'
  1210. X    sdesc = "push"
  1211. X    doAction = 'Push'
  1212. X;
  1213. XattachVerb: deepverb
  1214. X    verb = 'attach' 'connect'
  1215. X    sdesc = "attach"
  1216. X    prepDefault = toPrep
  1217. X    ioAction( toPrep ) = 'AttachTo'
  1218. X;
  1219. XwearVerb: deepverb
  1220. X    verb = 'wear' 'put on'
  1221. X    sdesc = "wear"
  1222. X    doAction = 'Wear'
  1223. X;
  1224. XdropVerb: deepverb
  1225. X    verb = 'drop' 'put down' 'free' 'release'    // DMB: added last two
  1226. X    sdesc = "drop"
  1227. X    ioAction( onPrep ) = 'PutOn'
  1228. X    doAction = 'Drop'
  1229. X    doDefault( actor, prep, io ) =
  1230. X    {
  1231. X        return( actor.contents );
  1232. X    }
  1233. X;
  1234. XremoveVerb: deepverb
  1235. X    verb = 'take off'
  1236. X    sdesc = "take off"
  1237. X    doAction = 'Unwear'
  1238. X    ioAction( fromPrep ) = 'RemoveFrom'
  1239. X;
  1240. XopenVerb: deepverb
  1241. X    verb = 'open' 'pry'        // DMB added pry for "pry clam with trident"
  1242. X    sdesc = "open"
  1243. X    doAction = 'Open'
  1244. X    ioAction(withPrep) = 'OpenWith'
  1245. X;
  1246. XcloseVerb: deepverb
  1247. X    verb = 'close'
  1248. X    sdesc = "close"
  1249. X    doAction = 'Close'
  1250. X;
  1251. XputVerb: deepverb
  1252. X    verb = 'put' 'place' 'insert'    // DMB: added 'insert'
  1253. X    sdesc = "put"
  1254. X    prepDefault = inPrep
  1255. X    ioAction( inPrep ) = 'PutIn'
  1256. X    ioAction( onPrep ) = 'PutOn'
  1257. X    doDefault( actor, prep, io ) =
  1258. X    {
  1259. X        return( takeVerb.doDefault( actor, prep, io ) + actor.contents );
  1260. X    }
  1261. X;
  1262. XtakeVerb: deepverb                   // This object defines how to take things
  1263. X    verb = 'take' 'pick up' 'get' 'remove'
  1264. X    sdesc = "take"
  1265. X    ioAction( offPrep ) = 'TakeOff'
  1266. X    ioAction( outPrep ) = 'TakeOut'
  1267. X    ioAction( fromPrep ) = 'TakeOut'
  1268. X    ioAction( inPrep ) = 'TakeOut'
  1269. X    ioAction( onPrep ) = 'TakeOff'
  1270. X    doAction = 'Take'
  1271. X    doDefault( actor, prep, io ) =
  1272. X    {
  1273. X        local ret, rem, cur, rem2, cur2, tot, i, tot2, j;
  1274. X    
  1275. X    ret := [];
  1276. X        
  1277. X    /*
  1278. X     *   For "take all out/off of <iobj>", return the (non-fixed)
  1279. X     *   contents of the indirect object.  Same goes for "take all in
  1280. X     *   <iobj>", "take all on <iobj>", and "take all from <iobj>".
  1281. X     */
  1282. X    if (( prep=outPrep or prep=offPrep or prep=inPrep or prep=onPrep
  1283. X     or prep=fromPrep ) and io<>nil )
  1284. X    {
  1285. X        rem := io.contents;
  1286. X        i := 1;
  1287. X        tot := length( rem );
  1288. X        while ( i <= tot )
  1289. X        {
  1290. X            cur := rem[i];
  1291. X            if ( not cur.isfixed ) ret := ret + cur;
  1292. X        i := i + 1;
  1293. X        }
  1294. X            return( ret );
  1295. X    }
  1296. X
  1297. X        /*
  1298. X     *   In the general case, return everything that's not fixed
  1299. X     *   in the actor's location, or everything inside fixed containers
  1300. X     *   that isn't itself fixed.
  1301. X     */
  1302. X        rem := actor.location.contents;
  1303. X    tot := length( rem );
  1304. X    i := 1;
  1305. X        while ( i <= tot )
  1306. X        {
  1307. X        cur := rem[i];
  1308. X            if ( cur.isfixed )
  1309. X            {
  1310. X                if ((( cur.isopenable and cur.isopen ) or
  1311. X                  ( not cur.isopenable )) and ( not cur.isactor ))
  1312. X                {
  1313. X                    rem2 := cur.contents;
  1314. X            tot2 := length( rem2 );
  1315. X            j := 1;
  1316. X                    while ( j <= tot2 )
  1317. X                    {
  1318. X                cur2 := rem2[j];
  1319. X                        if ( not cur2.isfixed and not cur2.notakeall )
  1320. X            {
  1321. X                ret := ret + cur2;
  1322. X            }
  1323. X                        j := j + 1;
  1324. X                    }
  1325. X                }
  1326. X            }
  1327. X            else if ( not cur.notakeall )
  1328. X        {
  1329. X            ret := ret + cur;
  1330. X        }
  1331. X
  1332. X        i := i + 1;            
  1333. X        }
  1334. X        return( ret );
  1335. X    }
  1336. X;
  1337. XplugVerb: deepverb
  1338. X    verb = 'plug'
  1339. X    sdesc = "plug"
  1340. X    prepDefault = inPrep
  1341. X    ioAction( inPrep ) = 'PlugIn'
  1342. X;
  1343. XlookInVerb: deepverb
  1344. X    verb = 'look in' 'look on'
  1345. X    sdesc = "look in"
  1346. X    doAction = 'Lookin'
  1347. X;
  1348. XscrewVerb: deepverb
  1349. X    verb = 'screw'
  1350. X    sdesc = "screw"
  1351. X    ioAction( withPrep ) = 'ScrewWith'
  1352. X    doAction = 'Screw'
  1353. X;
  1354. XunscrewVerb: deepverb
  1355. X    verb = 'unscrew'
  1356. X    sdesc = "unscrew"
  1357. X    ioAction( withPrep ) = 'UnscrewWith'
  1358. X    doAction = 'Unscrew'
  1359. X;
  1360. XturnVerb: deepverb
  1361. X    verb = 'turn' 'rotate' 'twist'
  1362. X    sdesc = "turn"
  1363. X    ioAction( toPrep ) = 'TurnTo'
  1364. X    ioAction( withPrep ) = 'TurnWith'
  1365. X    doAction = 'Turn'
  1366. X;
  1367. XswitchVerb: deepverb
  1368. X    verb = 'switch'
  1369. X    sdesc = "switch"
  1370. X    doAction = 'Switch'
  1371. X;
  1372. XflipVerb: deepverb
  1373. X    verb = 'flip'
  1374. X    sdesc = "flip"
  1375. X    doAction = 'Flip'
  1376. X;
  1377. XturnOnVerb: deepverb
  1378. X    verb = 'activate' 'turn on' 'switch on'
  1379. X    sdesc = "turn on"
  1380. X    doAction = 'Turnon'
  1381. X;
  1382. XturnOffVerb: deepverb
  1383. X    verb = 'turn off' 'deactivate' 'switch off'    // DMB: deavtiv + ate
  1384. X    sdesc = "turn off"
  1385. X    doAction = 'Turnoff'
  1386. X;
  1387. XlookVerb: deepverb
  1388. X    verb = 'look' 'l' 'look around'
  1389. X    action( actor ) =
  1390. X    {
  1391. X        actor.location.lookAround( true );
  1392. X    }
  1393. X;
  1394. XsitVerb: deepverb
  1395. X    verb = 'sit on' 'sit in' 'sit' 'sit down' 'sit downin' 'sit downon'
  1396. X    sdesc = "sit on"
  1397. X    doAction = 'Siton'
  1398. X;
  1399. XlieVerb: deepverb
  1400. X    verb = 'lie' 'lie on' 'lie in' 'lie down' 'lie downon' 'lie downin'
  1401. X    sdesc = "lie on"
  1402. X    doAction = 'Lieon'
  1403. X;
  1404. XgetOutVerb: deepverb
  1405. X    verb = 'get out' 'get outof' 'get off' 'get offof'
  1406. X    sdesc = "get out of"
  1407. X    doAction = 'Unboard'
  1408. X    doDefault( actor, prep, io ) =
  1409. X    {
  1410. X        if ( actor.location and actor.location.location )
  1411. X            return( [] + actor.location );
  1412. X        else return( [] );
  1413. X    }
  1414. X;
  1415. XboardVerb: deepverb
  1416. X    verb = 'get in' 'get into' 'board' 'get on'
  1417. X    sdesc = "get on"
  1418. X    doAction = 'Board'
  1419. X;
  1420. XagainVerb: deepverb         // Required verb:  repeats last command.  No
  1421. X                            // action routines are necessary; this one's
  1422. X                            // handled internally by the parser.
  1423. X    verb = 'again' 'g'
  1424. X;
  1425. XwaitVerb: deepverb
  1426. X    verb = 'wait' 'z'
  1427. X    action( actor ) =
  1428. X    {
  1429. X        "Time passes...\n";
  1430. X    }
  1431. X;
  1432. XiVerb: deepverb
  1433. X    verb = 'inventory' 'i'
  1434. X    action( actor ) =
  1435. X    {
  1436. X        if (length( actor.contents ))
  1437. X        {
  1438. X            "%You% %have% "; listcont( actor ); ". ";
  1439. X        // DMB added the check for any contents
  1440. X        if (listcontcont(actor, nil)) {
  1441. X            P();
  1442. X            listcontcont(actor, true);    // DMB added second param
  1443. X        }
  1444. X        }
  1445. X    else
  1446. X            "%You% %are% empty-handed.\n";
  1447. X    }
  1448. X;
  1449. XlookThruVerb: deepverb
  1450. X    verb = 'look through' 'look thru'
  1451. X    sdesc = "look through"
  1452. X    doAction = 'Lookthru'
  1453. X;
  1454. XattackVerb: deepverb
  1455. X    verb = 'attack' 'kill' 'hit'
  1456. X    sdesc = "attack"
  1457. X    doAction = 'Attack'    // DMB
  1458. X    prepDefault = withPrep
  1459. X    ioAction( withPrep ) = 'AttackWith'
  1460. X;
  1461. XeatVerb: deepverb
  1462. X    verb = 'eat' 'consume'
  1463. X    sdesc = "eat"
  1464. X    doAction = 'Eat'
  1465. X;
  1466. XdrinkVerb: deepverb
  1467. X    verb = 'drink' 'drink from'    // DMB: added 'drink from'
  1468. X    sdesc = "drink"
  1469. X    doAction = 'Drink'
  1470. X;
  1471. XgiveVerb: deepverb
  1472. X    verb = 'give' 'offer'
  1473. X    sdesc = "give"
  1474. X    prepDefault = toPrep
  1475. X    ioAction( toPrep ) = 'GiveTo'
  1476. X;
  1477. XpullVerb: deepverb
  1478. X    verb = 'pull'
  1479. X    sdesc = "pull"
  1480. X    doAction = 'Pull'
  1481. X;
  1482. XreadVerb: deepverb
  1483. X    verb = 'read'
  1484. X    sdesc = "read"
  1485. X    doAction = 'Read'
  1486. X;
  1487. XthrowVerb: deepverb
  1488. X    verb = 'throw' 'toss'
  1489. X    sdesc = "throw"
  1490. X    prepDefault = atPrep
  1491. X    ioAction( atPrep ) = 'ThrowAt'
  1492. X    ioAction( toPrep ) = 'ThrowTo'
  1493. X;
  1494. XstandOnVerb: deepverb
  1495. X    verb = 'stand on'
  1496. X    sdesc = "stand on"
  1497. X    doAction = 'Standon'
  1498. X;
  1499. XstandVerb: deepverb
  1500. X    verb = 'stand' 'stand up' 'get up'
  1501. X    sdesc = "stand"
  1502. X    action( actor ) =
  1503. X    {
  1504. X        if ( actor.location=nil or actor.location.location = nil )
  1505. X            "%You're% already standing! ";
  1506. X        else
  1507. X        {
  1508. X        actor.location.doUnboard( actor );
  1509. X        }
  1510. X    }
  1511. X;
  1512. XhelloVerb: deepverb
  1513. X    verb = 'hello' 'hi' 'greetings'
  1514. X    action( actor ) =
  1515. X    {
  1516. X        "Nice weather we've been having.\n";
  1517. X    }
  1518. X;
  1519. XshowVerb: deepverb
  1520. X    verb = 'show'
  1521. X    sdesc = "show"
  1522. X    prepDefault = toPrep
  1523. X    ioAction( toPrep ) = 'ShowTo'
  1524. X;
  1525. XcleanVerb: deepverb
  1526. X    verb = 'clean'
  1527. X    sdesc = "clean"
  1528. X    ioAction( withPrep ) = 'CleanWith'
  1529. X    doAction = 'Clean'
  1530. X;
  1531. XsayVerb: deepverb
  1532. X    verb = 'say'
  1533. X    sdesc = "say"
  1534. X    doAction = 'Say'
  1535. X;
  1536. XyellVerb: deepverb
  1537. X    verb = 'yell' 'shout' 'yell at' 'shout at'
  1538. X    action( actor ) =
  1539. X    {
  1540. X        "%Your% throat is a bit sore now. ";
  1541. X    }
  1542. X;
  1543. XmoveVerb: deepverb
  1544. X    verb = 'move'
  1545. X    sdesc = "move"
  1546. X    ioAction( withPrep ) = 'MoveWith'
  1547. X    ioAction( toPrep ) = 'MoveTo'
  1548. X    doAction = 'Move'
  1549. X;
  1550. XfastenVerb: deepverb
  1551. X    verb = 'fasten' 'buckle' 'buckle up'
  1552. X    sdesc = "fasten"
  1553. X    doAction = 'Fasten'
  1554. X;
  1555. XunfastenVerb: deepverb
  1556. X    verb = 'unfasten' 'unbuckle'
  1557. X    sdesc = "unfasten"
  1558. X    doAction = 'Unfasten'
  1559. X;
  1560. XunplugVerb: deepverb
  1561. X    verb = 'unplug'
  1562. X    sdesc = "unplug"
  1563. X    ioAction( fromPrep ) = 'UnplugFrom'
  1564. X    doAction = 'Unplug'
  1565. X;
  1566. XlookUnderVerb: deepverb
  1567. X    verb = 'look under' 'look beneath'
  1568. X    sdesc = "look under"
  1569. X    doAction = 'Lookunder'
  1570. X;
  1571. XlookBehindVerb: deepverb
  1572. X    verb = 'look behind'
  1573. X    sdesc = "look behind"
  1574. X    doAction = 'Lookbehind'
  1575. X;
  1576. XtypeVerb: deepverb
  1577. X    verb = 'type'
  1578. X    sdesc = "type"
  1579. X    prepDefault = onPrep
  1580. X    ioAction( onPrep ) = 'TypeOn'
  1581. X;
  1582. XlockVerb: deepverb
  1583. X    verb = 'lock'
  1584. X    sdesc = "lock"
  1585. X    ioAction( withPrep ) = 'LockWith'
  1586. X    doAction = 'Lock'
  1587. X    prepDefault = withPrep
  1588. X;
  1589. XunlockVerb: deepverb
  1590. X    verb = 'unlock'
  1591. X    sdesc = "unlock"
  1592. X    ioAction( withPrep ) = 'UnlockWith'
  1593. X    doAction = 'Unlock'
  1594. X    prepDefault = withPrep
  1595. X;
  1596. XdetachVerb: deepverb
  1597. X    verb = 'detach' 'disconnect'
  1598. X    prepDefault = fromPrep
  1599. X    ioAction( fromPrep ) = 'DetachFrom'
  1600. X    doAction = 'Detach'
  1601. X    sdesc = "detach"
  1602. X;
  1603. X/*
  1604. X * DMB
  1605. X */
  1606. XsleepVerb: deepverb
  1607. X    action(actor) = {
  1608. X            "This is no time for loafing!";
  1609. X    }
  1610. X    
  1611. X    verb = 'sleep' 'rest' 'loaf' 'nap' 'relax'
  1612. X;
  1613. XpokeVerb: deepverb
  1614. X    verb = 'poke' 'jab'
  1615. X    sdesc = "poke"
  1616. X    doAction = 'Poke'
  1617. X;
  1618. XtouchVerb: deepverb
  1619. X    verb = 'touch'
  1620. X    sdesc = "touch"
  1621. X    doAction = 'Touch'
  1622. X;
  1623. XmoveNVerb: deepverb
  1624. X    verb = 'move north' 'move n' 'push north' 'push n'
  1625. X    sdesc = "move north"
  1626. X    doAction = 'MoveN'
  1627. X;
  1628. XmoveSVerb: deepverb
  1629. X    verb = 'move south' 'move s' 'push south' 'push s'
  1630. X    sdesc = "move south"
  1631. X    doAction = 'MoveS'
  1632. X;
  1633. XmoveEVerb: deepverb
  1634. X    verb = 'move east' 'move e' 'push east' 'push e'
  1635. X    sdesc = "move east"
  1636. X    doAction = 'MoveE'
  1637. X;
  1638. XmoveWVerb: deepverb
  1639. X    verb = 'move west' 'move w' 'push west' 'push w'
  1640. X    sdesc = "move west"
  1641. X    doAction = 'MoveW'
  1642. X;
  1643. XmoveNEVerb: deepverb
  1644. X    verb = 'move northeast' 'move ne' 'push northeast' 'push ne'
  1645. X    sdesc = "move northeast"
  1646. X    doAction = 'MoveNE'
  1647. X;
  1648. XmoveNWVerb: deepverb
  1649. X    verb = 'move northwest' 'move nw' 'push northwest' 'push nw'
  1650. X    sdesc = "move northwest"
  1651. X    doAction = 'MoveNW'
  1652. X;
  1653. XmoveSEVerb: deepverb
  1654. X    verb = 'move southeast' 'move se' 'push southeast' 'push se'
  1655. X    sdesc = "move southeast"
  1656. X    doAction = 'MoveSE'
  1657. X;
  1658. XmoveSWVerb: deepverb
  1659. X    verb = 'move southwest' 'move sw' 'push southwest' 'push sw'
  1660. X    sdesc = "move southwest"
  1661. X    doAction = 'MoveSW'
  1662. X;
  1663. XcenterVerb: deepverb
  1664. X    verb = 'center'
  1665. X    sdesc = "center"
  1666. X    doAction = 'Center'
  1667. X;
  1668. X/*
  1669. X * DMB search is synonymous with inspect.
  1670. X */
  1671. X/*
  1672. XsearchVerb: deepverb
  1673. X    verb = 'search'
  1674. X    sdesc = "search"
  1675. X    doAction = 'Search'
  1676. X;
  1677. X*/
  1678. X/*
  1679. X *   Travel verbs  - these verbs allow the player to move about.
  1680. X *   All travel verbs have the property isTravelVerb set true.
  1681. X */
  1682. Xclass travelVerb: deepverb
  1683. X    isTravelVerb = true
  1684. X;
  1685. XclimbVerb: deepverb, travelVerb    // DMB: made this into a travelVerb
  1686. X    verb = 'climb'
  1687. X    travelDir( actor ) = { return(actor.location.climb); }
  1688. X
  1689. X    sdesc = "climb"
  1690. X    action( actor ) = { actor.travelTo(self.travelDir(actor)); }
  1691. X    doAction = 'Climb'
  1692. X;
  1693. XeVerb: travelVerb
  1694. X    action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1695. X    verb = 'e' 'east' 'go east'
  1696. X    travelDir( actor ) = { return( actor.location.east ); }
  1697. X;
  1698. XsVerb: travelVerb
  1699. X    action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1700. X    verb = 's' 'south' 'go south'
  1701. X    travelDir( actor ) = { return( actor.location.south ); }
  1702. X;
  1703. XnVerb: travelVerb
  1704. X    action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1705. X    verb = 'n' 'north' 'go north'
  1706. X    travelDir( actor ) = { return( actor.location.north ); }
  1707. X;
  1708. XwVerb: travelVerb
  1709. X    action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1710. X    verb = 'w' 'west' 'go west'
  1711. X    travelDir( actor ) = { return( actor.location.west ); }
  1712. X;
  1713. XneVerb: travelVerb
  1714. X    action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1715. X    verb = 'ne' 'northeast' 'go ne' 'go northeast'
  1716. X    travelDir( actor ) = { return( actor.location.ne ); }
  1717. X;
  1718. XnwVerb: travelVerb
  1719. X    action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1720. X    verb = 'nw' 'northwest' 'go nw' 'go northwest'
  1721. X    travelDir( actor ) = { return( actor.location.nw ); }
  1722. X;
  1723. XseVerb: travelVerb
  1724. X    action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1725. X    verb = 'se' 'southeast' 'go se' 'go southeast'
  1726. X    travelDir( actor ) = { return( actor.location.se ); }
  1727. X;
  1728. XswVerb: travelVerb
  1729. X    action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1730. X    verb = 'sw' 'southwest' 'go sw' 'go southwest'
  1731. X    travelDir( actor ) = { return( actor.location.sw ); }
  1732. X;
  1733. XinVerb: travelVerb
  1734. X    action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1735. X    verb = 'in' 'go in' 'enter'
  1736. X    sdesc = "enter"
  1737. X    doAction = 'Enter'
  1738. X    travelDir( actor ) = { return( actor.location.in ); }
  1739. X;
  1740. XoutVerb: travelVerb
  1741. X    action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1742. X    verb = 'out' 'go out' 'exit' 'leave'
  1743. X    travelDir( actor ) = { return( actor.location.out ); }
  1744. X;
  1745. XdVerb: travelVerb
  1746. X    action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1747. X    verb = 'd' 'down' 'go down'
  1748. X    travelDir( actor ) = { return( actor.location.down ); }
  1749. X;
  1750. XuVerb: travelVerb
  1751. X    action( actor ) = { actor.travelTo( self.travelDir( actor )); }
  1752. X    verb = 'u' 'up' 'go up'
  1753. X    travelDir( actor ) = { return( actor.location.up ); }
  1754. X;
  1755. X
  1756. X/*
  1757. X *   sysverb:  A system verb.  Verbs of this class are special verbs that
  1758. X *   can be executed without certain normal validations.  For example,
  1759. X *   a system verb can be executed in a dark room.  System verbs are
  1760. X *   for operations such as saving, restoring, and quitting, which are
  1761. X *   not really part of the game.
  1762. X */
  1763. Xclass sysverb: deepverb
  1764. X    issysverb = true
  1765. X;
  1766. XquitVerb: sysverb
  1767. X    verb = 'quit'
  1768. X    action( actor ) =
  1769. X    {
  1770. X        local yesno;
  1771. X
  1772. X    /* XXX */
  1773. X        "\bDo you really want to quit? (YES or NO) > ";
  1774. X        yesno := yorn();
  1775. X        "\b";
  1776. X        if ( yesno = 1 )
  1777. X        {
  1778. X        silent_incscore(global.quitpoints); // points for quitting (neg.)
  1779. X        scoreRank();    // DMB: moved here from XXX
  1780. X            terminate();    // allow user good-bye message
  1781. X        quit();
  1782. X        }
  1783. X        else
  1784. X        {
  1785. X            "Okay. ";
  1786. X        }
  1787. X    abort;
  1788. X    }
  1789. X;
  1790. XverboseVerb: sysverb
  1791. X    verb = 'verbose'
  1792. X    action( actor ) =
  1793. X    {
  1794. X        "Okay, now in VERBOSE mode.\n";
  1795. X        global.verbose := true;
  1796. X    Me.location.lookAround( true );
  1797. X    abort;
  1798. X    }
  1799. X;
  1800. XterseVerb: sysverb
  1801. X    verb = 'brief' 'terse'
  1802. X    action( actor ) =
  1803. X    {
  1804. X        "Okay, now in TERSE mode.\n";
  1805. X        global.verbose := nil;
  1806. X    abort;
  1807. X    }
  1808. X;
  1809. XscoreVerb: sysverb
  1810. X    verb = 'score' 'status'
  1811. X    action( actor ) =
  1812. X    {
  1813. X        scoreRank();
  1814. X    abort;
  1815. X    }
  1816. X;
  1817. XsaveVerb: sysverb
  1818. X    verb = 'save'
  1819. X    sdesc = "save"
  1820. X    doAction = 'Save'
  1821. X    action( actor ) =
  1822. X    {
  1823. X        local savefile;
  1824. X    
  1825. X    savefile := askfile( 'File to save game in' );
  1826. X    if ( savefile = nil or savefile = '' )
  1827. X        "Failed. ";
  1828. X    else if (save( savefile ))
  1829. X        "Saved failed. ";
  1830. X    else
  1831. X        "Saved. ";
  1832. X    abort;
  1833. X    }
  1834. X;
  1835. XrestoreVerb: sysverb
  1836. X    verb = 'restore'
  1837. X    sdesc = "restore"
  1838. X    doAction = 'Restore'
  1839. X    action( actor ) =
  1840. X    {
  1841. X        local savefile;
  1842. X    
  1843. X    savefile := askfile( 'File to restore game from' );
  1844. X    if ( savefile = nil or savefile = '' )
  1845. X        "Failed. ";
  1846. X    else if (restore( savefile ))
  1847. X        "Restore failed. ";
  1848. X    else
  1849. X    {
  1850. X        setscore( global.score, global.turnsofar );
  1851. X        "Restored. ";
  1852. X    }
  1853. X    abort;
  1854. X    }
  1855. X;
  1856. XscriptVerb: sysverb
  1857. X    verb = 'script'
  1858. X    doAction = 'Script'
  1859. X    action( actor ) =
  1860. X    {
  1861. X        local scriptfile;
  1862. X    
  1863. X    scriptfile := askfile( 'File to write transcript to' );
  1864. X    if ( scriptfile = nil or scriptfile = '' )
  1865. X        "Failed. ";
  1866. X    else
  1867. X    {
  1868. X        logging( scriptfile );
  1869. X        "Writing script file. ";
  1870. X    }
  1871. X    abort;
  1872. X    }
  1873. X;
  1874. XunscriptVerb: sysverb
  1875. X    verb = 'unscript'
  1876. X    action( actor ) =
  1877. X    {
  1878. X        logging( nil );
  1879. X        "Script closed.\n";
  1880. X        abort;
  1881. X    }
  1882. X;
  1883. XrestartVerb: sysverb
  1884. X    verb = 'restart'
  1885. X    action( actor ) =
  1886. X    {
  1887. X        local yesno;
  1888. X        while ( true )
  1889. X        {
  1890. X            "Are you sure you want to start over? (YES or NO) > ";
  1891. X            yesno := yorn();
  1892. X            if ( yesno = 1 )
  1893. X            {
  1894. X                "\n";
  1895. X        setscore( 0, 0 );
  1896. X                restart();
  1897. X                abort;
  1898. X            }
  1899. X            else if ( yesno = 0 )
  1900. X            {
  1901. X                "\nOkay.\n";
  1902. X                abort;
  1903. X            }
  1904. X        }
  1905. X    }
  1906. X;
  1907. XversionVerb: sysverb
  1908. X    verb = 'version'
  1909. X    action( actor ) =
  1910. X    {
  1911. X        version.sdesc;
  1912. X        abort;
  1913. X    }
  1914. X;
  1915. XdebugVerb: sysverb
  1916. X    verb = 'debug'
  1917. X    action( actor ) =
  1918. X    {
  1919. X    if (debugTrace())
  1920. X        "You can't think this game has any bugs left in it... ";
  1921. X    abort;
  1922. X    }
  1923. X;
  1924. X
  1925. XundoVerb: sysverb
  1926. X    verb = 'undo'
  1927. X    action(actor) =
  1928. X    {
  1929. X    /* do TWO undo's - one for this 'undo', one for previous command */
  1930. X    if (undo() and undo())
  1931. X    {
  1932. X        "(Undoing one command)\b";
  1933. X        Me.location.lookAround(true);
  1934. X        setscore(global.score, global.turnsofar);
  1935. X    }
  1936. X    else
  1937. X        "No more undo information is available. ";
  1938. X
  1939. X    abort;
  1940. X    }
  1941. X;
  1942. X
  1943. X/*
  1944. X@Prep: object
  1945. XA preposition.  The \tt preposition\ property specifies the
  1946. Xvocabulary word.
  1947. X*/
  1948. Xclass Prep: object
  1949. X;
  1950. X
  1951. X/*
  1952. X *   Various prepositions
  1953. X */
  1954. XaboutPrep: Prep
  1955. X    preposition = 'about'
  1956. X    sdesc = "about"
  1957. X;
  1958. XwithPrep: Prep
  1959. X    preposition = 'with'
  1960. X    sdesc = "with"
  1961. X;
  1962. XtoPrep: Prep
  1963. X    preposition = 'to'
  1964. X    sdesc = "to"
  1965. X;
  1966. XonPrep: Prep
  1967. X    preposition = 'on' 'onto' 'downon' 'upon'
  1968. X    sdesc = "on"
  1969. X;
  1970. XinPrep: Prep
  1971. X    preposition = 'in' 'into' 'downin'
  1972. X    sdesc = "in"
  1973. X;
  1974. XoffPrep: Prep
  1975. X    preposition = 'off' 'offof'
  1976. X    sdesc = "off"
  1977. X;
  1978. XoutPrep: Prep
  1979. X    preposition = 'out' 'outof'
  1980. X    sdesc = "out"
  1981. X;
  1982. XfromPrep: Prep
  1983. X    preposition = 'from'
  1984. X    sdesc = "from"
  1985. X;
  1986. XbetweenPrep: Prep
  1987. X    preposition = 'between' 'inbetween'
  1988. X    sdesc = "between"
  1989. X;
  1990. XoverPrep: Prep
  1991. X    preposition = 'over'
  1992. X    sdesc = "over"
  1993. X;
  1994. XatPrep: Prep
  1995. X    preposition = 'at'
  1996. X    sdesc = "at"
  1997. X;
  1998. XaroundPrep: Prep
  1999. X    preposition = 'around'
  2000. X    sdesc = "around"
  2001. X;
  2002. XthruPrep: Prep
  2003. X    preposition = 'through' 'thru'
  2004. X    sdesc = "through"
  2005. X;
  2006. XdirPrep: Prep
  2007. X    preposition = 'north' 'south' 'east' 'west' 'up' 'down' 'northeast' 'ne'
  2008. X                  'northwest' 'nw' 'southeast' 'se' 'southwest' 'sw'
  2009. X    sdesc = "north"         // Shouldn't ever need this, but just in case
  2010. X;
  2011. XunderPrep: Prep
  2012. X    preposition = 'under' 'beneath'
  2013. X    sdesc = "under"
  2014. X;
  2015. XbehindPrep: Prep
  2016. X    preposition = 'behind'
  2017. X    sdesc = "behind"
  2018. X;
  2019. X
  2020. X/*
  2021. X *   articles:  the "built-in" articles.  "The," "a," and "an" are
  2022. X *   defined.
  2023. X */
  2024. Xarticles: object
  2025. X    article = 'the' 'a' 'an'
  2026. X;
  2027. END_OF_FILE
  2028. if test 47810 -ne `wc -c <'src/ccr-adv.t2'`; then
  2029.     echo shar: \"'src/ccr-adv.t2'\" unpacked with wrong size!
  2030. fi
  2031. # end of 'src/ccr-adv.t2'
  2032. fi
  2033. if test -f 'src/thingext.t' -a "${1}" != "-c" ; then 
  2034.   echo shar: Will not clobber existing file \"'src/thingext.t'\"
  2035. else
  2036. echo shar: Extracting \"'src/thingext.t'\" \(2886 characters\)
  2037. sed "s/^X//" >'src/thingext.t' <<'END_OF_FILE'
  2038. X/*
  2039. X * Colossal Cave Revisited
  2040. X *
  2041. X * A remake of Willie Crowther and Don Woods' classic Adventure.
  2042. X * Converted from Donald Ekman's PC port of the original FORTRAN source.
  2043. X * TADS version by David M. Baggett for ADVENTIONS.
  2044. X *
  2045. X * Please document all changes in the history so we know who did what.
  2046. X *
  2047. X * This source code is copylefted under the terms of the GNU Public
  2048. X * License.  Essentially, this means that you are free to do whatever
  2049. X * you wish with this source code, provided you do not charge any
  2050. X * money for it or for any derivative works.
  2051. X *
  2052. X * ADVENTIONS distributes this game, but you are free to do what you will
  2053. X * with it, provided you adhere to the terms in the GNU Public License.
  2054. X * Send correspondence regarding this game or original works distributed
  2055. X * by ADVENTIONS to 
  2056. X *
  2057. X *    ADVENTIONS
  2058. X *    PO Box 851
  2059. X *    Columbia, MD 21044
  2060. X *
  2061. X * If you would like a catalog of releases, please enclose a SASE.  Thanks!
  2062. X *
  2063. X * Contributors
  2064. X *
  2065. X *    dmb    In real life:    David M. Baggett
  2066. X *        Internet:    <dmb@ai.mit.edu>
  2067. X *        Compu$erve:    76440,2671 (ADVENTIONS account)
  2068. X *        GEnie:        ADVENTIONS
  2069. X *
  2070. X * Modification History
  2071. X *
  2072. X * 1-Jan-93    dmb    rec.arts.int-fiction BETA release (source only)
  2073. X *                      For beta testing only -- not for general
  2074. X *            distribution.
  2075. X *
  2076. X */
  2077. X
  2078. X/*
  2079. X * This file is #included in adv.t and defines extensions to the thing
  2080. X * class.
  2081. X */
  2082. X
  2083. X// Default actions for new verbs.
  2084. X// These are #included into the thing class definition.
  2085. X
  2086. X    verDoKick(actor) = { "Feeling violent?"; }
  2087. X    verDoSmell(actor) = { "It smells like an ordinary "; self.sdesc; "."; }
  2088. X    verDoWave(actor) = {
  2089. X        "Waving "; self.thedesc; " doesn't seem to do much.";
  2090. X    }
  2091. X    verDoBreak(actor) = { "I see no obvious way to do that."; }
  2092. X    verDoRub(actor) = { "Ok, you just rubbed "; self.thedesc; "."; }
  2093. X    verDoCount(actor) = { "I see one (1) "; self.sdesc; "."; }
  2094. X    verDoUse(actor) = {
  2095. X        "You'll have to be a bit more explicit than that.";
  2096. X    }
  2097. X    verDoLight(actor) = {
  2098. X        "I don't know how to light "; self.thesdesc; ".";
  2099. X    }
  2100. X    verDoPick(actor) = { "You're babbling, man!  Snap out of it!"; }
  2101. X    verDoWake(actor) = { caps(); self.thedesc; " is not asleep."; }
  2102. X    verDoBlastWith(actor) = { "Been eating those funny brownies again?"; }
  2103. X    verDoOil(actor) = { "Yuck."; }
  2104. X    verDoWater(actor) = { "I don't see any point to that."; }
  2105. X    verIoOpenWith(actor) = {
  2106. X        "You can't use that to open anything.";
  2107. X    }
  2108. X
  2109. X    /*
  2110. X     * Map douse x with y to pour y on x
  2111. X     */
  2112. X    verDoDouseWith(actor) = { self.verIoPourOn(actor); }
  2113. X    doDouseWith(actor, io) = { io.doPourOn(actor, self); }
  2114. X    verIoDouseWith(actor) = { self.verDoPourOn(actor); }
  2115. X    ioDouseWith(actor, dobj) = { dobj.ioPourOn(actor, self); }
  2116. X
  2117. X    verDoPourOn(actor, io) = {
  2118. X        caps(); self.thedesc; " is going to have to undergo
  2119. X        a major state change first.";
  2120. X    }
  2121. X    doPourOn(actor, io) = {
  2122. X        "This shouldn't happen.";
  2123. X    }
  2124. X    verIoPourOn(actor) = {}
  2125. X    ioPourOn(actor, dobj) = { dobj.doPourOn(actor, self); }
  2126. END_OF_FILE
  2127. if test 2886 -ne `wc -c <'src/thingext.t'`; then
  2128.     echo shar: \"'src/thingext.t'\" unpacked with wrong size!
  2129. fi
  2130. # end of 'src/thingext.t'
  2131. fi
  2132. echo shar: End of archive 1 \(of 11\).
  2133. cp /dev/null ark1isdone
  2134. MISSING=""
  2135. for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
  2136.     if test ! -f ark${I}isdone ; then
  2137.     MISSING="${MISSING} ${I}"
  2138.     fi
  2139. done
  2140. if test "${MISSING}" = "" ; then
  2141.     echo You have unpacked all 11 archives.
  2142.     echo "Now run buildit.sh to make gam file"
  2143.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2144. else
  2145.     echo You still need to unpack the following archives:
  2146.     echo "        " ${MISSING}
  2147. fi
  2148. ##  End of shell archive.
  2149. exit 0
  2150.