The NakedMud Tutorial :: Builtin Hooks
Builtin Hooks
NakedMud comes built in with hook points for various events that need to be extended. Here is a list of them (recent as of version 3.8), their arguments, and a short description of when they are run:
type args description
receive_connectionsk called when a new socket connects to the mud
copyover_completesk called when a connection is recovered from a copyover
init_playerch called when a PC character is created for the first time
reconnectch called after a socket reconncets to a character already in game
char_to_game ch called when a PC or NPC enters the game world
char_from_gamech called when a character is extracted from game world
room_to_gamerm called when a room enters the game world
room_from_gamerm called when an exit is extracted from the game world
obj_to_gameobj called when an object enters the game world
obj_from_gameobj called when an object is extracted from the game world
char_to_roomch, rm called when a character is added to a room
char_from_roomch, rm called when an character is removed from a room
exitch, rm, ex called when a character leaves a room via a movement command. This occurs before the character is actually removed from the room
enterch, rm called when a character enters a room via a movement command or portal. This occurs after the character has actually been added to the room
pre_enterch, rm called when a character enters a room via a movement command or portal. This occurs after the character has actually been added to the room, but before they have been forced to 'look' at it.
obj_to_charobj, ch called when an object is added to a character's inventory
obj_from_charobj, ch called when an object is removed from a character's inventory
obj_to_objobj, obj called when an object is added to a container. Second argument is the container
obj_from_objobj, obj called when an object is removed from a container. Second argument is the container
obj_to_roomobj, rm called when an object is added to a room
obj_from_roomobj, rm called when an object is removed from a room
givech, ch, obj called after an object has been transfered from one character to the other via the 'give' command. The first argument is the giver, and the second is the receiver.
getch, obj called after an object has been transfered to a character's inventory via the 'get' command
dropch, obj called after an object has been transfered to a room via the 'drop' command
equipch, obj called when an object is put on a character's body
wearch, obj called after equipment has sucessfully been equipped via the 'wear' command
unequipch, obj called when an object is removed from a character's body
pre_unequipch, obj called just before an object is to be removed from a character's body, but the object is still on the character
removech, obj called after equipment has sucessfully been unequipped via the 'remove' command
open_objch, obj called after a character opens an object through the 'open' command
close_objch, obj called after a character closes an object through the 'close' command
open_doorch, ex called after a character opens an exit through the 'open' command
close_doorch, ex called after a character closes an exit through the 'close' command
tellch, ch, str called after a character sends a message to another via the 'tell' command. The second argument is the receiver, and the third is the message.
askch, ch, str same as tell, for the ask command
saych, str called after a character uses the 'say' command
greetch, ch called after a character uses the 'greet' command on another character. The second argument is the person being greeted.
post_greetch, ch called immediately after greet hooks
preprocess_obj_descobj, ch called when a character's look buffer is ready to be processed (e.g., by embedded scripts) after looking at an object. At this point, the look buffer is simply the object's raw description
append_obj_descobj, ch called after preprocess_obj_desc. At this stage, outside hooks can append extra information to the character's look buffer
look_at_objobj, ch called after a character's look buffer has been sent to their socket and cleared
preprocess_room_descrm, ch same as preprocess_obj_desc, for rooms
append_room_descrm, ch same as append_obj_desc, for rooms
look_at_roomrm, ch same as look_at_obj, for rooms
preprocess_exit_descex, ch same as preprocess_obj_desc, for exits
append_exit_descex, ch same as append_obj_desc, for exits
look_at_exitex, ch same as look_at_obj, for exits
preprocess_char_descch, ch same as preprocess_obj_desc, for characters
append_char_descch, ch same as append_char_desc, for characters
look_at_charch, ch same as look_at_obj, for characters
preprocess_char_descch, ch same as preprocess_obj_desc, for characters
append_char_descch, ch same as append_char_desc, for characters
look_at_charch, ch same as look_at_obj, for characters
process_outbound_textsk called when a socket's outbound text buffer is ready to be preprocessed (e.g., for color codes). At this point, the socket's text buffer is simply the raw text it has been sent. Does not include prompt text
process_outbound_promptsk same as preprocess_outbound_text, but for prompt text only
append_char_descch, ch same as append_char_desc, for characters
look_at_charch, ch same as look_at_obj, for characters
commandch, str, str called after a command has been sucessfully executed. Second argument is the command, and the third is the argument supplied to the command
reset_zonestr called when a zone is reset. Argument is the zone name
reset_roomrm called when a room is reset
receive_iacsk, str called when a telnet IAC command is received by a socket
shutdownnone called before the mud is exited, via the 'shutdown' command