[DGD] call_touch

Shentino shentino at gmail.com
Wed Sep 10 04:55:29 CEST 2008


One example usage of this by the Klib is as follows:

DGD itself autofires the "touch" notification no matter what function you call.

However, the Klib, in order to not get in the way, needs to "preserve"
the "untriggered" status if something like query_owner() is called.
This function, defined by the klib as a nomask int he auto object, has
absolutely NO side effects, and therefore shouldn't mess with touched
status.

This is handled by allowing the driver object to return a 1 or a 0
depending on if the "trigger" should be reset or not.  The object's
"touch alarm" can be kept armed as needed.

The Klib will return a 1 here for any protected call.  THus, form the
pov of the mudlib on top of it, its "alarm" will still be active ieven
if the klib does something under the hood that would otherwise have
been tripped.

Basically, you call call_touch(object touchable) to "arm the touch
alarm".  When a call is later made to that object,
driver->touch(object touchable, function func) is called to notify the
mudlib that a call is about to be made to that object.  At this point,
the driver can return a 1 or a 0 to instruct DGD on whether or not to
keep the "touch trap" primed after the triggering call is made.

In more proper terms, call_touch is a kfun (you call the server),
whereas driver->touch is an apply (aka hook) in the driver object (the
server calls you).

On Tue, Sep 9, 2008 at 11:31 AM, Erwin Harte <harte at is-here.com> wrote:
> chris . wrote:
>> The documentation in /doc/kfun/ shows me that call_touch has one
>> argument, an object. Within the object manager functions, the
>> function touch has a second argument, function. Does this function
>> always have a specific name, or is it definable?  There isnt a
>> second arg to call_touch, right?
>
> Correct, there isn't.  This is the description of the touch() hook:
>
>    * int touch(object obj, string function)
>
>        An object which has been marked by call_touch() is about to
>        have the given function called in it.  A non-zero return value
>        indicates that the object's "untouched" status should be
>        preserved through the following call.
>
> When an object is just about to be 'touched' because some function
> call will be made in it (and someone had previously requested that it
> be notified about that) the DGD code calls the driver object with the
> object and said function's name.  The driver object can then do
> something useful with this information.
>
> In the kernel-lib's case it calls the touch() in the object manager,
> passing the information on as-is, that's why there is an argument
> named 'function' there.
>
> Hope that helps,
>
> Erwin.
> ___________________________________________
> https://mail.dworkin.nl/mailman/listinfo/dgd
>



More information about the DGD mailing list