[MUD-Dev] Re: DBMS in MU*'s

The Arrow arrow at trelleborg.mail.telia.com
Mon Jul 20 05:50:07 CEST 1998


On Sun, 19 Jul 1998, Chris Gray wrote:

> [Adam J. Thornton:]
> 
>  >The object class an object belongs to implicity defines the verbs for which
>  >that object can be the object of the preposition "with."  That is, knives
>  >can cut and pry.  Keys can unlock.  And so on.
> 
> A subject that got discussed quite a bit last year or early this year
> was related to this. As users, most(?) of us felt it was bad to get a
> wierd error message about an obvious verb, just because that verb wasn't
> applicable to the object in question. So, you may want to consider making
> all verbs valid with all objects, but have them refuse to operate on
> inappropriate objects. If you are going fully OO, you could do that by
> having all verbs on some base "object", which everything else inherits
> from, overriding the verb actions where appropriate.

If you take a look the the IF (interactive-fiction for those who didn't
know :) languages Inform and Hugo, they use global grammar definitions
with global functions for verbs/commands.  When an object needs to do
special things at a command, the object have one or more 'before'- and
'after'- handlers that gets called before and after the verb function.  In
the case of breaking stuff, the object have a before-handler that returns
false (I think), thereby preventing the verb-function from getting called.

In my own language (based on Inform/Hugo and still under development) it
would look something like this:

attribute broken;  /* define a general object-attribute */

verb "break"  /* define a command "break"
{
    /* format: <verb-ident> = <verb-rule(s)> */
    BreakThing = dobject;  /* allows only "break <object>" */
};

/* the verb function for the verb "break" */
function BreakThing()
{
    send_to_actor("You can't break that.\r\n");
}

object breakable_thing
{
    is not broken;  /* the object is not broken by default */
    before BreakThing =
    {
        send_to_actor("Oh no!  You broke it!\r\n");
        is broken;  /* could be "this is broken;" */
        return false;  /* don't call the verb-function */
    }
};

/ 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 dont give a shit about that."             (translated from swedish)






More information about the mud-dev-archive mailing list