Alias

From Discworld MUD Wiki
Revision as of 23:16, 5 September 2012 by Frazyl (Talk | contribs) (Merge Aliases here)

Jump to: navigation, search

An alias is a set of commands that you give a single name so that you can execute them all in a row.

Aliases allow you to write and store one or more commands under a name specified by you, allowing you to then execute those commands by typing the name. This saves you a lot of time typing out complete commands, and as aliases can contain things such as parameter parsing and basic conditional clauses, you can make them as complex as needed.

Getting started

Typing 'alias' without any arguments will show you a list of your current aliases. Typing 'alias <alias name>' will show you the command or commands currently aliased to that alias name.

Creating an alias

For basic alias creation, simply type 'alias <name> <command>'. Before creating an alias, a useful check to perform is simply to type the name that you have in mind for your new alias. Although aliases can generally be easily removed (see below), this simple check can make sure that you don't accidentially alias commands to a cardinal direction, etc.

Single command example

> alias lw look Weston
Added alias "lw"
> alias lw
lw: look Weston $*$

If you want to include multiple commands within a single alias, seperate the commands using a semi-colon, i.e. 'alias <name> <command1>;<command2>'

Multiple command example

> alias lw look Weston;nudge Weston
Changed alias "lw" from "look Weston $*$".
> alias lw
lw: look Weston;nudge Weston $*$

Note that some MUD clients process the ; character as a new line symbol. You will need to disable the parser or change the settings to create aliases using this symbol.

Using an alias

You can execute a complicated command using a less complicated input with aliases, as tasks of any given complexity can be simplified into simple aliases. Using the example above:

> lw
Weston looks like a relatively recent recruit to both life as a Hunter and life as a smith. He's rather pale aside from his ink-stained fingers, and lacks the muscular physique usually associated with his new trade.  However he does look quite content with his situation, a slightly bewildered smile on his face more or less constantly.
He is in good shape.
He is standing.
Holding : a smith's hammer (left hand).
Wearing : a pair of hard leather boots, a pair of lightweight beige linen trousers, a starched white shirt and a brown leather belt.
You nudge Weston.

Removing an alias

To remove an alias, use the command 'unalias <name>'. Continuing the example above:

> unalias lw
Successfully unaliased "lw":
look Weston;nudge Weston $*$
> lw
What?
>

Alias Tricks & Tips

Cycling through aliases

The following technique can be used to cycle an alias through different groups of commands, for example when idlechasing.

The main alias:

alias idling idlestuff1

The command aliases:

alias idlestuff1 pray;alias idling idlestuff2

alias idlestuff2 perform major shield on me;perform major shield on me;perform major shield on me;perform major shield on me;perform major shield on me;put shield in pack;alias idling idlestuff3

alias idlestuff3 palm purple baton from pack;hold purple baton;slip purple baton to pack;perform major shield on me;pray;alias idling idlestuff1

Each time the 'idling' alias is used, it will call an 'idlestuff' alias. When that 'idlestuff' alias finishes, it will update the 'idling' alias to point to the next 'idlestuff' alias next time 'idling' is called.

Using commands with the same name as your alias

If a rarely-used command has the same name as your alias, and you don't want to rename your alias permanently to avoid the conflict, you can use something like this:

alias noalias alias rename $1$ to _$1$; $*$;alias rename _$1$ to $1$

So, for example, if you have an alias named "find" for performing Find, and you go to the Capture the Flag arena and want to find someone's records, you'd use it like this:

>syntax find
You have an alias called 'find'.
Forms of syntax available for the command 'find':
find <player>  
>noalias find womble
Renamed the alias "find" to "_find".
Womble is not recorded as ever fighting in the arena.
Renamed the alias "_find" to "find".

Quickly making temporary aliases

Occasionally you may want to perform several commands right after each other without making a permanent alias for it. In that case, something like this is helpful:

alias parse alias _parsed $*$;_parsed

It creates a temporary alias of everything you put after "parse", then executes that alias.

You use it like this:

>parse get damaged ring from pack;fix it;put it in pack

This is helpful for queuing up commands, as well as for repeating a set of commands a few times.


Making aliases more general

If you don't have the same items with you all the time, you can refer to items by a more general name instead of their specific name. You can "play instrument", "play held instrument" (if you might be carrying more than one), "judge weapon", "vurdere armour", "stab opponent with held weapon", "peek living thing" [1] (to be more specific you could "peek human"), "slip thing to here", and so on. To account for items that may be on the floor in the room, you can add "my" ("play my instrument") to make sure you're only trying to do commands with items in your inventory.

For commands you want to do on multiple objects (such as "vurdere"), there are a few solutions (using "vurdere" as an example):

  1. "vurdere armour & armour 2 & armour 3" is the best way to handle this. As long as it can find at least one piece of armour to execute the command on, it will work, and you know the maximum amount of gp you'll be spending on it ahead of time.
  2. "vurdere armour, armour 2, armour 3" is also a good way to make sure you vurdere exactly three pieces of armour... as long as it can find at least three. Otherwise, the command fails. Only use this if you always have a predictable number of the items you want to target.
  3. "vurdere every armour" and "vurdere armours" both target every piece of armour you have out. ("Every" can be more convenient for items with awkward plurals. If you want to use "every" with "my", you would "vurdere every my armour" (useless in this case, since the vurdere command will only look for items in your inventory).) These are theoretically useful if you don't always have the same number of pieces of armour out, but the risk is that you may sometimes have too many for the amount of gp you have left--or just so many that you use more gp than you wanted to at that point in your alias, and end up being too tired to do one of your other commands. This method is to be avoided if your alias is finely tuned.
  4. "vurdere random armour" is a nice twist that brings some automatic variety in your alias, though with random object/persons/weapons/... ;the rewarded xp can get more randomized too. "draw random weapon;appraise it;judge it;sheathe it;" ;)

To avoid using a command on one particular thing, you can use "except". For example, if you want to perform a ritual on any living thing in the room except yourself, you could "perform <ritual> on living thing except me". Note, though, that the command will fail if it can't find the thing specified with "except": if you don't have a harp and you try to "play instrument except harp", you won't end up doing anything.

You can find another explanation of the various ways you can refer to things at help parser.

Alias Resources

The following pages contain aliases which may be useful.

  • General (aliases for day to day things such as commerce and communication)
  • Combat (aliases to perform combat-related actions)
  • Craft (aliases helpful when performing craft actions)
  • Travel (aliases generally consisting of directional commands to get you from A to B)
  • Guild-Related (aliases for guild commands and other guild-specific activities)

External Links