[MUD-Dev] Re: MUD verb handling (Was: DevMUD - thoughts.1)

The Arrow arrow at trelleborg.mail.telia.com
Sun Oct 25 12:54:34 New Zealand Daylight Time 1998

On Sat, 24 Oct 1998, Chris Gray wrote:

> Parsing
> This is a tricky issue. There is a whole range of ways that parsing can
> be done. For example, in LPC, a lot of parsing is done by the individual
> objects in the world. How does that fit into the module scheme? I'll
> let others suggest how other schemes might fit in - I don't know enough
> about them to say anything reasonable.
> I *do* know what my system is, however, so I can talk about how it would
> fit into this scheme. In my scheme, there are things call "grammars"
> that describe how to handle text input. (Is a parser required for
> non-text input?) Each grammar contains a table of words and their
> synonyms. Words which are verbs describe what the structure of a
> command starting with that word looks like (so, this doesn't extend
> to other languages than English very well). This description is just
> a selection of one of:
>     - no other words in the command
>     - a possible extra specific word, then a noun phrase
>     - a noun phrase, a specific word, a second noun phrase
>     - uninterpreted - pass the word list on
> It's a bit more complicated than that, but I hope you get the idea. A
> very simple structure, but it handles most input reasonably well. The
> key is, that associated with each verb word is a reference to a
> MUD-language function to call to process the commands that match that
> verb specification. (The same word can be the verb word for more than
> one specification - the specific extra words are used to choose among
> them.)

Hmm, reminds me of the system I have thought of for my mud.  However, I
haven't got anything else than some random thoughts and a yacc grammar for
my mud-language (based on a mix of C and the IF languages Hugo and Inform)
for the definition of the verbs.  Verb handlers exists either as functions
in the mud language, or not at all (a "Huh?!?" type message gets written),
and all mud-objects may have one or more (or none) after and before handlers
wich gets called after and before the verb default function.  The after and
before handlers can return false to stop the verb parser from searching for
more handlers and not execute the default verb function.
For example, assume Bubba the human tries to pick up a rock, the rock object
have a a before handler for the OnGet verb that checks the strength of the
actor and prints "The rock is to heavy for you." message and returns false
if the actors strength is to small, making the rock ungetable for Bubba.

/ Joachim
The Arrow                   Email: arrow at trelleborg.mail.telia.com
Joachim Pileborg              WWW: http://w1.410.telia.com/~u41003102/
"They say I don't give a shit about anything," -- Magnus Uggla
"but I don't give a shit about that."        (translated from swedish)

More information about the MUD-Dev mailing list