Table of Contents:
- Intro - Macro Basics
- Macros - What can they do?
- Macros - What can they NOT do?
- Conditionals - How do they work?
- Scripting - What is possible in a macro?
- Macros - Tips, Tricks, and Shortcuts
1. Intro - Macro Basics
Macros are a very useful tool within the World of Warcraft client. They allow you to combine multiple actions onto a single button. While the entire macro will run every time, actions which trigger the Global Cooldown will stop later GCD actions from functioning.
You can make a macro to take almost any action you can click or keybind, with certain restrictions.
Macro commands can be made more useful with [conditionals], snippets that check on various things to allow a small degree of decision making. While macros execute the first valid item from the top down, individual commands execute the first valid conditional, from left to right.
Macros can be used to execute scripts, small snippets of Lua code, from within WoW without the use of an external addon. This is done by using the /run command. Scripting is an advanced feature and is explained more in detail further down.
There are a number of tips, tricks, and shortcuts to help you get the most out of your macros. Most of the ones listed have come from this very forum, and I have consolidated them here to make it easier.
As the macro system is continually updated with new patches, and new discoveries are made about how certain commands and conditionals work, I will do my best to keep this thread up to date with current information.
2. Macros - What can they do?
Macros can make many actions within the game environment. Most often, macros are created to use items or abilities. However, macros can also be used to send chat messages, equip gear, change class specializations, and adjust settings, among many, many other things.
Macro commands are prefaced with a /
Examples:
/use
/cast
/say
/equip
/console
/castsequence
/target
/click
There are many other slash commands that can be used in a macro, and more are added in patches or expansions on a regular basis. WoWPedia has a list of many possible slash commands available to the default game client. If you want to see a full list, you can pull it directly, in-game, with a script below in the Tips and Tricks section of the guide. Many addons also add their own slash commands, usually to open a configuration menu or perform a specific action; most of these can be used from a macro as well as typed directly into the chat edit box (e.g. /recount
).
There is also a special macro command, #showtooltip
. This will show the icon and information for an item or ability, the same as if you had dragged the item or ability onto your action bar.
Example:
#showtooltip
/cast Flash Heal
This macro, when placed on your action bar, would function exactly the same as dragging the spell Heal from your spellbook.
One other special command is /click
, which can be used to click on UI elements, such as action bars or pop up buttons. While this command is part of the macro syntax, it is specifically blocked from being called in a macro, and needs to be manually typed in the chat window every time.
3. Macros - What can they not do?
Macros cannot make smart decisions for you. They can’t cast spells based on cooldown, or check if a buff is active, or magically fit all your abilities onto one button.
Macros cannot be any longer than 255 characters. There were previously ways around this limit with add-ons, or by chaining macros together with /click
, but those have been eliminated in 11.0
Macros cannot circumvent the global cooldown to use more than one item or ability at a time. There are some exceptions, but this is the general rule.
Macros cannot simulate additional keypresses. One keypress = one action.
Macros cannot include a delay for most commands. Certain commands (e.g. chat) can be delayed with an addon.
4. Conditionals - How do they work?
Conditionals are a way to extend the macro interface. They allow limited decision-making to macros; be aware that they are limited to what Blizzard has specifically allowed for each command, and that not all commands may accept the same conditionals.
As an example, let’s take the simple macro from earlier:
#showtooltip
/cast Flash Heal
We are going to modify this macro with the [harm]
conditional, so it does something different when an enemy is targeted:
#showtooltip
/cast [harm]Smite;Flash Heal
Now, the macro will use Smite if you have an enemy targeted, and Flash Heal otherwise.
You can use multiple conditionals in a macro command. Example:
#showtooltip
/cast [harm,mod]Holy Fire;[harm]Smite;[mod]Heal;Flash Heal
The macro will now use Holy Fire if you are pressing a modifier (Ctrl, Shift, or Alt) and you have an enemy target, Smite if you have an enemy target and are not pressing a modifier, Heal if you are pressing a modifier without an enemy target, and Flash Heal if none of the other conditions are true.
It is important to remember the proper syntax when using multiple conditionals. [combat,mod]
would require you to be in combat and holding a modifier, while [combat][mod]
would only require one or the other.
Another important feature of conditionals is the ability to use an empty conditional, []
. Empty conditionals function exactly as if you had dragged the spell from your spell book, meaning they will respect your auto-self-cast settings, and will properly alert you if a target is required rather than silently failing without a target. They also serve as a fallback option to ensure a tooltip is generated if other conditions are not met.
IT IS IMPORTANT TO REMEMBER THAT A MACRO WILL EXECUTE THE FIRST TRUE CONDITION .
In the above example, if you have an enemy targeted, the macro will never cast Heal or Flash Heal, no matter what you do. You need to target a friendly or clear your target in order to cast a healing spell.
Conditionals available for use in macros:
(Note that any of these conditions (excepting [@unit]
) can be inverted with no, meaning [nocombat]
, [nopet]
, etc, will work exactly as you’d expect.
[@unit]
Attempts to perform the action on the listed unit, unit can be a UnitID (player, target, focus, pet, party1, raid1targettarget, etc) or a name (Adreaver-Undermine). Names are case-sensitive and only valid if the named player is a member of your group. Additionally, for Cross-Realm players, omit spaces (but not punctuation) in the realm name (e.g. Jaina-KulTiras, Zekhan-Vol’Jin, etc). A full list of UnitIDs is available at WoWPedia.
Casting a spell [@unit]
in this way will allow you to target one unit and cast the macro’d spell at something else. For example, you could set the tank as your focus, and use /use [@focus,help,nodead]Misdirection
to cast Misdirection on the tank while still targeting the enemy.
A special unit is [@mouseover]
, which refers to the unit (or unitframe) you are pointing your cursor at. Particularly useful for healers to cast healing spells on party members without having to change targets, they are also useful for things like interrupts, offensive dispels, and sending your pet to attack one target while you attack another.
Note that [@unit]
assumes the unit is there unless you specifically check for it. Use [@unit,harm]
to check for enemies, [@unit,help]
to check for friendlies, or [@unit,exists]
to check for either.
[modifier]
,[mod]
This allows you to cast a different spell when pressing ctrl, shift, or alt. [mod]
will register any modifier, while [mod:shift]
will only register shift, and ignore ctrl or alt. If desired, you can use multiple modifiers together - [mod:ctrlalt]
for example, will only register when pressing ctrl AND alt at the same time.
[button]
,[btn]
This checks which mouse button you used to click the macro. [btn:1]
is implied by default, but you can specify [btn:2]
for right click, [btn:3]
for middle click, and 4/5 for side buttons on your mouse.
[exists]
,[help]
,[harm]
,[dead]
These check the status of your target. [exists]
simply checks for any target, living or dead, friendly or hostile. [help]
and [harm]
check for a friendly or hostile target respectively, while [dead]
check if your target is dead. [help][harm][dead]
all imply [exists]
- if your target is dead, you obviously have a target.
[combat]
Combat allows you to check if you are in combat. This is helpful when you have certain spells that can only be used out of combat, for example mounts.
#showtooltip
/use [combat]Aspect of the Cheetah;Brown Ram
The above macro would use your Aspect of the Cheetah in combat, and summon your mount out of combat, thus giving you a speed boost in either scenario.
[known:Spell Name]
or[known:SpellID]
This checks if you know a certain ability (typically a talent). For example, this macro will make you invisible, using Camouflage if known, and a potion if not:
#showtooltip
/use [known:Camouflage]Camouflage;Potion of Concealment
[stance]
,[form]
;[stealth]
These check if you are in a stance or form, with [stealth]
specifically checking for Stealth (or Prowl, for Cat Form Druids). [stance]
and [form]
are functionally identical, so you can use either [form:1]
or [stance:1]
to look for a Druid’s Bear Form. Rogues also have additional stances, with rogues using additional [form:2]
for Vanish and [form:3]
for Shadow Dance.
[equipped]
,[worn]
This is used to check if you have the specified item type equipped, like [equipped:Shirts]
to check if you are wearing a shirt. [worn]
is functionally the same but using less characters. You can only check for a specific item type, not for an individual item by name.
[pet]
This checks if you have a pet out, and optionally, what kind. [pet]
will check for any pet, while [pet:bear]
or [pet:imp]
will look for that specific type.
[spec]
This checks which of your specializations you are currently in. [spec:1]
through [spec:4]
go in the same order as the Specializations Window, from left to right. Demon Hunters only have 2 specializations, and Druids have 4. All other classes have 3.
[actionbar]
This checks which actionbar you are currently on. In the default UI, you may have noticed that you can press Shift+1 through Shift+6 (or click the small arrows to the right of your actionbar) to change your actionbar page, granting you access to an additional row of abilities. This would allow the same macro, placed on two different pages, to function differently depending on which page you were on at any given moment. Primarily used in actionbar swap macros, not particularly useful outside of this limited context.
[group]
,[group:party]
,[group:raid]
This indicates whether you are in a group. [group]
is true for a group of any size, while [group:party]
is only true for a 5-man party, and [group:raid]
is only true for a raid group, regardless of size.
[channeling]
This indicates if you are channeling a spell, like Rapid Fire, Mind Flay, Blizzard, or Soothing Mist. You can use [channeling:SpellName]
to check if you are channeling a specific spell, or don’t specify a spell and it will be true if you are channeling any spell. A great usage here is to invert the conditional, which will allow you to spam your abilities near the end of a channel without clipping it early, like so:
#showtooltip Aimed Shot
/use [nochanneling:Rapid Fire]Aimed Shot
[indoors]
,[outdoors]
,[flyable]
These all refer to the area where you are. If you are outside (in an area where you can summon your mount), [outdoors]
will be true. Otherwise, [indoors]
will be true. [flyable]
is true in areas where flying on a mount is permitted, regardless of whether you have the requisite flying skill learned.
[mounted]
,[flying]
,[swimming]
These indicate your current movement status. [mounted]
checks if you are on a mount of any kind, [flying]
checks if you are on a flying mount AND flying in the air, and [swimming]
checks if you are in a body of water, regardless of whether or not you are submerged or at the surface.
5. Scripting - What is possible in a macro?
Scripting is an advanced feature sometimes used in macros. Be aware that scripting can’t be used to cast a spell, use an item, or take any other “secure” action. Secure actions are those things which are reserved for the Blizzard UI, and are not available to addons.
Essentially, if you use a script in a macro, you are using a micro-addon. It has all the abilities and limitations of a normal addon, but restricted to a 255 character limit. Useful examples are announcing cooldown or crowd control targets in a raid environment, calculating variables and returning the result (e.g. How many glyphs do I have left to learn?), or making non-protected spell casts (e.g. determining which mount to use based on what zone you are in).
There are far more possibilities available with scripting than I could possibly describe here, so if you have specific questions or a script you want to share, feel free to mention it here or post a new thread.
As a result of some scammers passing off malicious scripts as legitimate, Blizzard has implemented a Lua script warning anytime you run a macro with the “/script” or “/run” commands. You get this same warning if you type a script directly in the chat window without a macro.
The warning is essentially telling players to be careful of running custom scripts they get on the internet or from other players, that they should not run any scripts they do not trust.
6. Classic WoW Macro Changes
There are a few changes to the macro system specific to WoW Classic. For the most part, the API is unchanged, and live macros should work in most cases.
NEW: Spell Ranks
-
Classic WoW returns to the ranking system for spells. Most spells with an absolute value effect (read: not percentage-based) have multiple ranks, which cost an increasing amount of mana (and sometimes have a longer cast time) for higher ranks. Some spells (primarily buffs) are level restricted for certain ranks, (You can’t buff a level 1 character with max rank Blessing of Might or Power Word: Fortitude). Use spell ranks in macros like so:
/cast Spell
will cast Spell at the highest possible rank for that target. For offensive spells, this will always be the highest rank. For beneficial spells, this will be the highest rank depending on target level./cast Spell(Rank #)
will cast Spell at the specified rank. This is primarily useful for healers to conserve mana, or if you have an offensive spell that applies a debuff and you want the debuff effect but not necessarily the spell damage. Rank 1 Frostbolt for Mages is a common tool for kiting as the mana cost is lower and the cast time is shorter than higher ranks.
REMOVED: Focus (UnitID)
- In Classic, Focus (and related unitIDs, like focustarget) is not recognized as a valid target for spells.
- This means that you will need to target the unit you want to cast at. You an use other unitIDs like targettarget, pettarget, or party1target, but this is less reliable as the intermediate unitID can swap to a different target.
- Mouseover is generally a better option as it is 100% within your control, but it does take more coordination and mouse accuracy than Focus macros from BfA.
REMOVED: Reticle Targeting (Conditionals)
- In Classic, reticle (ground targeted) spells require two keypresses to activate. The first press will bring up the targeting reticle, and the second press will cast the spell.
- This is a change from BfA, where you can use
[@cursor]
to immediately drop the spell on your mouse, or[@player]
to immediately drop the spell on yourself. - There is no effective workaround for this issue, though it may be helpful to bind these types of spells to additional mouse buttons (Mouse3 (wheel click), Mouse4 (forward), Mouse5 (back), or other buttons as available depending on your mouse), as that doesn’t require the use of both hands to cast a single spell.
7. Macros - Tips, Tricks, and Shortcuts
There are a number of tricks and shortcuts you can use in your macros to make them go a bit further within the 255 character limit. Take a look at some of the examples below, and feel free to submit your own in a reply.
/cast
and/use
can be used interchangeably in most situations (with/use
preferring items and/cast
preferring spells, if you have a spell and an item with the same name). So in our initial example, you could instead write it as:/use Flash Heal
to shorten it by 1 character.
- Certain conditionals imply other conditionals. For example,
[exists]
means “if I have a target”.[help]
means “if I have a friendly target”. Thus[help]
implies[exists]
; if you have a friendly target, it is obvious that you have a target. Thus only the[help]
condition is needed.
- Additional whitespace and punctuation are not needed in the macro interface.
/use [help]Flash Heal
is the same as/use [help] Flash Heal
. Removing additional whitespace can be helpful with complex macros when trying to stay below the 255 character limit.
- Multiple modifiers can be used in the same macro command. For example, the following macro combines a number of useful teleport spells for a Mage, as well as Hearthstones, and Blink, into a single line:
#showtooltip
/use [mod:ctrlaltshift]Teleport:Shattrath;[mod:ctrlalt]Teleport:Dalaran;[mod:ctrlshift]Teleport:Stormshield;[mod:altshift]Teleport:Vale of Eternal Blossoms;[mod:ctrl]Teleport:Stormwind;[mod:alt]Garrison Hearthstone;[mod]Hearthstone;Blink
- You can use the following script (courtesy of @Ehiztari) to pull an up-to-date listing of all the slash commands available to your client at any time. These commands can then be used in macros.
function CommandList()
local HT = {}
HT.Commands = {}
HT.NormalizedCommands = {}
for key, value in pairs(_G) do
if strsub(key, 1, 6) == "SLASH_" then
local cTypeKey = gsub(key, "%d+$", "")
for cSeq = 1, 20 do
local cPrime = cTypeKey.."1"
local cKey = cTypeKey..tostring(cSeq)
if _G[cPrime] and _G[cKey] then
if strsub(_G[cPrime], 1, 1) == "/" and
strsub(_G[cKey], 1, 1) == "/" then
HT.Commands[_G[cKey]] = _G[cPrime]
if HT.NormalizedCommands[_G[cPrime]] then
-- skip it
else
-- make it
HT.NormalizedCommands[_G[cPrime]] = {}
end
HT.NormalizedCommands[_G[cPrime]][_G[cKey]] = true
end
else
break
end
end
end
end
return CopyTable(HT)
end
www.macroexplain.com
- This is a great resource for players writing macros, particularly those who are inexperienced. You copy and paste your macro into this web site, and it will tell you, in plain text, what the macro will do. It will also let you know how much room you have to expand the macro, if you go over the 255 character limit, and if you have any errors. This site does have some limitations: it is not up to date on many of the more recent syntax changes, and it is missing a large amount of spell data, but the basic functionality works very well.
If anyone has suggestions for adds/changes, please let me know.
Changelog
Changelog 20230122:
- Removed
[talent]
which is deprecated and nonfunctional in 10.x.- Added
[known]
with description and example.- Added missing example for
[channeling]
.
Changelog 20200110:
- Clarified the functionality of
[@unit]
with an example.
Changelog 20200105:
- Added caveat regarding
[@unit]
requiring an existence check to function properly.
Changeling 20240924:
- Removed line referencing macro extension add-ons.
- Added note to
/click
regarding 11.x limitations.