home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / rec / games / intfict / 882 < prev    next >
Encoding:
Internet Message Format  |  1992-11-15  |  4.1 KB

  1. Path: sparky!uunet!snorkelwacker.mit.edu!ai-lab!case!dmb
  2. From: dmb@case.ai.mit.edu (David Baggett)
  3. Newsgroups: rec.games.int-fiction
  4. Subject: Re: TADS fragment & moaning
  5. Date: 15 Nov 1992 22:31:14 GMT
  6. Organization: MIT Artificial Intelligence Laboratory
  7. Lines: 109
  8. Message-ID: <1e6j3iINNou9@life.ai.mit.edu>
  9. References: <1e14pvINNhsg@life.ai.mit.edu> <1992Nov15.150116.23785@kth.se> <1992Nov15.163222.3799@starbase.trincoll.edu>
  10. NNTP-Posting-Host: case.ai.mit.edu
  11.  
  12. In article <1992Nov15.163222.3799@starbase.trincoll.edu> Russell L. Bryan <rbryan@Mail.trincoll.edu> writes:
  13. >In article <1992Nov15.150116.23785@kth.se> Tommy Nordgren,
  14. >f85-tno@nada.kth.se writes:
  15. >>    For an example, try implementing the following commands, based on
  16. >>infocoms Enchanter.
  17. >>    Frotz cup.
  18. >>    Cast the frotz spell on the cup.
  19. >>    Enchant the cup with the frotz spell. 
  20. >
  21. >Although I haven't tried the above myself, I do know of one person who
  22. >attempted to write an Enchanter-like magic interface.  He found it
  23. >exceptionally difficult.
  24.  
  25. It shouldn't be hard; I posted some code here a few weeks ago that
  26. outlined one way to do it.  It's just a matter of defining a bunch of
  27. new verbs.
  28.  
  29. >In particular, the command "gnusto frotz" (inscribe something into
  30. >your spell book) was inaccessible because it required a word to be
  31. >referred to as both a verb and a noun, which is not, as far as I know,
  32. >acceptable to TADS, even after modifying ADV.T.
  33.  
  34. As far as I know there is no problem with having verbs and nouns be
  35. identical.  I just tried it with TADS 2.0 and it works fine, and I
  36. don't recall it being a problem with earlier versions.
  37.  
  38. There is a bug in some versions of TADS 1.2, however, that disallows
  39. the player from referring to items that aren't reachable.  An easy way
  40. to solve the "gnusto frotz" problem (even under the buggy TADS 1.2)
  41. would be to have a floating decoration like the following:
  42.  
  43. frotzspell: decoration
  44.     canbecast = nil    // can't be cast until learned
  45.     sdesc = "frotz spell"    
  46.     ldesc = "Frotz is a spell, and exists only in the mind of the
  47.         caster."    // catch "examine frotz"
  48.  
  49.     locationOK = true    // tell compiler OK for location to be method
  50.     location = { return Me.location; } // always where the player is
  51.  
  52.     noun = 'frotz' 'spell'
  53.     adjective = 'frotz'
  54.  
  55.     /*
  56.      * Write spell into spellbook
  57.      */
  58.     verDoGnusto(actor) = {
  59.         // disallow action here under game-related circumstances,
  60.         // e.g., until the player finds the related scroll.
  61.     }
  62.     doGnusto(actor) = {
  63.         "You write the spell into your spellbook.";
  64.         self.canbecast := true;
  65.     }
  66.  
  67.     /*
  68.      * Cast spell
  69.      */
  70.     verDoCast(actor) = {
  71.         if (not self.canbecast)
  72.             "You don't know the frotz spell yet.";
  73.     }
  74.     doCast(actor) = {
  75.         // code here for frotz not directed at a particular object
  76.     }
  77.  
  78.     /*
  79.      * Cast spell on something
  80.      */
  81.     verDoCastOn(actor) = { self.verDoCast(actor); }
  82.     doCastOn(actor, io) = {
  83.         // code here for casting frotz on object "io"
  84.     }
  85.  
  86.     /*
  87.      * A synonym for "cast X on Y" is "enchant Y with X"
  88.      */
  89.     verIoEnchantWith(actor) = { self.verDoCast(actor); }
  90.     ioEnchantWith(actor, do) = { self.doCastOn(actor, do); }
  91.  
  92.     // We also need to define verDoEnchantWith and doEnchantWith
  93.     // methods in thing to go along with this.
  94. ;    
  95.  
  96. Then you can say any of the following:
  97.  
  98. >gnusto frotz (spell)
  99. >cast frotz (spell)
  100. >cast frotz (spell) on <X>
  101. >enchant <X> with frotz (spell)
  102.  
  103. regardless of whether you have a verb with corresponding vocab 'frotz'.
  104. If you did add a frotz verb, you'd just forward all the actions to
  105. the frotz object.  So you could also say:
  106.  
  107. >frotz        [frotzVerb would call frotzspell.doCast(actor)]
  108. >frotz me    [frotzVerb would call frotzepll.doCastOn(actor, Me)]
  109.  
  110. You will probably want to make some changes to the thing class in ADV.T
  111. in the course of all this.  I usually put my extentions to the thing
  112. class in a separate file, and add an include directive to adv.t at the
  113. end of the (thing class) definition.  This makes the changes easy to
  114. propagate to new versions of adv.t.
  115.  
  116. Dave Baggett
  117. --
  118. dmb@ai.mit.edu           MIT Artificial Intelligence Laboratory                  
  119. ADVENTIONS: interactive fiction (text adventures) for the 90's!
  120. dmb@ai.mit.edu *** Compu$erve: 76440,2671 *** GEnie: ADVENTIONS
  121.