Aliases
Aliases are a way for you to define custom commands or shortcuts to be used in game.
An alias can be a simple command substitution, or execute a script using the client's script api.
Each alias has the follow components:
Components of an Alias
Name
The alias name is simply a descriptive name for each alias
Pattern
The pattern specifies what the alias will match when you enter commands in the client's command bar. A pattern can be a simple text match or a Regular Expression.
Text Patterns
The pattern /k
will match inputs that start with the characters /k
.
For example, the following input will match this pattern:
/k troll
However, this input will NOT match:
say /k troll
RegEx Patterns
When the alias' RegEx
box is checked, the pattern will be executed as a regular expression. RegEx patterns are particularly useful for scripts, where regex match groups can be accessed individually.
For example: greet (.*)
would match the input
greet Zedd
Where Zedd
will be passed to the alias' script as match group 1.
Enabled
Indicates whether the alias is enabled or not. When unchecked, the alias will not be matched against any command bar inputs.
Script
Flag that indicates whether the result of the script is a simple text substitution or a script.
Examples
Simple Alias (Non-Script)
- Pattern:
greet
- RegEx: unchecked
- Script: unchecked
- Value:
say hi there $1
Example
> greet Zedd <-- This is your command input
> say hi there Zedd <-- The alias automatically issues this command
You say: hi there Zedd
Scripted Alias with RegEx
- Pattern:
gift (\w*) (\d*)
- RegEx:
checked
- Script:
checked
- Value:
const matches = $1;
const playerToGreet = matches[1];
const coinsToGive = matches[2];
send(`say hi there ${playerToGreet}, have some coins.`);
send(`give ${coinsToGive} to ${playerToGreet}`);
Example
> gift zedd 10 <-- Your command input
> say hi there zedd, have some coins. <-- Issued by your alias
You say: hi there zedd, have some coins.
> give 10 coins to zedd <-- Issued by your alias
You give 10 coins to Zedd.