User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

mud:arbitrary_commands [2019/08/08 13:40] (current)
admin created
Line 1: Line 1:
 +You may define commands that are triggered whenever someone enters a command that matches the command template (wildcard-ing allowed). ​ These commands are called arbitrary commands, user-defined commands, or $-commands (for how they are defined), and they are checked for only after the check for single-character commands, exits, and internal commands have been performed and have failed (so an arbitrary command that matches 'page *' will never be performed).
 +You define an arbitrary command by storing a string of the form ''​$<​template>:<​command list>''​ in an attribute of an object, then the command will be available to anyone who carries the object, is in the same room as the object, or is inside the object. ​ Only use user-named attributes and VA-VZ for arbitrary commands, as many of the predefined attributes are not for arbitrary commands. ​ <​template>​ is the pattern to check for (it may contain wildcards), and <command list> is a semicolon-separated list of commands to perform. ​ The text that the wildcard characters matched are available in the variables %0 through %9.
 +    > @va testobj = $foobar *:"I was foobar'​ed with %0.
 +    Set.
 +    > foobar xyzzy
 +    testobj says "I was foobar'​ed with xyzzy"
 +You can prevent individual attributes from being checked for $-commands with the command ''​@set <​obj>/<​attr>​ = no_command''​. ​ Attributes so set are reported with ($) following the attribute name when examined. The command ''​@set <​obj>/<​attr>​ = !no_command''​ clears the flag.
 +You can also match a regular expression rather than wildcards. See [[mud:​regexp syntax]] for details.
 +The following attributes are never checked for $-commands:
 +  * [[mud:​ALIAS]]
 +  * [[mud:​CHARGES]]
 +  * [[mud:​DESC]]
 +  * [[mud:​DROP]]
 +  * [[mud:​FAIL]]
 +  * [[mud:​IDESC]]
 +  * [[mud:​ODESC]]
 +  * [[mud:​ODROP]]
 +  * [[mud:​OFAIL]]
 +  * [[mud:​OSUCC]]
 +  * [[mud:SEX]]
 +  * [[mud:​SUCC]]
mud/arbitrary_commands.txt ยท Last modified: 2019/08/08 13:40 by admin