---A Guide to Generating Events for lilyCore Developers
This document is intended as a guide for lilyCore developers who want to generate new instances of existing events. If a developer wishes to add an entirely new type of event, they have three options: Wait for me to write the documentation, figure it out from the code, or ask me.
This documennt should be accurate as of lilyCore release 2.2a2.
The method for generating an event is:
$lily_utils:event_broadcast(event,content,recipients,discussions[,sender])
Details on the arguments to :event_broadcast are presented below.
event A string containing the name of the event. A list of all events available on a server can be found in $event_mgr.event_list.
content A list containing the content of the message. This list contains one or more elements.
The first element is a string containing the pre-formatted message to be sent to the user. This should not contain a signal or timestamp, which are client dependent and will be added by the event system.
The second element is a string indicating the new value related to an event such ar 'blurb' or 'rename'. If there is no appropriate value, this element should contain the value $nothing. Optionally, if there are no additional elements, this element may be omitted.
The third and following arguments are event dependent. The only event that currently uses the third element is 'rename', which uses it to pass the user's old name in order to generate a proper unidle event. See also the notes below on lily games.
recipients A list containing the object numbers of all users who should recieve the event. An empty list implies that the event will be sent to all of the users in $players_on.
discussions A list containing the object numbers of all discussions affected by the event. An empty list means that the event does not affect any discussions.
sender (optional) An object number indicating the user who triggered the event. If left out, the value of the built in variable player. This argument is used for events which were trigged by the system on behalf of the event, such as the events generated when a player idles away or idles to death.
Games in lily, and the 'game' event, are something of a special case. The 'game' event has a custom event handler, which mimics the behavior of the default event handler. Each game can override this event handler with a method called :handle_event on the game object. Therefore, the content of a game event depends on the author of the game.
Documetation on writing a custom event handler is not currently available. If you have an interest in writing your own event handler for a game, you have the same three options as if you want to add a new type of event.
---Questions or comments are welcome.
- Matt