Aliases let you respond to something you have typed.
Then you might type:
You can have up to 999 wildcards (which become %1 to %9) with %0 representing "the whole matching text". See below for how to access the higher numbered wildcards.
Another example, which uses two wildcards, might be used if you had to prepare a spell before using it.
Then you might type:
Aliases can execute script commands by simply putting the command into the "send" box and selecting "send to script".
However for more complex scripts you can put scripts into your script file (see scripting configuration tab for the world) and then call the script from the alias. To do this put the name of the script subroutine into the alias's script box.
The script subroutine must* have three arguments, as follows:
Name of the alias
The matching line
An array of the first 10 wildcards
* If you are using Lua, then the arguments are optional, as usual.
An example script in the VBscript language would be:
Wildcard 10 is the entire matching sequence, which is not necessarily the same as the matching line in the case of regular expressions.
Other wildcards can be accessed by using the GetAliasWildcard script routine (for example, named wildcards, or wildcards over number 9).
A powerful feature in matching triggers or aliases is the ability to specify "wildcards" which are variable information that might change from time to time.
In this case the asterisk represents the name of the unknown target you wish to kill.
Using the wildcard in the "send" box ...
To use this unknown quantity you can refer to it as %1 (for the first wildcard) in the "send" box, like this:
The second wildcard is %2, and so on. Wildcard %0 is a special case which represents the entire matching text.
For wildcards above 9 you can use this syntax:
The number in the angled brackets can be from 0 to 999.
Also, if you use regular expressions, you can name wildcards, like this:
This names the wildcard as "target". You can then use this name in a similar way:
See Also ...
(AddAlias) Adds an alias
(Help topic: general=aliases)
Enter a search string to find matching documentation.
Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.
Gammon Software support
Forum RSS feed ( https://gammon.com.au/rss/forum.xml )