Documentation

#ALIAS

ALIAS

Syntax: #AL aliasname {commands} classname
Related: #VARIABLE

Assign the commands to the shortcut aliasname. You should not start aliasname with a number is should always be a letter, after that first letter you can use numbers, for instance t5 is a valid aliasname whereas 5t is not.

If ALIAS is used with no parameters, all aliases are listed to the output window. If ALIAS is given a single parameter, the definition of aliasname will be displayed. The Classname parameter specifies the name of the class to create the alias in. If omitted, the alias is created in the current class.

Aliases can also be expanded via tab completion. If the aliasname is entered into the command line by itself and <TAB> is pressed, the aliasname will be replaced with the string assigned to that alias.

Text following the aliasname in the command line is stored in parameters. These parameters %1 through %99 can be used in the string definition of the alias. Special parameters %-1 through %-99 are also defined which represent the parameter plus all text following it. Thus, %-1 contains all text following the alias. %-2 contains everything past the first parameter, and so on. Thus, in the example alias foo bar, alias is the aliasname, foo is assign to %1, bar is assigned to %2, foo bar is assigned to %-1, and bar is assigned to %-2.

You can also use the %param(n) function instead of %n and the %params(n) function instead of %-n. You can also use "named parameters" as discussed below.

Simple alias

#AL fs {fill waterskin statue}
When fs is entered, the string fill waterskin statue is sent to the server.

Using variables

#AL fs {fill @container statue}
When fs is entered, the value of @container is expanded, and the result is send to the server. If @container has the value of jug, then the string fill jug statue is sent to the server.

Using parameters

#AL kk {kill %1;kick %1}
Used with a parameter. If kk rabbit is entered, the commands kill rabbit and kick rabbit are sent to the server.

Named Parameters

To avoid trying to determine which parameter number to use you can use Named Parameters instead. Just specify the list of parameter names immediately after the name of the alias within parenthesis. Each parameter name MUST begin with a $ character (because it's actually creating a Local Variable for the given parameter). Seperate multiple parameter names with commas.

So, the above example could be re-written as:

#ALIAS kk($target) {kill $target;kick $target}

While this is a bit more typing, it's more obvious what it is doing. For multiple parameters, just list them with commas between them. Be sure that you do not put ANY space between the name of the alias and the ( parenthesis that starts the named parameter list.

Nested Parameters

#AL make($spell) {#ALIAS $spell($target) {cast $spell $target}}

This is a complicated alias which creates another alias. In this case, the 'make' alias takes a parameter which is the name of a spell to cast. When you use the 'make' alias, another alias is created with a name equal to the spell name. Thus, when you enter

make heal

the command

#ALIAS heal($target) {cast heal $target}

is entered, which creates the new spell alias called 'heal'

Classname

To define a variable inside a class, just include the name of the class after the command parameter:

#alias zt {tell zugg %-1} "tells"

creates an alias inside the class named tells. The class is created if it doesn't exist.

alias dt {tell darker %-1} "tells|darker"

creates an alias in the darker class, which is itself inside the tells class.

Add comment

Login or register to post comments