Re: Who in interpreter.c Aug 28, 1998 at 05:11:32PM -0400

From: Kevin Doherty (kdoherty@JURAI.NET)
Date: 08/28/98


And thus spake Del Minturn, on Fri, Aug 28, 1998 at 05:11:32PM -0400:
> George wrote:
> > I don't know about you, but my chart goes:
> >
> >   { "who"      , POS_DEAD    , do_who      , 0, 0 },
> >   { "whoami"   , POS_DEAD    , do_gen_ps   , 0, SCMD_WHOAMI },
> >   { "where"    , POS_RESTING , do_where    , 1, 0 },
> >   { "whisper"  , POS_RESTING , do_spec_comm, 0, SCMD_WHISPER },
> >   { "whine"    , POS_RESTING , do_action   , 0, 0 },
> bpl14 stock:
>   { "who"      , "who"  , POS_DEAD    , do_who      , 0, 0 },
>   { "whoami"   , "whoa" , POS_DEAD    , do_gen_ps   , 0, SCMD_WHOAMI },
>   { "where"    , "whe"  , POS_RESTING , do_where    , 1, 0 },
>   { "whisper"  , "whis" , POS_RESTING , do_spec_comm, 0, SCMD_WHISPER },
>
> typing wh in mud brings up whisper.
> go figure!?!

The fact that the code you posted has more elements in its command structure
than George's might be a tipoff that that's not actually bpl14 stock. If I
had to guess, it'd be that second argument that's giving you trouble. Most
likely it's something where you have a loop like

for each element in the command list
  if input equals (or is a substring of) the current element
    set command to current element

And so it sees that "wh" matches "who", "wh" matches "whoa", "wh" matches
"whe" and "wh" matches "whis" and the last one matched is whisper.

--
Kevin Doherty, kdoherty@jurai.net
"Multiple exclamation marks are a sure sign of a diseased mind."
       -- Rincewind (from _Eric_)


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST