Macro Guide

I wrote the original guide approximately three years ago. If you have an account on our old site you can view it there, but I'll transcribe the information here anyways. While Blizzard has released dozens of patches over the years, Macros are relatively unchanging. I still use most of the same that I wrote three or four years ago, and they still work. Occasionally Blizzard will update the lua scripting language that are used for macros and addons, causing some to break, or they'll update spells or items so that macros can't call them because that spell doesn't function the same way anymore, but these are rare and relatively isolated changes. I've done a few minor edits to remove some information that's no longer true or useful, but I may have missed something.
Macros: What They Are
A macro is a short script you write. It's very close to writing a program, but simplified. In essence, a macro is a set of commands that have been tied together to one button.
What They Can Do
A macro is not able to break the game or allow you to do things you cannot already do. Every command used in a macro is able to be typed in a normal chat line and have the same effect - they allow you to save these commands though, so you don't have to type them out. Multiple things can be grouped together too, provided they don't clash with each other.
To write a macro, you need to first know the language - or syntax - of the programming code. Macros have a defined start, middle, and end point for how they have to be written. We'll examine a sample one here;
#showtooltip
/cast [mod:shift] Demoralizing Shout; Battle Shout
/y WAAAAAAGH!!!
This is one I made last night. The "#showtooltip" part at the top allows it to dynamically display the ability as if it were normaly dragged from your spellbook. Most macros for abilities can use this, but it's completely up to you. To get it to change the icon picture, you must select the red ? icon when creating the macro. You can also specify the spell to show the tooltip for by including it just after, meaning that it won't change anymore.
The /cast portion is your action. You can substitute it for /use or any other / commands you have available to the game - a lot more than you're probably aware of. [mod:shift] is what we call a modifier. In some scripting languages, including this one, the semicolon ( ; ) symbol means "else if", which in turn means, "or do this instead". So when you hold Shift as you click the macro button on a hotbar, it'll cast Demoralizing Shout. Otherwise, if you don't hold Shift, it'll cast Battle Shout. The button will take on the appearance of whichever it's meant to cast, since we included the #showtooltip. The last line does exactly as you'd think; it yells WAAAAAGH!!! whenever the button is clicked in either position.
There are many modifiers you can use. Combat, stealth, having a weapon type or shield equipped, if your target is friendly or hostile, etc. The only ones you need "mod:____" for are Shift, Control, and Alt. You are also able to specify on a macro "button:1" or "button:2". This means your mouse buttons - leftclicking is button 1, right-clicking is 2, and your mousewheel click counts as 3. All modifiers must be enclosed by the square brackets. That's how the game knows they're modifiers. One useful one, the [nocombat] modifier, literally means no combat; the action won't be taken during combat. Once you get into a fight though, the macro changes to use the 'else' portion.
You can create a macro for casting multiple spells at once, but remember - all functions in the game absolutely must come from input via keyboard or mouse. So you have to click the macro; there are no timers available, so you can't script out an entire fight. If you get a program that lets you do this, you risk getting banned. Macros are here to make your life easier, not effortless.
Spells, abilities, and items all trigger Global Cooldown. It's what keeps you from casting spells and such in groups. For spells it's 1.5 seconds, I believe for physical (rogue,warrior) abilities, it's 1 second. Some things are off this cooldown, some share their own. A warrior's Enrage neither triggers nor is affected by this GCD - you can use it whenever it's available off it's own cooldown. Some talents are like this as well, most notably is the shaman combo that lets them cast Nature's Swiftness, Elemental Mastery, and Chain Lightning all at once. The first two abilities do not trigger GCD, only the Lightning does, so you can cast all of them.
The way a macro works though, means that order is essential. Once triggered, it runs through every command from top to bottom at once; happening in a fraction of a fraction of a second. The sample will help explain this.
#showtooltip
/cast Elemental Mastery
/cast Nature's Swiftness
/cast Chain Lightning
/cackle
If we swapped the Chain Lightning line for the Elemental Mastery line, you would not be able to cast the next two spells since Chain Lightning triggers GCD. It must be at the end. Emotes and scripted text never trigger cooldowns of any sort, so may be placed anywheres you wish. Up until patch 2.3, WoW's internet code had been inefficient and had problems casting multiple spells due to slight lag, so you had to incorporate /stopcasting between each line to make some macros work. They fixed that, and it no longer is useful or needed.
Spells can have multiple modifiers in them. For example, Tranquil's Poison button or Kasana's main Attack script. The poison one is as follows:
#showtooltip
/use [mod:shift] Crippling Poison II; [mod:alt] Wound Poison V; [mod:ctrl] Deadly Poison VII; Instant Poison VII
/use [button:1] 16
/use [button:2] 17
Your inventory is broken up into numbered pieces. Your main-hand weapon counts as slot 16. Offhand item is 17. This will apply Crippling Poison if I hold Shift as I left click it, to my main weapon. Holding shift and right-clicking will use it on my offhand. If I use no modifier, it'll use Instant Poison. This will indeed work with sharpening/weight stones as well.
You can specify to equip items as well; /equip Gladiator's Left Ripper would put it in my offhand, since that's the only slot it fits into. But what if you have a weapon that's One-Handed and want it to go there? I ran into this problem with Khammie, trying to write a macro to swap between Axe+Shield, to Dual-Wielding axes. Because a shield can only be used in the offhand, it takes priority over a simple One-Handed weapon and therefore /equip would not replace it. What the macro instead did was equipped the first axe into my main hand, and then equipped the second axe into my main hand instead. This was not what I wanted. The solution is simple - /equipslot 17. The syntax here would be, "/equipslot 17 Gladiator's Left Ripper". That way it forces that weapon into the offhand.
Targets are another major point to consider. Righteous Defense cannot be cast on the enemy you're targetting. Only on a friendly player. So what happens when you're tanking something big and evil with nasty, pointy teeth, and it decides it likes your healer? Do you have time to target them, cast it, and then switch back? Not always. I worked it out for Kasana to be able to cast the spell directly on the enemy. It is possible to cast a spell on your target's target. The only practical way to do this is to Macro it up though. Here's the sample:
#showtooltip Righteous Defense
/cast [help,nodead][target=targettarget,help,nodead]Righteous Defense
Now, note how I put Righteous Defense after the #showtooltip. You can do this - but keep in mind that it forces the macro to then always show that spell. If you don't specify it, then it changes dynamically like previously shown. This macro shows how modifiers can be used to extreme effectiveness when coupled with the way the macro gets executed; top to bottom, left to right at every line. The first modifier will cast the spell if your target is friendly and not dead. Otherwise it goes onto the second macro; if the target of your target is friendly and not dead, it casts the spell. The way the macro targetting here works, is that it only uses it for this one spell. You never drop your target, meaning you never stop attacking or whatever you're doing to it.
One thing you'll eventually come across is the Mouseover modifier. This allows you to cast spells when you don't actually have anything targetted; it casts it instead on whatever is under your mouse cursor. The requires by definition that you put the macro to a key, since you can't click it... since you're using the mouse to target. An example would be this:
#showtooltip
/cast [target=mouseover,exists] Blind;
/use [mod:shift] Heavy Netherweave Bandage
This works for the rogue Blind ability. You usually only use Blind to do one of three things - take care of an add so you can finish your target off, disable an enemy in PvP so you can kill someone with them, or to blind your target so you can bandage. The first two would require you generally to swap targets, which risks you accidentally scoring a combo point on them - and as we all know, a CP on a target wipes all of the CP off all other targets. So instead, you hover over the add/player, press this button, and presto; Blind while you continue to beat on something. You can also hold shift and not hover over anything to Blind your current target and immediately begin bandaging. Note that GCD + Item CD don't always intermix. The "exists" modifier is the means by which it won't throw an error fit when you try and Blind someone without having anything under your mouse.
While you cannot use timers to cast a number of spells with a single keystroke, you can use a timer function to manipulate the macro itself. An example follows:
#showtooltip
/castsequence reset=30 Mana Tap, Arcane Torrent
This works out so that the first time you trigger it, Mana Tap goes off. If you trigger it again within 30 seconds - the cooldown of Tap, you'll cast Arcane Torrent instead. Castsequence allows you to fit things like a hunter's Shot Rotation or a warrior's Slam Rotation all into a single button. Instead of having a bar full of abilities, if you know how a fight will go down, you can macro it all to that button and just click it over and over. After each ability, the Castsequence will move it to the next one after the comma. Note that commas always separate things in macroing, and most coding. For this you could alter it to, for example, Reset=6 and switch it around to coincide with Arcane Shot and whatever other shots hunters use.
I hope this helped. If you have any more questions simply ask me. WoWWiki has some very nice pages on general macros, and ones made for each class. These are all written by other players who know what they're doing, so they're probably useful somehow. Click your class icon at the right-hand side at the top of the page to go to ones specific for your class, and then either read through 'em all, or pick from the menu what sounds useful. Note that some of these are out of date. Blizzard changes scripting and allowed things every expansion to update functionality and prevent exploits. This is part of why addons break - they're only able to do what a macro can, they're just using a graphical interface instead of text.














Thx
Tranq. :)
Least your not like a certain Alliance warrior who tries to get $$ out of this.
Just a note.
If you macro a yell, a say, or an emote to any of your abilities and you use it where I can see you, I will set my emergency chat macro to whisper you the entire lyrics to Herman's Hermits' "I'm Henry VIII I Am" every time I press Mangle.
haha
Can I do i just once so I can take a screenshot of it I promise to unmacro it after that.
Soulstoning Firk!
Soulstoning Firk!
Yay!!
Firk thanks you :)
There are a few situations where having a /s attached to an ability makes good sense. Rezzing is one, Lightwell is another. However I can guarantee you if anyone uses the "so and so cries out for healing" they'll be increasing their rep with the Floor.
Aye.
If you ever utter the yell, "I am summoning a steed from nightmare!" anywhere near me they will never find your body. :)
Soooo...
...you're saying I should take my "Whatcha gonna do when the Interrupt King runs wild on you, brother?!?" yell off my Pummel macro? ;)
Couple things to add
As has been mentioned above, the use of /say, /yell, /partry, or /raid should be used very sparingly in macros as they are a sure way to piss off your group and not be invited back. If you use ability every pull, don't macro a /say to it.
A couple of things that are worth macroing are using cooldowns (ex. "Used Last Stand") to keep your healer informed, soulstone targets ("Soulstoning Firk!") and Crowd control Targets ("<<Sheeping Goblin Obliterator>>")
In the case of the later two, you'll want to use the '%t' fuction. When you type %t into a chat message it automatically fills in the name of your current target. For example:
#Showtooltip
/cast Polymorph
/s %t is a sheep, do not attack %t!
If used while targeting a mob named Billy it will cast polymorph and you will say "Billy is a sheep, do not attack Billy!"
There's an obscure use of #showtooltip I've used for my shaman. You can't put Reincarnate on your action bar, and I don't want to open my spellbook to check it's CD, so I made this:
#showtooltip [mod:alt] Reincarnation; Water Shield
/cast Water Shield
When placed on my action bar the button will normaly display the Water Shield tool tip, but if I hold down alt it will display the reincarnate tooltip allowing me to check its CD. However, it will always cast water shield even if alt is pressed.
Another use for Targettarget is for healers who have abilties that proc off damaging mobs. For example restro shamen have a talent that when they use a shock spell on an enemy in increases the effect and lowers the mana cost of their next heal spell. However, you don't want to be taking your attention off the group to target mobs, so I made this:
#showtooltip Earth Shock
/use [harm] [target=targettarget,harm] Earth Shock
If I target a mob, it casts Earth shock on the mob. If I'm targeting the tank, then it will cast earth shock on whatever the tank is targeting, allowing me to throw it into my rotation without having the change targets.
Two minor points: /castsequence works as Tranq mentioned in the guide, but the example is out of date as belfs no long have mana tap, and /Targettargettargettargettargettargettarget if a quick way to target Kevin Bacon.
Stopmacro
Forgot to mention, if you really need to be babling on with every spellcast then please use the /stopmacro command. The /stopmacro command (you guessed it) stops a macro mid sequence. This is obviously only useful with modifiers. For example:
#showtooltip
/use Shadowbolt
/stopmacro [group]
/s "Even the shadows strike at you."
Every time you cast shadowbolt you will spit out your chat message unless you are in any type of group (Party, raid, BG) in which case you will cats the spell and remain blissfully silent.