Zmud Triggers

Triggers are automated responses to information sent to you by Winterkill.

More specifically triggers are fired when zmud recieves a portion of text matching a special pattern. An example trigger could be: pattern: is DEAD, R.I.P. action: loot;ga;put all in cart; Another trigger may be: pattern: HP: &HpVar/~[&HpAll~] SP: &SpVar/~[&SpAll~] action:
 * 1) MATH HpTemp @HpAll-@HpVar;
 * 2) MATH SpTemp %4-@SpVar;
 * 3) IF (@HpTemp+@SpTemp>0){say I still need @HpTemp hit points and @SpTemp mana}

The following information have been taken from the help pages for zMud 7:

Patterns
Patterns can contain several special character for wild-card matching. * match any number (even none) of characters or white space
 * ? match a single character
 * %d match any number of digits (0-9)
 * %n match a number that starts with a + or - sign
 * %w match any number of alpha characters (a-z) (a word)
 * %a match any number of alphanumeric characters (a-z,0-9)
 * %s match any amount of white space (spaces, tabs)
 * %x match any amount of non-white space
 * %y match any amount of non-white space (same as %x but matches start and end of line)
 * %p match any punctuation
 * %q match any punctuation (same as %p but matches start and end of line)
 * %t match a direction command
 * %e match ESC character for ansi patterns
 * [range] match any amount of characters listed in range
 * ^ force pattern to match starting at the beginning of the line
 * $ force pattern to match ending at the end of the line
 * (pattern) save the matched pattern in a parameter %1 though %99


 * ~ quote the next character to prevent it to be interpreted as a wild card, required to match special characters


 * match a quote character verbatim


 * {val1|val2|val3|...} match any of the specified strings can not use other wildcard inside this


 * @variable match any of the specified strings or keys works with string lists and record variables


 * {^string} do not match the specified string


 * &nn matches exactly nn characters (fixed width pattern)


 * &VarName assigns the matched string to the given variable (see below for more info)

To save any part of the pattern to the %1..%99 parameters, enclose the part of the parameter in parenthesis. In specifying a range, you can list specific characters such as [abc] or you can use a range [a-c]. To use a wild card character in the pattern string itself, precede the special character with the ~ quote character. For example, the pattern ~[test~] will match the string [test] rather than being interpreted as a range wild-card pattern.

To match a blank line, use the $ pattern by itself. To match multiple lines include $ in the middle of the pattern to match the line boundary. You can also include variables in your pattern, and the name of the variable will be replaced with its value before the pattern match is performed.

Actions
The basic action may simply be a text you would otherwise type and send yourself to the game. However, you may use a wide range of modifications and programming capabilities

Functions

 * 1) VAR variableName {StringExpression} - assign to the variable the text that is given as the second parameter
 * 2) MATH variableName {mathExpression} - assign the value of the mathematical expression to the given variable
 * 3) SHOW @variableName - display the value of the given variable
 * 4) ADD variableName amount - increase the value of the given variable by the specified amount
 * 5) IF {expression} {true-command} {false-command} - no need for comment here
 * 6) CASE index command1 [...command_n] - depending on the value of (index modulo n) execute a command
 * 7) COLOR [pattern] attribute - used to highlight portions of text. Other similar functions are #CO, #PCOL
 * 8) PLAY filename - if filename is actually a directory name, zmud will play the whole media content of this directory
 * 9) REPEAT expression command
 * 10) WA time - or #WAIT time, time is counted as miliseconds
 * 11) YESNO question yes-command no-command - Displays a dialog box that asks the specified question.

Examples: if the variable @joincmd is 1 (or 3,5,7...) the string join is returned, otherwise the string rescue is returned. returns a random string from the given list to the MUD changes the last line to bold font and colors it red
 * 1) CASE @joincmd {join} {rescue}
 * 1) CASE %random {Hello} {Hi there} {Hiya} {Hi}
 * 1) CO bold,red