Chris Gray cg at ami-cg.GraySage.Edmonton.AB.CA
Wed Apr 30 22:15:44 New Zealand Standard Time 1997

The email last night got me thinking a bit, and I ended up asking myself
what my scenario would do with a certain command. Well, I'm so happy with
the result that I have to share it with you:

    tell packrat to follow me
    tell packrat to give goblin plate mail to me

both worked just as you would want!

It took a bit of looking up to find out how it worked, however. Packrat
looks at all things spoken. The first word is always the name of the
speaker, then there is "says". I have a builtin function that strips
those off, and returns the speaker name. That is saved on the NPC. If
the first word of the rest of the string is "Packrat" (with some
punctuation allowed), then the rest after that is also saved on the NPC,
and an event is logged for 1 second in the future. That event causes the
NPC to retrieve those two values. The name of the speaker is passed to a
special builtin "SetMeString", where it will be available to match an
agent name of "me". The command string is passed directly to the main
parser, with the main grammar active. So, the command "follow me" is
issued on behalf of the Packrat NPC. "me" is a special case in my
agent-lookup routine, and yields the agent who originally spoke the
command. And so, Packrat starts following me. Etc. Of course, if someone
else spoke a command to Packrat in between, their command would override
mine. Since the event that executes the command deletes those values
from Packrat, they won't get done twice, however - the second event
will just yield a message about Packrat being confused.

We now return to our regular discussion. :-)

Chris Gray   cg at ami-cg.GraySage.Edmonton.AB.CA

More information about the MUD-Dev mailing list