# priority

When more than one macro is matched by a trigger or hooked event, the following rules are used to select which of the macros will be applied (i.e., have its attributes applied to the text, and its body executed):

- Macros are compared in order of decreasing priority.
- Fall-thrus of a given priority are compared before non-fall-thrus of the same priority.
- Each matching fall-thru macro is applied immediately when it is found.
- When the first matching non-fall-thru macro is found, all the non-fall-thrus of equal priority are collected, and the search ends. One of the non-fall-thrus is chosen at random and applied.

So, in the simple case when there are no fall-thrus, the highest priority match is chosen. If there is more than one of the highest priority, one of those is chosen at random.

These priority rules apply even to macros defined or undefined by a macro found during the search. For example, if a mud line triggers a fall-thru macro /foo, and /foo defines a new trigger macro /bar which also matches the line, then /bar may be triggered if it has lower priority than /foo.

A macro's priority is set with /def -p; its fall-thru option is set with /def -F.

Use the `/trigger -n` command to display a list of the triggers triggers or hooks will match a given string.

See: triggers, hooks, macros, /def

Back to index
Back to tf home page

Copyright © 1995, 1996, 1997, 1998, 1999, 2002, 2003 Ken Keys