Difference between revisions of "MUDL:On command"
(Created page with " __TOC__ = Overview = This MUDL function gets called whenever someone types the given command. So, if you wanted something to happen whenever someone in the room bows, then...") |
|||
Line 54: | Line 54: | ||
− | [[Category:Building]] [[Category:Room Procedures]] [[Category:Mobile Procedures]] [[Category:Object Procedures]] [[Category:MUDL]] | + | [[Category:Building]] [[Category:Room Procedures]] [[Category:Mobile Procedures]] [[Category:Object Procedures]] [[Category:MUDL|On_command]] |
Revision as of 00:08, 27 February 2016
Overview
This MUDL function gets called whenever someone types the given command. So, if you wanted something to happen whenever someone in the room bows, then you would create a MUDL function "on_bow". Note that the MUDL is called BEFORE the command is executed.
Command Syntax
addproc <room|mobile|object> mudl setproc <room|mobile|object> ## on_command
Global Variables
The following global variables are available:
Name | Type | Description |
---|---|---|
%a | Character | The character or mobile that initiated the command. |
%c | Character | The mobile that the MUDL script is attached to. This value is null if the script is attached to a room or object. |
%o | Object | The object that the MUDL script is attached to. This value is null if the script is attached to a room or mobile. |
%r | Room | The room that the MUDL script is attached to. This value is null if the script is attached to a mobile or object. |
%s | String array | The arguments the player typed after the command. |
Return Values
Your "on_something" MUDL function should return a boolean. If it returns true, that means the command has been intercepted and the MUD should act as if it didn't happen; if it returns false, then the MUD will proceed with the command as normal.
Triggered Scripts
MUDL attached to rooms are always triggered by on_something functions. For MUDL on mobs, on_something functions get called whenever anybody in the room issues a command. Ditto for objects on the floor. For objects in inventory, it gets called whenever the owner issues a command, unless it's in a container in which case it doesn't get called at all. For MUDL on worn/ wielded items it will be called whenever anybody in the room issues a command.