Alias tutorial from Discworld. Kudos to Maelin@Discworld for his assistance.
alias alias set category <alias> default alias rename <alias> to <alias> alias set category <alias> <category> alias <alias> in "<category>" <string> alias [show] category <category> alias <alias> <string> alias sorted alias <alias> alias every <alias>
The alias command has ten different formats.
The first format, alias on a line by itself, will show all your currently defined aliases in a nice formatted output.
The second format, alias set category <name> default will set the category of the named alias back to the default category.
The third format, alias rename <name> to <name> will rename an alias from the former of the two names used, to the latter.
The fourth format, alias set category <name> <category> will place the named alias into the arbitary category. If the category doesn't exist it will be created.
The fifth format, alias <name> in "<category>" <string> will create a new alias containing the commands in <string> in the category named. The category must be surrounded by quote marks. If the category doesn't exist it will be created.
The sixth format, alias [show] category <category> will show all your currently defined aliases that are included in the named category.
The seventh format, alias <name> <string> will set name to the definition you have passed to it.
The eighth format, alias sorted, will print an alphabetically sorted list of the current aliases you have.
The ninth format, alias <name> will list just the alias named.
The "every" flag to the command makes it print all the aliases of the specified name even if there is an alias of the specific name already in existence.
First, the command. The alias command is used to store a series of commands to the MUD which are run when you send a single alias command.
Typing "alias" on its own will show you the list of alias commands you have set.
alias <name> <command 1>;<command 2>;<command 3> [etc] <pre> All items inside < > symbols are replaced with things you decide. Do not type the < > symbols. You can use an alias for just one command if you like, the ; symbols are just to show the MUD where one command ends and the next begins. For example, if I wanted to make an alias to open my backpack, take out my quill pen, and close my backpack again, I would type the following: <pre> alias getquill open pack;get quill from pack;close pack
Then, when I wanted my quill, I would just type:
and the MUD would get it from my pack for me. This is all well and good, but say we wanted to make some more complicated aliases. There are several special functions that make aliases very powerful. The first ones are for specifying arguments.
This function is used to mean "all arguments following an alias command".
For example, if I wanted an alias to take things from my pack, I would type:
alias gfp open pack;get $*$ from pack;close pack
I am using gfp for "get from pack", which is easier for me to type than "getfrompack". Whenever I wanted to take something out of my pack, such as my bottle of scumble, I would just type:
gfp green bottle
and the MUD will interpret this as: "open pack, get green bottle from pack, close pack". Now the next function is for extracting certain arguments from an alias command and using them.
These will be replaced in the command chain with whatever are your first, or third arguments, respectively. This is very useful. Say I wanted a command to perform a series of five soul commands on Wyvesque, because she makes an excellent target for souling. Every soul command is a single-word command, so I can type this in to make the alias:
alias soulwyv $1$ wyvesque;$2$ wyvesque;$3$ wyvesque;$4$ wyvesque;$5$ wyvesque
When I wanted to love her, then kiss her, then adore her, then huggle her, and finally fluff her, I would type this:
soulwyv love kiss adore huggle fluff
and it would perform each of those commands on Wyvesque. This next function expands on the previous one, making it more versatile.
When placed before a number, the "*" symbol means "all arguments up to and including", so the first example will mean "all arguments before argument 3 and argument 3 as well". When it is placed after a number, the "*" means "all arguments including and following", so the second example means, "argument 2 and all arguments after argument 2". These are quite possibly the most useful functions of the alias command. For example, say we wanted an alias to get an item from a closed container. Since a container name is usually only one word ("pack", "satchel", "pouch") but an object name might be several words ("dart 3", "worm sword", "blue bottle") we make the container the first argument and the object everthing else:
alias gf open $1$;get $2*$ from $1$;close $1$
Then, when we want to get, say, our thieves' dagger from our satchel, we type
gf satchel thieves' daggers
and it will open the satchel, get the thieves' daggers from it, and close the satchel again. The next function introduces default arguments to an alias.
$arg:someone$ $arg1:wyvesque$ $arg3:all$
This function will be replaced with whatever is specified on the left hand side of the : symbol, or, if what is specified there is not present in the alias command, with what is on the right hand side. In the first example, the function will be replaced with all the arguments if the alias command, or if there are no arguments in the alias command, it will use "someone" by default. In the second example, the function will be replaced with the first argument of the alias command, or if there are no arguments in the alias command, it will use "wyvesque" by default. The third example will use argument 3 if there is a third argument, and if not, it will use "all" instead. This can be very useful.
Say we want a command to make the "consider" command easier for us. Usually we would want to consider everyone in a room, but sometimes we might just want to consider one person. To make this alias, we would type:
alias con consider $arg:all$
and then, we can type:
to consider Wyvesque, or we can just type:
to consider everyone in the room. The final function is a more powerful version of this one. Instead of using the argument (or, if no argument is present, the default), this function will use one of two present defaults depending on whether the argument is there or not.
$ifarg:wyvesque$endif$ $ifarg:wyvesque$else$pinkfish$endif$ $ifarg2:wyvesque$else$pinkfish$endif$
These three are rather complex. The first function will do the following: if any arguments are given to the alias command, it will be replaced with "wyvesque", but if no arguments are given, it will not be replaced with anything.
The second also checks if there is an argument, but unlike the first example, if there are no arguments it will be replaced with "pinkfish".
The third example is the same as the second but it concentrates on argument 2 instead of the entire argument chain. Meaning that if there is a second argument to your alias, replace it with "wyvesque", else if there is only one argument, replace it with "pinkfish".
Note that you can put other functions inside such $ifarg$ aliases. For example:
There are three arguments in this alias. Those arguments are "$1$", "$2$", and "$3$".$else$ifarg2:t $1$ There are two arguments in this alias! The first is "$1$" and the second is "$2$".$else$ifarg1:t $1$ Only one argument in this alias. It is "$1$".$endif$
So what this alias will do will the following; if the alias name is "tpab" (short for "tell person about alias"), you can type something like "tpab skye moo bing". Because you have provided three arguments to your alias, the MUD would interpret it as: "t skye There are three arguments in this alias. Those arguments are "skye", "moo", and "bing".".
There is a special alias that is called upon logging in, called "login". If you alias this to something it will be run as soon as you login. For example, "alias login say Hello!" will cause you to say "Hello!" as soon as you log in.
There is also an alias that will be run after your inventory has been generated called "afterinventory". This is similar to "login", except that the command will not be called until your inventory has regenerated.
The plan and project information for finger is done inside the alias command also. These are the aliases .plan and .project, and can be up to five lines long. Refers use the alias .reference and can be up to 20 lines long. If you want a signature appended to your mails and posts to boards, create an alias of .signature.