Difference between revisions of "Alias"

From Discworld MUD Wiki
Jump to: navigation, search
(new page)
 
(adding some more to this)
Line 1: Line 1:
= Alias Tricks & Tips =
+
{{Stub}}
 +
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 following technique can be used to cycle an alias through different groups of commands, for example when idlechasing.
  
 
The main alias:
 
The main alias:
  
alias idling idlestuff1
+
<pre>alias idling idlestuff1</pre>
  
 
The command aliases:
 
The command aliases:
  
alias idlestuff1 pray;alias idling idlestuff2
+
<pre>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 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
+
alias idlestuff3 palm purple baton from pack;hold purple baton;slip purple baton to pack;perform major shield on me;pray;alias idling idlestuff1</pre>
  
 
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.
 
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:
 +
 +
<pre>alias noalias alias rename $1$ to _$1$; $*$;alias rename _$1$ to $1$</pre>
 +
 +
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:
 +
<pre>>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".</pre>
 +
 +
===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:
 +
 +
<pre>alias parse alias _parsed $*$;_parsed</pre>
 +
 +
It creates a temporary alias of everything you put after "parse", then executes that alias.
 +
 +
You use it like this:
 +
<pre>>parse get damaged ring from pack;fix it;put it in pack</pre>
 +
 +
This is helpful for queuing up commands, as well as for repeating a set of commands a few times.
 +
 +
==External links==
 +
*{{Helpdirhelp|Alias}}
 +
*{{Helpdirhelp|Alias_tutorial}}
 +
 +
 +
[[Category:Concepts]]
 +
[[Category:Commands]]
 +
[[Category:Innate commands]]

Revision as of 14:52, 15 June 2010

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.

External links