Skip to main content

alias

Discworld player help

alias

Name


alias - The discworld alias system. Kudos to Maelin for his assistance.

Syntax


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>

Description

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.

Tutorial:

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]

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:

alias getquill open pack;get quill from pack;close pack

Then, when I wanted my quill, I would just type:

getquill

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.

$1$
$3$

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.

$*3$
$2*$

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:

con wyvesque

to consider Wyvesque, or we can just type:

con

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:

$ifarg3:t $1$ 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".".

Where Did My $ Go?

There are a few cases where you might need to include something in an alias that has $ characters in it. An example of this is if you are trying to alias an emote command that uses $me$ as a placeholder for your name. In these cases you must precede each $ character with a \ (backslash) character, otherwise the result will likely not be what you expect. For example:

> alias wo emote Wibbling oddly, $me$ spins like a frog.
Added alias "wo".
> wo
You emote: Presto Wibbling oddly, me spins like a frog.
> alias wo emote Wibbling oddly, \$me\$ spins like a frog.
Changed alias "wo" from "emote Wibbling oddly, me spins like a frog. $*$".
> wo
You emote: Wibbling oddly, Presto spins like a frog. (Presto)

Special Aliases

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.

Examples

Here are some helpful alias examples that you can try out for yourself. This first one is good for setting up club channels.

alias clubsetup $ifarg: alias $2$ $1$;alias $2$t $1$ talk;alias $2$e $1$ emote;alias $2$h $1$ history;alias $2$a $1$ announcement;alias $2$i $1$ info;alias $2$? syntax $1$;alias $2$m $1$ members listening;alias $2$on $1$ mute;alias $2$off $1$ mute on;frimble Club set up.$else$frimble USAGE clubsetup club_channel cc $endif$

This alias is designed to make other aliases. To use it, you just type:

clubsetup <clubname> <clubshortname>

Say you want to set up a bunch of aliases to use the various commands of a club channel, aptly named "club_channel". You don't want to have to type that before all your commands in the club, eg. talking on the club channel, emoting on the club channel, checking the history of the club channel. You use the clubsetup alias like this:

clubsetup club_channel cc

And wait for it to finish. You now have a series of aliases, which are as follows:

ccThis is the base replacement for "club_channel" in all the commands you use.
cctThis command precedes any messages you wish to say on the club channel.
cceThis command precedes any emotes you wish to make on the club channel.
cchThis command shows you what has been said on the club channel recently.
ccaThis command shows you the most recent announcement the club has had.
cciThis command gives you information about the club such as its description, members, hierarchy, etc.
cc?This lists the commands you can use with your club badge. Remember to replace "club_channel" with "cc"
ccmThis command lists all the members of your club currently listening with their badges.
cconThis command turns the club channel on.
ccoffThis command turns the club channel off.

If you look back at your aliases later and have forgotten what they do, you can just type "clubsetup" on itself to recall how it is used.

See also

nickname, ealias, qalias, unalias, finger