ALIAS

Syntax: #AL [aliasname] [string] [classname]
Related: #VARIABLE

Assign the command string to the shortcut aliasname. Variables in string are expanded when the ALIAS command is executed. To delay expansion of variables, use two variable characters.

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.

Aliases can also be expanded via tab completion. If the aliasname is entered into the command line 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. Any text following the aliasname that is not used as a parameter is appended to the results of the alias expansion.

Simple alias

#AL fs {fill waterskin statue}

When fs is entered, the string fill waterskin statue is sent to the MUD.

Using delayed expansion

#AL fs {fill @container statue}

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

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 MUD.

Delayed expansion

#AL make {#ALIAS %1 {cast %1 %%1}}

This is a complicated alias which creates other aliases. 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. Since each % is removed each time a command is parsed, the %%1 is delayed by one step. Thus, when you enter

make heal
the command
#ALIAS heal {cast heal %1}
is entered, which creates the new spell alias called ‘heal’


Contents ALARM ALL