[MUD-Dev] Re: MUD verb handling (Was: DevMUD - thoughts.1)
Chris Gray
cg at ami-cg.GraySage.Edmonton.AB.CA
Sun Oct 25 09:23:15 CET 1998
[The Arrow (Joachim):]
>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.
Rather than 'Huh?!?', I think mine says "I don't understand a command
starting with <verb>." Lets the user know what went wrong, but otherwise
equivalent.
Pre and post handlers: yes! Also, there are uses for having such handlers
(I call them checkers) attached to the character and to the locations.
I would do the weight test with the character checker, rather than having
all objects have to do it.
Actually, my system isn't pure OO. So, in fact what happens is that the verb
code for 'get' does such checking directly. Currently, I have no concept of
weight, but a character can only carry so many things, so it is that check
that is done directly. The checks on the character, object and room are done
only after passing that first check, and those *are* retrieved from the
entities in an OO fashion. Also, with my system, the checkers are actually
just properties that can contain function references, and are usually
empty, thus occupying no space in the DB.
--
Chris Gray cg at ami-cg.GraySage.Edmonton.AB.CA
More information about the mud-dev-archive
mailing list