Two bugs in TADS library (adv.t version 2.2)


10 Jun 1995 17:21:57 GMT

I've found what seems like two bugs in the TADS library that is
bundled with TADS 2.2. Both are in the file adv.t.

The first bug: In the definition of thing, the verDoTakeOut method
looks like this:

verDoTakeOut( actor, io ) =
{
if ( io <> nil and not self.isIn( io ))
{
caps(); self.thedesc; " isn't in "; io.thedesc; ". ";
}
self.verDoTake(actor); /* ensure object can be taken at all */
}

Shouldn't there be an "else" before the self.verDoTake(actor)? Otherwise,
we might get contradictory messages from verDoTakeOut and verDoTake.

An example:

:: > inventory
:: You have a black shirt (being worn) and a red shirt.
::
:: > put red shirt in cupboard
:: OK.
::
:: > take black shirt from cupboard
:: The black shirt isn't in the cupboard. You don't want to take off your
:: shirt now - someone might be watching!

What happened here is that the black shirt's verDoTake method called
verDoUnwear, which gave an error message quite inconsistent with the
situation. Adv.t's clothingItem assumes that if you try to take
something you're wearing, what you really want to do is to take it
off; of course, one can question the realism in that, but in any case
verDoTake shouldn't even be called here, should it?

I suppose the moral of this story is that verXXX methods should always
return after printing out their "you can't do that" message.

Another bug: The 'inventory' verb is defined as

iVerb: deepverb
verb = 'inventory' 'i'
action( actor ) =
{
if (length( actor.contents ))
{
"You%have"; listcont( actor ); ". ";
listcontcont( actor );
}
else
"You%are 0.000000e+00mpty-handed.\n";
}
;

If the all the objects in the actor's content list have islisted set
to nil, this will print "You have ." rather than "You are
empty-handed." which is the appropriate response in my case (where I
have some objects that are located in the actor, but shouldn't be
listed as carried by him).

This bug is simple to fix: simply replace "length(actor.contents)"
with itemcnt(actor.contents)".

Magnus Olsson (mol@df.lth.se) / yacc computer club, Lund, Sweden
Work: Innovativ Vision AB, Linkoping (magnus.olsson@ivab.se)
Old adresses (may still work): magnus@thep.lu.se, thepmo@selund.bitnet
PGP key available via finger (to df.lth.se) or on request.