Patterns can contain several special character for wild-card matching.
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 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. Note that the quote character can be changed in the Preferences section.
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.
The &VarName syntax deserves a bit more explanation. It is used to store a matched pattern into a variable directly. For example, if you have a trigger:
#TRIGGER {You get &Gold coins}
and the MUD displays
You get 1000 coins
Then the value 1000 is automatically put into the @Gold variable with no further action on your part. By default, the &VarName uses the * wildcard. To specify a different wildcard, insert the wildcard just after the & character. In the above example, when the MUD says
You get many coins
the @Gold variable would then contain the string "many". To restrict the trigger to just match numbers, change the trigger to:
#TRIGGER {You get &%dGold coins}
Now the "You get many coins" will not match the trigger. You can use any of the wildcard specifiers, and can also use the square brackets [] to define your own wildcard range.
Sometimes there is alphabetic text in the pattern after the string you want to capture. To delimit this from the variable name, place the variable name in {} brackets. For example, to capture
You have 1000gp
you would use a trigger:
#TRIGGER {You have &%d{Gold}gp}
which will only match digits and will properly set the @Gold variable to 1000.
The &VarName syntax also works with database variables and records. If you have a database variable @char and want to set the Gold property, you would use a trigger of:
#TRIGGER {You get &char.Gold coins}
To set the Gold field of record 7 in the database, you would do
#TRIGGER {You get &7.Gold coins}
To set the Gold field of the current database record, leave out the record number all together with the trigger
#TRIGGER {You get &.Gold coins}
This syntax along with the database provides a powerful way to capture information from the MUD.
NOTE: The patterns matched by the &VarName syntax still count towards the %1..%99 variables and can still be accessed in that manner. So, in the example:
#TRIGGER {Hp: &HpVar Mana: &ManaVar} {#SHOW %1 %2}
it will automatically set the @HpVar and @ManaVar variables, and the %1 and %2 parameters will also still be set just as if you had put parenthesis around the &VarName. This is important when you mix &VarName and () in the same trigger. Always count the &VarName as if it also has a parenthesis around it.