Ability: emitter

Description:

This ability is used for objects which can emit messages.

An emitter can emit messages when they are requested from other objects. Tipically, emitters emit their short and long descriptions.

Opposite to emitter ability is the sensor ability. Sensors are objects which can receive messages.

Usage:

#include <ability.h>

inherit EMITTER;

Functions:

void set_req_handler(string type, mixed h)
Set the request handler for type type to h. If h is a string, then when a message of type type is requested, the string h will be returned.

If h is a function, then when a message of type type is requested, the return value of (*h)(t) will be returned, where t is the type of requested message (t my differ from type). The type of h should be string h(string t).

If type ends with a slash '/' then all subtypes of type will be handled by h. (For further explanation see messages).

mapping query_req_handlers(string type)
Return the mapping of pairs type : handler. This mapping describes exactly what function handles what message type.

void delete_req_handler(string type)
The opposite of set_req_handler. This function deletes the request handler corresponding to type.

string request_msg(string type)
Request a message of type type. The return value is either 0 if the object does not handle that type, otherwise a message is returned.

mapping request_all_msg()
Request all the messages that the object handles. The return value is a mapping of pairs type : message. This is primarily useful for debugging purposes and various other wizard-related things.

Source code:

/ability/emitter.c.

See also:

Messages
Ability: sensor