Message-ID: <3B86531C.E7D714D2@csi.com>
Date: Fri, 24 Aug 2001 09:14:04 -0400
From: John Colagioia <JColagioia@csi.com>
Organization: No Conspiracy Here...
X-Mailer: Mozilla 4.77 [en] (Win98; U)
X-Accept-Language: en,fr,ru,es,it,ga,de,ja,gd,eu
MIME-Version: 1.0
Newsgroups: rec.arts.int-fiction
Subject: Re: [inform] Simple ASK ABOUT TOPIC  question
References: <jh%g7.41404$wZ3.3285308@news20.bellglobal.com> <3B8500C9.24BA6E2C@csi.com> <Qofh7.40614$wX5.3306231@news20.bellglobal.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 208.34.37.104
X-Original-NNTP-Posting-Host: 208.34.37.104
X-Trace: excalibur.gbmtech.net 998658405 208.34.37.104 (24 Aug 2001 09:06:45 EST)
Lines: 60
X-Authenticated-User: jnc
X-Original-NNTP-Posting-Host: 127.0.0.1
Path: news.duke.edu!newsgate.duke.edu!solaris.cc.vt.edu!news.vt.edu!netnews.com!nntp.abs.net!uunet!dca.uu.net!ash.uu.net!excalibur.gbmtech.net
Xref: news.duke.edu rec.arts.int-fiction:91544

marksimo wrote:

> Thanks for the help. Can anybody explain why this doesn't work, though?
> [vagueAskSub i;
>    objectloop (i has animate)
>    if (TestScope (i, player))
>   <<ask i noun>>;  <- I suspect this is a problem, but I'm not sure how else
> to do it .
> ];
> extend "ask" first
>  * 'about' topic  -> vagueAsk;

Odd.  I honestly can't see anything wrong with it, technologically.
Algorithmically, it's a little suspect because it will pick someone if there are
multiple characters in the room, which isn't necessarily the best idea.  Some
experimentation with code like yours tells me that there are other objects (the
player being among them) which have the "animate" attribute and muddy the
waters--at least for me.

You can see if the same thing is happening to you by changing the "reissued
command" to <ask i noun>, to see how many times it's being called in the loop.

I'd suggest making all the NPCs of a certain class (I usually call mine
something blazingly obvious like "NPC"), and then checking class membership,
rather than the animate Attribute.

If you have mobile NPCs, you could also wrap in some of what Emily Short
mentioned, something along these lines:

Global    last_asked;

[ VagueAskSub obj who count ;
 if (last_asked)    ! Use the last person spoken to as a default
    {
     if (TestScope (last_asked, player))
        <<Ask last_asked noun>>;
     else
        last_asked == nothing;
    }
 count = 0;
 objectloop (obj ofclass NPC)
     if (TestScope (obj, player))
      {
       who = obj;            ! Save this character
       count = count + 1; ! ...and count him
      }
 if (count == 1)
    {
     last_asked = who;
      <<Ask who noun>>;
    }
 "Don't ask me!";    ! Either too many, or too few NPCs found
];

....and you should change/replace AskSub() (and TellSub(), most likely) to also
set last_asked.

Hopefully, that makes some sense.


