Difference between revisions of "Alias"

From Discworld MUD Wiki
Jump to: navigation, search
(adding some more to this)
Line 5: Line 5:
  
 
===Cycling through aliases===
 
===Cycling through aliases===
The following technique can be used to cycle an alias through different groups of commands, for example when idlechasing.
+
The following technique can be used to cycle an alias through different groups of commands, for example when [[idlechasing]].
  
 
The main alias:
 
The main alias:
Line 47: Line 47:
  
 
This is helpful for queuing up commands, as well as for repeating a set of commands a few times.
 
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):
 +
#"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.
 +
#"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.
 +
#"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.
 +
#"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 [http://discworld.atuin.net/lpc/playing/documentation.c?path=/concepts/parser help parser].
 +
  
 
==External links==
 
==External links==

Revision as of 12:56, 5 April 2011

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

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.


External links