LISTENING

From TinyMUX
Jump to navigation Jump to search

LISTENING

Thee are two ways to listen for something in a room. The easiest way is to use a combination of @listen and @ahear/@aahear/@amhear. The second way is to use a "^" pattern in an attribute, similar to the way "$" is used for user-defined commands. The attribute takes the form: '^<pattern>:<action>'.

The ^-pattern check is only performed on objects with their MONITOR flag set. The criterion for triggering a pattern-listen is the same as that for triggering an @ahear - the object cannot trigger its own listen patterns. All matching attributes have their <action>s performed, not just the first. Also, attributes with the no_command flag set are not checked for ^-patterns, and neither are objects' parents.

Example:
> @va test = ^* says "foo *":say I got a foo with %1!.
Set.
> @set test=monitor
test grows ears and can now hear.
> say foo bar
You say "foo bar"
test says "I got a foo with bar!."

Related Topics: @ahear, @listen, @set.