Macros allow you to refine your playstyle and spell usage without installing an addon. Below are some common macro types that can be applied to nearly any class and spec. I've used Restoration Druid spells as examples, but you can substitute your own spells in.
Feedback and macro ideas are always appreciated. You can leave a comment at the bottom of this page or tweet @PrestonDvorak.
Below is a basic macro that casts a spell on your current target. This macro is pointless to use because it does the same thing as having the normal spell on your action bar, but I thought it would work well to explain some basic macro pieces that we’ll build on later.
/cast [@target,exists,nodead,help] Rejuvenation
#showtooltip causes the macro to take on the icon and tooltip of whatever spell is in the macro. That means there’s no need to manually select the icon if you don’t want to.
/cast tells the macro that you’re going to be using a spell. Another common one is /use if you’re going to be telling the macro to use a trinket or item.
[@target] tells the macro to cast the spell on your current target. You can technically omit this part for casting things on your current target, but we’ll be doing some more advanced things with it below so it’s nice to have. Other common options you’ll use are [@player] to cast on yourself, [@mouseover] to cast on the thing your mouse cursor is over, and [@focus] to cast on whatever you have set as your /focus target.
exists,nodead,help tells the macro to only cast the spell on your target if it exists, is not dead (nodead), and is a friendly player (help). This prevents you from trying to cast on an enemy by mistake and getting errors telling you that you can’t do that. Other common options include harm (to cast on enemies) and dead (to cast on something that’s dead).
Rejuvenation is just the name of whatever spell you want to cast. You can either type it out yourself or Shift+Click on a spell in your spellbook when editing a macro to automatically put the name in.
Now we’ll build on this basic macro concept!
Mouseover macros allow you to use a spell or ability on a player or enemy by having your mouse cursor over their physical character or their raid frame. No clicking to target required! Some players, healers in particular, go as far as having all of their spells used through mouseover macros, but this is mostly a playstyle choice. I personally use a mouseover macro for my my dispel abilities, such as Nature's Cure.
/cast [@mouseover,exists,nodead,help][@target,exists,nodead,help][@player] Nature's Cure
[@mouseover,exists,nodead,help] will cast Nature’s Cure on your friendly mouseover target. If you don’t have a mouseover target, [@target,exists,nodead,help] will cast it on your current friendly target instead. Finally, if you don’t have a friendly target either, [@player] it will cast it on yourself.
A focus target macro will cast something on whatever you have set as your focus target (target something and type /focus in chat to set one). These macros are commonly used for crowd control abilities and interrupts, but I also use them for my DPS abilities as a healer. This allows me to set the boss as my focus target and DPS without switching targets from whomever I’m healing.
#showtooltip Solar Wrath
/cast [@target,exists,nodead,harm][@focus,exists,nodead,harm] Solar Wrath
#showtooltip Solar Wrath will display the Solar Wrath icon and tooltip no matter what. We can’t just use #showtooltip alone in this macro or the icons will only show up when we have an enemy targeted or an enemy set as the focus. Doing it this way prevents the generic question mark icon from appearing otherwise.
You’re probably picking up on the pattern by now - [@target,exists,nodead,harm] will try to cast Solar Wrath on our target if it exists and is an enemy. If we don’t have a target that’s an enemy, [@focus,exists,nodead,harm] will cast it on your focus target if that happens to be an enemy. If neither of those situations exist, nothing will happen.
Modifier key macros will allow you to cast a spell based on which modifier key you're holding down (commonly Shift, Ctrl, or Alt).
/cast [mod:ctrl] Mighty Bash; [mod:shift] Warstomp; Solar Beam
[mod:ctrl] will cast Mighty Bash if the Ctrl key is held at the same time the macro is activated, similarly, [mod:shift] will cast Warstomp if the Shift key is held, and finally Solar Beam will be cast if no keys are held. Also worth noting, in this case #showtooltip will show the icon and tooltip of the spell based on which modifier key is currently being held. This means by default it will show the Solar Beam icon, but if Ctrl is held it will show the Mighty Bash icon, and so on. If you'd rather select your own icon that doesn't change, you can leave this line out.
Modifier keys can also be combined with other macro conditions, for example: [mod:ctrl,@target,exists,nodead,harm].
Similar to modifier key macros, conditional modifier macros will let you cast different spells based on different conditions (commonly help vs harm).
/cast [@target,help] Rejuvenation; [@target,harm] Moonfire
[@target,help] will cast Rejuvenation on your target if they're friendly, [@target,harm] will cast Moonfire on your target if it's an enemy. As with modifier key macros, #showtooltip will show the icon and tooltip of whichever spell meets the current conditions. In this case, Rejuvenation if your target is friendly and Moonfire if it's an enemy. If you'd rather select your own icon that doesn't change, you can leave this line out.
In some cases, you have two talents you often switch between, but you don’t want to keep changing the spells on your bar. Macros can help with that too!
/cast [talent:5/2] Incarnation: Chosen of Elune; Celestial Alignment
[talent:5/2] Incarnation: Chosen of Elune will use the Incarnation talent if it is chosen. The [talent:5/2] section is important. 5/2 corresponds to the row/column the talent is located on. In this case, it’s located on the fifth row, second column. If the Incarnation talent isn’t chosen, the macro will use Celestial Alignment instead.
The example below shows what it looks like when two talents are used alongside a general ability. This macro isn't particularly functional as far as the talents/abilities chosen, but it should serve as another good example.
/cast [talent:5/2] Incarnation: Tree of Life; [talent:7/3] Flourish; Ironbark
The macro will first try to cast Tree of Life if that talent is taken, then it will try to cast Flourish if that talent is taken, and if neither are taken it will cast Ironbark. Again, not the most functional example, but it shows that you can chain this type of thing together as long as you want to.
Some spells have a "target reticle," a big green circle that appears at your mouse cursor when you use the spell, most commonly these are area of effect spells and things like Efflorescence and Healing Rain. If you use these spells normally, you must "cast" the spell and then click at the location you want the spell to be used at. There's nothing wrong with doing it this way, but there are some ways macros can speed up the process.
/cast [@cursor] Efflorescence
[@cursor] will cast the targeted spell at your cursor's current location, removing the need to "click" after casting the spell.
/cast [@player] Efflorescence
Similar to the other macros above, [@player] will place the spell directly underneath yourself, without needing to "click" after casting.
There is a lot more you can do with macros but there are surprisingly little resources for learning. You can try the Wowpedia Macro Guide, otherwise, if you have any questions you can leave a comment below and I’ll try to answer it! I may even update the guide with what’s discussed.