MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: Parsing Problems



>From: Kipp the Kidd <mcmudge@mailbox.syr.edu>
>
>This brings to mind a new type of parsing.  I haven't got a name for it..
>'cause I think I stole it from how I *think* muds do it.  As soon as an
>object is either in the room with the player, or in their inventory, it's
>added to a list of commands the player can type.  When the player types
>the command, the object's (whatever) is invoked, and it takes care of the
>rest of the parsing.   A simple 'read' will work for a note in the room,
>even if you don't type it's name.  I've successfully implemented this at
>my RPG MOO, but haven't found anything that will use it... YET.

If by "muds" you mean LPmuds, then, yes, this is essentially how LPMuds
do parsing.

The actual implementation is more efficient than the following description,
but the parsing algorithm is effectively as follows:

  -- every object declares which command-line verbs it will handle
     (just the verb -- no argument specification)
  -- when a player types a command, then the first word of the command
     is considered to be the verb
  -- a list of all objects in the player's environment which are willing
     to handle that verb is constructed.  The environment includes the
     player's object, the player's location, objects inside the player,
     and objects in the player's location.  The ordering is done according
     to certain rules.
  -- the first object in the list has the appropriate verb called to attempt
     to handle the player's command.  If the verb returns an failure value,
     then the next object in the list is tried.  This continues until either
     some object is found which successfully handles the command, or until
     the end of the list is reached, in which case an error message is
     printed.

This works quite well for LPmuds.  However, it does have the drawback
that if a programmer does the parsing badly on one of their objects,
there can be really unpleasant results.  On the other hand, it does
allow for very complex and intelligent command parsing.

  -- Sam




Follow-Ups:

Home | Subject Index | Thread Index