Newsgroups: rec.arts.int-fiction
Path: gmd.de!xlink.net!sol.ctr.columbia.edu!hamblin.math.byu.edu!news.byu.edu!news.kei.com!yeshua.marcam.com!zip.eecs.umich.edu!newsxfer.itd.umich.edu!gumby!yale!yale.edu!noc.near.net!viewlog.viewlogic.com!allen
From: allen@viewlogic.com (Dave Allen)
Subject: Advanced TADS programming question
Message-ID: <Cn8BBt.Kzw@viewlogic.com>
Sender: news@viewlogic.com
Nntp-Posting-Host: hex
Organization: Viewlogic Systems Inc.
Date: Fri, 25 Mar 1994 16:33:27 GMT
Lines: 36

I recently wrote some TADS code to allow NPCs to reply to "ask about"
questions, and I ran into a snag.  I would like the advice of expert
TADS writers.

The validIo method for askVerb disambiguates uniquely; it returns
the first object it happens to find which matches the vocabulary:

   validIo( actor, obj, seqno ) = { return( seqno = 1 ); }

Suppose there are three rocks of which two are present in the room
with you and the NPC.  If you ASK ABOUT ROCK, the parser builds a list of
all three rocks in some unknown order.  Then the above validIo "disambiguates"
by choosing the first rock.  Since the list is in unknown order, the rock
might be any one of the three -- either one of the rocks in the room, or even
the rock which isn't in the room.

I want to have the NPC maintain a list of items it knows about, and then if it
knows about more than one, the _NPC_ (not the parser) should ask for
disambiguation, for example:

   > ASK JOE ABOUT ROCK
   Joe says, "Which rock do you mean, the red rock, the blue rock, or the
   green rock?"

If I switch the validIo to the style used by, say, "take", then what I would
get is the _parser_ asking about disambiguation, like this:

   > ASK JOE ABOUT ROCK
   Which rock do you mean, the red rock or the blue rock?

The list to be disambiguated is then the list of visible items in the room,
rather than the list the NPC knows about.

Does anybody have a suggestion on how to make the _NPC_ do the disambiguation?

- Dave Allen: allen@viewlogic.com
