View Single Post
Lt. Commander
Join Date: Dec 2007
Posts: 120
# 334 Examples of Alias in Action
01-25-2012, 09:07 PM
1. Abbreviate longer commands
The Aliases in your CommandAliases.txt file can be referenced in your keybinds. I use these aliases to simplify the syntax on my keybind files.
Quote:
alias Tray "+TrayExecByTray {}"
alias Heal "+TrayExecByTray 2 {}"
alias fol "+followuntilincombatorinrange"
alias teamself "team {} $$ playersay {}"
2. Toggle keybind commands for a single key
This next example defines a Ctrl-F12 keybind to toggle the HUD between locked and unlocked states. An unlocked HUD allows you to rearrange the items on your HUD. Be sure to lock it when you are done moving things around. Now, I could have used 2 keybinds to accomplish the same thing. For example, Ctrl-F11 for HUD Unlock and Ctrl-F12 for HUD Lock. But I think using the Alias and the single keybind is more elegant.
Quote:
// CommandAliases.txt
alias g1 <& GenJailUnlock 1 $$ playersay HUD unlocked $$ alias g1 "g2" &>
alias g2 <& GenJailUnlock 0 $$ playersay HUD locked $$ alias g1 "g3" &>
alias g3 <& GenJailUnlock 1 $$ playersay HUD unlocked $$ alias g1 "g2" &>
Quote:
// Space.txt keybind file
Ctrl+F12 "g1"
3. Cycle gameplay comments
This is a fun one for use in PVP. Although I cannot find his post, I believe that TranceaddicT used a series of rotating bindfiles to accomplish the same thing.
Quote:
// CommandAliases.txt
alias teamself "team {} $$ playersay {}"
alias t0 <& teamself Acquiring target: $target $$ alias t0 "t1" &>
alias t1 <& teamself Targetting: $target $$ alias t0 "t2" &>
alias t2 <& teamself Help me destroy: $target $$ alias t0 "t3" &>
alias t3 <& teamself Focus attack on: $target $$ alias t0 "t4" &>
alias t4 <& teamself Fire all weapons at: $target $$ alias t0 "t1" &>
Quote:
// Space.txt keybind file
t "t0"
4. Crash your game
This was my first attempt at a cycling Alias command. It WILL crash your game. I don't recommend that you use it. Rather, it is an example of what to avoid when you start dabbling in Alias commands.
Quote:
alias x1 <&team 1 $$ alias x1 "x2"&>
alias x2 <&team 2 $$ alias x1 "x3"&>
alias x3 <&team 3 $$ alias x1 "x1"&>