Macro conditionals, the full list

The bracket language that gives macros their brain: every condition, how they combine, and the patterns that read clean.

How brackets work

Everything inside square brackets is a condition gate on the command that follows. If every condition in the bracket is true, the command fires. Otherwise the client skips to the next section after a ;.

Reading a macro is reading the gates left to right:

#showtooltip/cast [@mouseover,help,nodead] Riptide; [harm] Flame Shock; Healing Surge

Mousing over a living ally heals them. Otherwise a harmful target gets a flame dot. Otherwise, self-heal. The comma means AND, the semicolon means OR, and the last section is the fallback that always fires.

The essential conditionals

  • combat / nocombat: in or out of combat. The single most used pair in the game.
  • harm / help: your target is an enemy / your target is friendly. The second most used pair.
  • exists: you have a target at all. Combine with others: [exists,harm] means "a hostile target exists".
  • dead / nodead: your target is dead. nodead is the healing gate that stops wasted heals on corpses.
  • modifier: a modifier key is held. See the modifiers page for the full [mod:shift] family.

State conditionals (your character)

  • mounted / nomounted: on a mount.
  • swimming: swimming. Mount-macro essential.
  • flying: flying or falling.
  • indoors / outdoors: roof check, the classic hunter aspect macro input.
  • stealth / nostealth: stealth or vanish state (rogue, night elf racial).
  • channeling: you are channeling a spell. A combat-safety gate.
  • pet / nopet: your pet is out.

Group conditionals

  • party / raid: you are in a party / raid. [nogroup] is the solo check.
  • group: in groups. In classic-era macros you'll see the family [group:party] / [group:raid] and a numeric form in modern clients.

Targeting conditionals

The [@unit,condition] form picks the target the condition applies to, no matter what your current target is. Units you will actually use:

  • [@player]: yourself. The self-heal gate.
  • [@mouseover]: whoever your cursor is over. The healer's unit. Full treatment on the mouseover page.
  • [@focus]: your focus target. The arena staple.
  • [@cursor]: the unit at the world cursor (ground-target-friendly).
  • [@pet]: your pet. Classic-era syntax is [target=pet].
  • [@target,exists]: an explicit target check. The older[target=...] form is identical in meaning and required on classic-era clients.

A targeting conditional is just a gate: the cast still needs a spell to act on. The pattern [@unit,help,nodead] is the universal friendly-target gate, and[@unit,harm,nodead] its enemy twin.

Class conditionals

  • [stance:n] / [nostance:n]: warrior stances, 1 battle, 2 defensive, 3 berserker. The backbone of classic warrior macros.
  • [form:n] / [form] / [noform]: druid shapeshift forms, numbered per client version. Combines with [combat] for the auto-bear macro.
  • [spec:n]: your spec number, 1..4 in the listed order, enabling the same bind to cast different spells per spec. The modern[known:<spell>] conditional checks whether you know a spell at all: one macro that works both while leveling and at cap.
  • [button:n]: which mouse button was used, usually [button:2] for right-click. Keycap territory on the modifiers page.

Combining styles that age well

  • Keep brackets readable: one idea per section, two conditions max for the fast cases.[mod:shift] always first, [harm] next, fallback last.
  • The empty-bracket idiom [@mouseover,help,nodead][] is old-school and still valid: the empty section is the unconditional fallback. Modern macros write the fallback explicitly instead, which reads better.
  • Classic-era syntax [target=unit,condition] and modern[@unit,condition] behave alike. When in doubt, use the form your client era documents.

Conditionals and modifiers are the same language, so read the modifier page next, then go weaponize the pair onmouseover macros.

Questions people ask

What is the difference between a comma and a semicolon in a macro?+
A comma inside brackets means AND: every condition must pass. A semicolon separates whole sections and means OR: if the previous section didn't fire, try the next one. Chains of semicolons are how one button does several different things.
Do conditionals work in Classic macros?+
Yes, the same system shipped in vanilla. The modern [@unit] targeting shorthand came later; classic-era client syntax is [target=unit,condition], and both resolve today. Classic pages on this site use the era-correct form.
In what order does the client evaluate conditions?+
Left to right, section by section, and it stops at the first section whose conditions pass. Put the most specific or most common case first and the fallback last.