Newsgroups: rec.arts.int-fiction
Path: gmd.de!xlink.net!howland.reston.ans.net!spool.mu.edu!wupost!gumby!destroyer!nntp.cs.ubc.ca!newsserver.sfu.ca!sfu.ca!neilg
From: neilg@fraser.sfu.ca (Neil K. Guy)
Subject: Re: Annoying squibbly little TADS problems
Message-ID: <neilg.750318461@sfu.ca>
Sender: news@sfu.ca
Organization: Simon Fraser University, Burnaby, B.C., Canada
References: <29ali2$gmn@bigboote.WPI.EDU>
Date: Mon, 11 Oct 1993 05:47:41 GMT
Lines: 83


 Avram,

> I know they're really unimportant to the game, and I shoulden't be
> worrying about them right now, but these things might be importants
> later in life, so I'm gonna ask y'all about them now.  Here we go:

 Actually, they may be details but the come from a problem that most
of us have, starting out with TADS. That is, understanding the
difference between methods that verify whether a verb can work or
not, and the method that actually performs whatever is required.

 Here's an example. Let's say you've got a nice lump of fried tofu.
(why not? Sillier examples have been used.) Now, you can't look
inside the lump of fried tofu as it has no interior, so you'd want
to print an error message if the player tries to do something as
absurd as look inside it. Since you've defined the tofu as an item
and not a container, typing LOOK IN TOFU will bring up the
verDoLookin method, which reports that there's nothing in the tofu
or you can't look in it or whatever. The TADS parser then brings
the command prompt back.

 However, if you define the tofu as a container then you'll see that
it uses the "container" object's verDoLookin method, which
overrides the one provide with the "thing" object. This verDoLookin
method has two curly brackets and nothing inside. No code to
execute. So the parser goes on to the doLookin method, which
provides a list of the contents of the object. The distinction
between verify methods and verb methods is discussed in greater
detail on page 38 of the TADS manual.

> 1) I've a container, namely a trash bin, and I want the game to do the
> following:  When 'look at bin' is typed, I want the game to give the ldesc
> of the bin, NOT the list of what's in it.  When 'look in bin' is typed, I
> want the game to give the list of stuff in the bin, and NOT the ldesc.  I
> can't think of any way to do this without doing something drastic like 
> rewriting 'look' or something silly like that.

 No need to rewrite the look verb. If you define the bin as a
container the system should do it for you automatically. Simply
define your own ldesc to override the system default ldesc, which
lists the contents of the container or says it's empty if it is. If
you do this, however, you'll find that typing LOOK IN BIN presents
the ldesc. No problem! Simply add a custom verDoLookin method that
lists the contents. You can just copy the standard ldesc out of
adv.t and make it a verDoLookin method instead.

> 2) I've got an item, namely a letter, that the player can manipulate, but 
> cannot take or open.  The way I've got it coded now:
> [...]
> doTake( actor )
> {
>      "Don't take that";
> }
> doOpen( actor )
> {
>      "Don't open that";
> }

 Again, you're using a verb instead of a verify. If you want the
parser simply to print an admonishing message telling the player to
bog off and do nothing else, you should use verify methods. So for
above:

verDoTake( actor )
{
     "Sorry. %You% can't take that! ";
}
verDoOpen( actor )
{
     "Sorry. %You% can't open that! ";
}

will work. If it's a letter or something, it should probably be a
readable item. And, yes, I changed the message to make it more
polite. Call it my Canadian temperament. :) I also used format
strings (page 54 in the manual) which makes the error message more
compatible with non-player actors.

 Hope this helps!
 
 - Neil K. (n_k_guy@sfu.ca)

