Keyboard Automation in World of Warcraft

INTRODUCTION

As most of the WoW players already know, Blizzard provides us tools to develop our own macros. We can use commands like /cast , /castsequence , /castrandom , etc to combine actions into a single command. With a basic knowledge of Lua, it is even possible to extend this functionality with the /script command.

However; Blizzard probably doesn’t want to encourage gamers to write intelligent scripts involving AI. For example, you can’t write a macro to make your character “Cast first spell, wait for 1,5 seconds, cast second spell, wait for 1,5 seconds, cast third spell” with one single keystroke. The only way to do this would be to write a /castsequence command and execute your macro three times. Right?
Well… Not really…
If you are using tools provided by Blizzard, that’s true. However, if you take the red pill and go beyond the reality provided by Blizzard, you can bend or break this limitation. I will show you two alternative ways to do this.
Please note that I am a Mac user. Therefore, the tools and approaches I am going to mention are Mac based. I am sure that Windows users may find similar solutions.
SOLUTION 1: KEYBOARD MAESTRO
There is a software called Keyboard Maestro which can be used for keyboard automation on MacOS. Using this program, you can easily record keyboard macros and run them later.
For example; you can record a keyboard macro like this:
  • Hit CMD + V
  • Wait for 1 second
  • Hit CMD + V
Let’s assume that you recorded this macro; and assigned it to the keyboard shortcut SHIFT + V. Now; as long as Keyboard Maestro is running, whenever you hit SHIFT + V, MacOS will act as if you have hit CMD + V, waited for 1 second, and hit CMD + V again. Copy some text to your clipboard, open your favorite text editor, and hit SHIFT + V. You will see that MacOS will paste your text, wait for 1 second, and re-paste your text again.
Neat, eh? If you google about it, you may find some other keyboard macro applications for the same task. I mentioned Keyboard Maestro only because I tried that one.
Now… How does this help us in World of Warcraft?
Let’s assume that you have set the following keybindings in WoW:
  • Spell 1: CTRL + A
  • Spell 2: CTRL + B
  • Spell 3: CTRL + C
Those keybindings are just examples; you can set any shortcut that makes sense to you. Keybindings can be set under Game Menu -> Key Bindings (doh!). I recommend using alternative actionbars for this purpose; which can be activated through Game Menu -> Interface -> Actionbars (doh!). That way, you save your default actionbar (1, 2, 3, …, 9) for your manual spell rotations.
Let’s also assume that in certain situations, you have to cast these three spells in a row. For example;
  • You are a shaman, and you want to throw three totems in a row with one single key; despite the global cooldown
  • You are a hunter, and you want to cast Wing Clip, Disengage, and Concussive Shot when you come face-to-face with a melee class with one single key; despite the global cooldown
  • You are a priest, and you want to cast PW:F, Divine Spirit and Shadow Protection with one single key; despite the global cooldown
Okay, those may not be the best examples; I’m sure that you can think of better ones. Just bear with me for now.
You simply can’t achieve those with Blizzard’s standard macro tools because of the global cooldown problem. But if you have Keyboard Maestro, you can =)
Here is what you need to do:
  • The shaman will do the following keybindings: CTRL + A = Totem 1 ; CTRL + B = Totem 2 ; CTRL + C = Totem 3
  • The hunter will do the following keybindings: CTRL + A = Wing Clip ; CTRL + B = Disengage ; CTRL + C = Concussive Shot
  • The priest will do the following keybindings: CTRL + A = PW:F; CTRL + B = Divine Spirit; CTRL + C = Shadow Protection
You got the idea… Now; within Keyboard Maestro, record a new keyboard macro which will take the following steps:
  • Hit CTRL + A
  • Pause for 1,5 seconds
  • Hit CTRL + B
  • Pause for 1,5 seconds
  • Hit CTRL + C
Do this; and assign the key SHIFT + 1 to this keyboard macro (or any other shortcut that makes sense to you) within Keyboard Maestro. Now; during your World of Warcraft adventures, whenever you hit Shift + 1, three spells that you assigned to CTRL + A, CTRL + B and CTRL + C will be cast in a row with a pause of 1,5 seconds inbetween. Meaning that;
  • When the shaman hits SHIFT + 1, his system will automatically hit CTRL + A (resulting in casting Totem 1), wait for 1,5 seconds (global cooldown), hit CTRL + B (resulting in casting Totem 2), wait for 1,5 seconds (global cooldown), and hit CTRL + C (resulting in casting Totem 3).
  • When the hunter hits SHIFT + 1, his system will automatically hit CTRL + A (resulting in casting Wing Clip), wait for 1,5 seconds (global cooldown), hit CTRL + B (resulting in casting Divine Spirit), wait for 1,5 seconds (global cooldown), and hit CTRL + C (resulting in casting Concussive Shot).
  • When the priest hits SHIFT + 1, his system will automatically hit CTRL + A (resulting in casting PW:S), wait for 1,5 seconds (global cooldown), hit CTRL + B (resulting in casting Disengage), wait for 1,5 seconds (global cooldown), and hit CTRL + C (resulting in casting Shadow Protection).
Neat, eh?
Here are some important points to consider:
  • If you are playing WoW in full screen, Keyboard Maestro won’t be allowed to interfere with the application; and your keyboard macro SHIFT + 1 won’t work. That’s because of a limitation of MacOS to prevent OS-wide shortcuts to interfere with the shortcuts of the full-screen application (I think). As a workaround to this problem, go to Game Menu -> Video, and make sure that the options Windowed Mode and Maximized are checked. This will still make WoW appear full screen, but it will make your MacOS to consider WoW as a windowed application. Therefore, Keyboard Maestro macros will be able to access your WoW shortcuts, and your keyboard macros (SHIFT + 1) will work. You may find that other OS shortcuts, such as CMD + TAB, will also work.
  • The examples above were given with the assumption that your global cooldown is 1,5 seconds. If your global cooldown is less due to talents, haste rating, etc, you can decrease it. If you have lag problems and the time between your spells need to be a bit longer than the “official” global cooldown, you can increase it.
SOLUTION 2: AppleScript
Solution 1 was for people with no programming experience. If you got the idea above, and you prefer coding over recording macros or hate extra third party applications, you can code the same macro (CTRL + A, Pause, CTRL + B, Pause, CTRL + C) in AppleScript as well.
Although I am a software developer, I am by no means an AppleScript expert. But, your AppleScript is supposed to look something like this:

tell application “World of Warcraft”

activate

end tell

tell application “System Events”

key code 0usingcontrol down

delay 1.5

key code 45 usingcontrol down

delay

key code 34 usingcontrol down

end tell

To enable AppleScript interact with World of Warcraft, you need to consider the points mentioned in Solution 1 (full screen mode and global cooldown). You also need to “Enable access for assistive devices” in your Mac’s System Preferences -> Universal Access menu.
A list of (most) key codes usable in AppleScript can be found here.
To start this macro with a shortcut, you need a third party application, such as Quicksilver. Here is a great step-by-step tutorial on assigning shortcuts to AppleScripts using Quicksilver.
SOLUTION 3: Additional Hardware
If you are looking for a simple, intuitive, plug-n-play automation with no rocket science involved; you might consider purchasing additional gaming hardware. I personally tried the gaming mouses of Razer and was very satisfied, but there are other brands as well. You basically get a mouse with additional buttons, which may be customized as single or consecutive keyboard shortcuts (macros). Simple, effective and no hassle!
Conclusion
I hope that this post gave you some initial inspiration for World of Warcraft keyboard automation. I’m sure that some of you can extend this idea and move it to further dimensions.
Stay away from’da Voodoo!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s