From TinyMUX
Jump to navigation Jump to search


You may define commands that are triggered whenever someone enters a command that matches the command template (wildcarding 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>:<commandlist>' 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 <commandlist> 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.
 > 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_program'. Attributes so set are reported with ($) following the attribute name when examined. The command '@set <obj>/<attr> = !no_program' clears the flag.

You can also match a regular expression rather than wildcards. See 'help Regular Expressions' for details.

The following attributes are never checked for $-commands: ALIAS CHARGES DESC DROP FAIL IDESC ODESC ODROP OFAIL OSUCC SEX SUCC.

Related Topics: @set.