World of Warcraft Cataclysm Guide

Macro Option by Cogwheel

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

What are macro options?

Macro options are a way to control actions based on various pieces of information. To dive right into an example, the following macro will cast Renew on a friendly target and Shadow Word: Pain on a hostile one.

/cast [help] Renew; [harm] Shadow Word: Pain

When you run this macro, the [help] condition is checked. This determines whether your target is someone you can cast beneficial spells on. If the [help] is true, it then casts Renew and the macro moves to the next line. Otherwise (either you have no target, or you can’t cast a helpful spell on your target), it falls through to the next clause. Now it checks for the [harm] condition. [harm] is just like [help] but for offensive spells. If true, it casts Shadow Word: Pain. If it isn’t true (no target or you can’t harm your target) then it does nothing because there are no more clauses.

Note: I could have left the [harm] check out and it would have functioned in much the same way. However, if you have no target or your target can be neither helped nor harmed, you would receive an error message or, depending on the spell, the target selector cursor.

Commands that accept options

Only the “secure” commands respond to macro options. In fact, the secure commands are the reason macro options were created in the first place. Insecure commands like chatting, emotes, etc. can be scripted using Lua and the /run command. Furthermore, Blizzard didn’t want to confuse people who use semicolons in their chat messages. If /say could use macro options, the following would always just say “Hello”:

/say Hello; I’m a n00b

The following is a list of all the secure commands currently available in WoW:

  • #show *
  • #showtooltip *
  • assist
  • cancelaura
  • cancelform
  • cast
  • castrandom
  • castsequence
  • changeactionbar
  • clearfocus
  • cleartarget
  • click
  • dismount
  • equip +
  • equipslot +
  • focus
  • petagressive
  • petattack
  • petautocastoff
  • petautocaston
  • petdefensive
  • petfollow
  • petpassive
  • petstay
  • startattack
  • stopattack
  • stopcasting
  • stopmacro
  • swapactionbar
  • target
  • targetenemy
  • targetfriend
  • targetlasttarget
  • targetparty
  • targetraid
  • use
  • userandom

* #show and #showtooltip are not technically secure commands, but they operate with macro options just like /use and /cast.

+ /equip and /equipslot are not technically secure since their functionality is available to addons and macro scripts.

If you would like a way to use macro options for insecure commands, there are addons that provide such capability. My addon, MacroTalk (http://www.wowinterface.com/downloads/info6853-MacroTalk.html), adds a number of /opt___ commands for each chat command and a generic /opt command that lets you use options to choose other full (insecure) slash commands.

[target=unit]

In addition to condition checking, the macro option system provides us with a way to set the target of various actions. For example, the following macro will always use the bandages on the player regardless of what is targeted (see http://www.wowwiki.com/UnitId for a full list of unit IDs):

/use [target=player] Heavy Netherweave Bandage

Besides setting the target of the action itself, the [target=] assignment also sets the unit that the conditionals are checked against. Since that probably didn’t make much sense, here’s a macro that combines concepts from both of the examples you’ve seen so far:

/cast [help] [target=targettarget, help] [target=player] Flash Heal

First it checks against [help]. If it’s true, then it passes Flash Heal to /cast. Otherwise it moves on to the next condition, [target=targettarget, help]. Now it checks for help again, but this time it’s checking to see if your target’s target is friendly. If it is, then it will pass Flash Heal to /cast, but this time it also tells /cast that it should be cast on your target’s target. If it still hasn’t found a valid target yet, it’ll move onto the next condition, [target=player]. Since there are no actual conditions in there, it will always be true, so Flash Heal is sent to /cast with you, the player, as the target.

Syntax overview

There can be an awful lot of confusion around how macro options work, so I will take this early opportunity to break down the general concepts behind them. I will be providing some real-world examples using actual options. Don’t worry too much if you don’t understand what they mean. All options will be covered in detail later on.

General options syntax

All slash commands basically work the same way. You have a command, and a set of parameters. The parameters depend on the command, and some commands don’t take any. Here are a few examples:

/cast Smite\___/ \___/

| |

| parameters

|

command

/petattack

\________/ V

| |

| parameters (empty)

|

command

/castsequence reset=target Immolate, Corruption, Curse of Agony, Siphon Life

\___________/ \____________________________________________________________/

| |

command parameters

Macro options allow you to choose a set of parameters based on a number of criteria. At the highest level, you have a set of criteria/parameter groups separated by semicolons. The criteria consist of zero or more sets of conditions. Each condition set is enclosed with square brackets. Here is an illustration of this basic syntax.

/command [conditions] [more conditions] parameters; [conditions] parameters …

As you saw in the basic examples above, the command is evaluated from left to right. As soon as it finds a set of conditions that are true, it runs the command with the corresponding parameters. If there are no conditions in a clause, it will always be true. In fact, you can imagine a single-spell /cast command as a macro option with one clause that has no conditions. When the command does not have any conditions that are true, it will not execute at all.

Condition syntax

Each set of conditions is a simple comma-separated list. They can appear in any order, though [target=] is always taken into account first, before any of the conditionals. Think of the comma as an “and.” A condition like [help, nodead, target=focus] means “My focus is friendly AND not dead.”

Notice: Conditions are case-sensitive. If you use [Help] instead of [help], the macro will generate an error. However, this does not necessarily include the condition’s parameters (described below). Still, it’s usually better to consistently capitalize as things appear. Write spells and items just like you see in their tooltips. Follow the examples in this guide precisely.

Conditions themselves have a few building blocks. First off, as you just saw with “nodead”, you can put “no” in front of a condition to mean the opposite. Notice that [nohelp] does not mean the same thing as [harm]. [harm] and [help] both return true only if there is a target to begin with. Furthermore, there are some targets that can neither be helped nor harmed (unflagged players of the other faction, non-combat pets, escort quests, etc.).

Some conditions also take their own sets of parameters. For example, [stance] by itself means “In any stance” (useful for every class with stances except Warriors since they are always in a stance). However, you can also specify one or more particular stances to check. The set of parameters begins with a colon (:) and each parameter is separated with a slash (/) that means “or.” Here’s a generic illustration of the syntax of a single condition where everything inside angle brackets (<>) is optional.

[<no>condition<:parameter</parameter</parameter<...>>>>]

Here’s a simple example that uses Shield Bash in Defensive or Battle Stance, but switches into Defensive Stance if you’re in Berserker:

/cast [stance:1/2] Shield Bash; Defensive Stance

Note: “no” applies to the whole condition and all of its parameters. This means that [nostance:1/2] would mean “anything but stances 1 or 2″

Empty parameters

One source of confusion comes in dealing with parameterless commands. A very common error when writing macros is to add an extra semicolon to the end, but this creates some unexpected bugs. Take the following macro:

/petattack [target=focus, harm];

To the uninitiated, that looks like it’ll send your pet after your focus if it’s harmful, and do nothing otherwise. However, let’s look at a breakdown of this macro:

/petattack [target=focus, harm] ;\________/ \__________________/ V V V

| | | | |

command options | | parameters (empty)

| |

| options (empty)

|

parameters (empty)

See that extra blank set of options & parameters? Remember that a blank set of options always evaluates to true, so that second empty parameter gets passed to /petattack if the first conditions are false.

Empty conditions

Sometimes you may want a command to cast on a particular target under certain circumstances but behave like normal if those conditions aren’t true. In this case you will want to use an empty set of conditions which will always evaluate to true. The following macro will cast Flash of Light on the unit under your mouse. If you have no mouseover or it’s hostile, the macro will behave like a plain /cast Flash of Light, casting on your target and respecting self-cast key and auto-self-cast interface option.

/cast [target=mouseover, help] [ ] Flash of Light

[target=] vs. unit parameters

Some commands accept units directly as their parameters. For example, /target party1 will target your first party member. The command /target [target=party1] while a bit more verbose has the equivalent behavior. However, in most cases the designers don’t want us to be able to test conditions on one unit and then act on another, so you must use one or the other. E.g., a macro like the following will not work as expected:

/target [target=focus, dead] party1

WoW will ignore party1 because you set a unit with the [target=]. There are some specific exceptions to this rule. A few commands have “key units” that are fundamental to the command. If you use that unit in your [target=], WoW will allow you to specify another unit or will use the default unit for the command if you don’t specify one. That last bit needs a concrete example:

/focus [target=focus, dead] [target=focus, noharm] target

In this case, the key unit is focus. Since we are using [target=focus], WoW will send “target” to the /focus command. We could also have left off the “target” at the end since the /focus command defaults to your target. Below is a list of all commands with key units, and their default units if any. To reiterate for clarity, the key unit is a unit you can use in [target=] that will allow you to send another unit to the command. The Default Unit is the unit that will be sent to the command if you don’t provide one.

Command | Key Unit | Default Unit————-+———–+————-

/target | target |

/focus | focus | target

/startattack | target | target

/petattack | pettarget | target

Conditionals

Now you’ll get to see the complete list of conditionals and what they mean. Each conditional will be treated more thoroughly below.

Complete list

Below is the entire list of conditionals that are available to the macro system. One of the goals in the 2.0 patch was to eliminate a lot of old “smart buttons” that allowed people to essentially play the entire game spamming one key repeatedly. However, many tasks people used macros to simplify were deemed OK and given Blizzard’s blessing via the macro options.

If you don’t see a condition listed here, then there is no way to check for it and take a combat-related action. These are essentially non-negotiable though they may be augmented in the future.

  • help – Can cast helpful spells on the target
  • harm – Can cast harmful spells on the target
  • exists – Target exists
  • dead – Target is dead
  • stance:0/1/2/…/n – In a stance
  • stealth – Stealthed
  • modifier:shift/ctrl/alt – Holding the given key
  • button:1/…/5/<virtual click> – Macro activated with the given mouse button
  • equipped:<item type> – item type is equipped (item type can be an inventory slot, item type, or item subtype)
  • channeling:<spell name> – Channeling the given spell
  • actionbar:1/…/6 – Given action bar page is selected
  • pet:<pet name or type> – The given pet is out
  • combat – In combat
  • mounted – Self explanatory
  • swimming – Self explanatory
  • flying – Mounted or in flight form AND in the air
  • flyable – In a zone where flying is allowed
  • indoors – Self explanatory
  • outdoors – Self explanatory
  • party – Target is in your party
  • raid – Target is in your raid/party
  • group:party/raid – You are in the given type of group

help & harm

These two have been covered fairly thoroughly so far. I can’t really think of anything to add right now, but I will leave this section here for completeness.

exists

This determines whether the given unit exists. In other words, if you don’t have a target, [exists] will return false. If you have a focus, [target=focus, exists] would be true. Note that in some cases [exists] is unnecessary. [help], [harm], [dead], [party], & [raid] all imply [exists] if they’re true.

dead

If you have a target and it’s dead, this will be true.

stance:0/1/2/…/n

Stance is the generic term used for Warriors’, Druids’, Rogues’ (Stealth), Priests’ (Shadowform) and Shaman’s (Ghost Wolf) forms. Stances are only applicable to situations where certain abilities are only usable in specific forms. Because of this, Paladin auras (despite being on the shapeshift bar) and Hunter aspects are NOT considered stances.

The simplest form of [stance], as mentioned previously, means that you are in any stance whatsoever. It is equivalent to [stance:1/2/3/.../n] where n is the number of stances you have. [stance:0] is equivalent to [nostance] so you can use a conditional like [stance:0/3] to evaluate as true if you are either in stance 3 or not in any stance.

The stances themselves are ordered the same way as they appear on your shapeshift bar. So a Druid with Bear, Aquatic, Cat, & Travel forms would have stances 1 through 4. Here is a simple chart to help you remember stance numbers (thanks Neuro :P ):
| Warrior | Druid | Priest | Rogue | Shaman ———+———–+———+————+———+———-

Stance 1 | Battle | Bear | Shadowform | Stealth | Ghostwolf

Stance 2 | Defensive | Aquatic | | |

Stance 3 | Berserker | Cat | | |

Stance 4 | | Travel | | |

Stance 5 | | MK/ToL | | |

Stance 6 | | Flight | | |

Note: if a Druid is missing a form, all the higher-number ones will be shifted upwards on the chart.

Example:

/cancelform [nostance:0/1/3]/cast [stance:1/3] Faerie Fire (Feral)(); [nostance] Faerie Fire

In Bear and Cat forms, this will cast Faerie Fire (Feral). In caster form, it will cast Faerie Fire. In any other stance, running the macro will return you to caster form. Note that after patch 2.3, /cancelform will register instantly so it will immediately cast Faerie Fire after leaving a form.

stealth

While the Rogues among you may find this redundant since [stance] behaves the same way, [stealth] also applies to Night Elves’ Shadowmeld, Mages’ Invisibility, etc.

modifier:shift/ctrl/alt

Modifier keys are a convenient way to save action bar space and make certain decisions. Say you want an implied targeting macro but use one spell normally and another spell when you’re holding down a modifier key:

/cast [modifier, help] [modifier, target=targettarget, help] Flash Heal; [help] [target=targettarget] Greater Heal

This macro will cast a helpful spell on either your target if it’s friendly, or your target’s target otherwise. When you hold any modifier key, it will cast Flash Heal. Otherwise it will cast Greater Heal.

Of course, you can specify particular modifier keys for more control a la [modifier:shift/ctrl] which means “shift or control.” If you want to specify both, you need two modifier conditionals: [modifier:shift, modifier:ctrl].

Beware if you’re using key bindings for your macros. If you bind A to a macro with, say, [modifier:shift] and you have something else bound to SHIFT-A, the SHIFT-A binding will take precedence and your macro will not run.

Modifier variables

While modifier keys can only be one of shift, ctrl, or alt, there are a number of system variables that you can use in your modifier conditions as well. For instance, the SELFCAST variable means “whatever your self-cast modifier is set to.” The default is alt (holding the alt key while casting a spell will attempt to cast it on yourself) though some addons give you the option to change this. If you create a macro like:

/cast [modifier:SELFCAST, target=player] [target=mouseover] [ ] Greater Heal

It will work as expected no mater what you have set as your self-cast key. Some other variables and their defaults (though with arguably much less utility) are as follows:

  • AUTOLOOTTOGGLE (shift)
  • STICKYCAMERA (ctrl)
  • SPLITSTACK (shift)
  • PICKUPACTION (shift)
  • COMPAREITEMS (shift)
  • OPENALLBAGS (shift)
  • QUESTWATCHTOGGLE (shift)

button:1/2/…/5/<virtual click>

Similar to [modifier], [button] allows your macro to respond differently based on which mouse button is being used to activate the macro. Button numbers 1-5 correspond to left, right, middle, button 4, & button 5. If your macro is activated by a key binding, [button:1] will always be true. As an example, here is the macro I use for mounting:

#show Swift Green Mechanostrider/userandom [nobutton:2, flyable, nomounted] Ebon Gryphon; [nomounted] Black Battlestrider, Swift Green Mechanostrider

/dismount [noflying] [button:2]

Behavior when not mounted: left-clicking will pick Ebon Gryphon if it can be used (flyable), otherwise it will randomly pick the Black Battlestrider or the Swift Green Mechanostrider. Right-clicking will always pick one of the mechachickens.

Behavior when mounted: left-click will only dismount if not flying. Right-click will always dismount.

The “virtual click” can usually be ignored, but if you use a bar mod it can be useful. Action bars that respond to various state changes translate clicks to virtual ones that determine which action to use. Because these virtual clicks are addon-specific, I’m not going to go into any further detail here.

equipped:<item type>

[equipped] allows you to determine if a particular type of gear is equipped. The item type can be an inventory slot name, an item type, or an item subtype. See http://www.wowwiki.com/ItemType and http://www.wowwiki.com/API_TYPE_InventorySlotName for lists of these types. Here is the macro I use to pick Shield Bash or Pummel depending on what I’ve got equipped:

#show [equipped:Shields] Shield Bash; Pummel/cast [equipped:Shields,stance:1/2] Shield Bash; [equipped:Shields] Defensive Stance; [stance:3] Pummel; Berserker Stance

The #show line is used to make it show either Shield Bash or Pummel. Without it, it would show the stance spells as well, when applicable. Here’s some pseudocode that illustrates how the second line works:

if a shield is equipped and I’m in Battle or Defensive stance then
/cast Shield Bash

else if a shield is equipped then
/cast Defensive Stance

else if I’m in Berserker stance then
/cast Pummel

else
/cast Berserker Stance

Here’s another macro that lets you cast Overpower with a bit more vigor:

/equip [noequipped:Two-Handed Axes] Crystalforged War Axe/cast [nostance:1] Battle Stance; [equipped:Two-Handed Axes] Overpower

channeling:<spell name>

Normally, if you are channeling a spell and begin casting another spell, it will cancel the channel. This option allows you to keep that from happening, and also has a few other uses. For instance, maybe you do want to cancel one particular spell but not another. [channeling] alone matches any spell and you can also list an arbitrary number of spell names to check.

Note: channeling is NOT the same as casting. The [channeling] conditional only applies to spells like Arcane Missiles, Drain Life, Mind Flay, etc. where after the initial cast, the spell makes its effect over time.

actionbar:1/…/6

The default UI provides a number of action bar pages. These pages only affect the lower left action bar that is visible by default. Luckily, you can make macros that respond to different action bar pages and place them on the other action bars. One example is for a hunter to emulate stances using their aspects:

/swapactionbar 1 2/cast [actionbar:1] Aspect of the Hawk; Aspect of the Monkey

This macro will switch between action bars 1 and 2. When it switches to bar 1 it casts Aspect of the Hawk, and when it goes to bar 2 it casts Aspect of the Monkey.

pet:<pet name or type>

Every class with a pet should find this one useful. It allows you to choose an action based on which pet you have out. You can specify your pet’s name or your pet’s type (Voidwalker, Boar, Imp, Wolf, etc.). [pet] by itself matches any pet. For example, a Mage can choose between their elemental’s Freeze spell or their own Frost Nova:

/cast [pet] Freeze; Frost Nova

combat

True if you are in combat.

mounted, swimming, flying, indoors & outdoors

These are all fairly self-explanatory. They all apply to you, the player.

flyable

As briefly mentioned above, [flyable] determines whether you are in the Outland where you’re allowed to use a flying mount.

party & raid

These return true if the target is in your party or raid, respectively.

group:party/raid

This lets you determine whether you are in the given group type. [group] is equivalent to [group:party]. [group:raid] implies [group:party]. This can be useful for buffing classes. For example:

/cast [group, nomodifier] Arcane Brilliance; [help] [target=player] Arcane Intellect

If you’re in a group it will normally cast Arcane Brilliance. If you’re holding a modifier key or you’re solo, it will cast Arcane Intellect on a friendly target or yourself.

Using focus

Focus is a unit ID like target, player, or raidpet1target (See http://www.wowwiki.com/UnitId). It allows you to reference a mob, player, or NPC you specify. The simplest usage of focus is with key bindings. There are two focus-related functions in the bindings menu: Focus Target, and Target Focus. Focus Target sets your focus to whatever you are currently targeting (it will clear your focus if you have nothing targeted). Once you have a focus set, you can use it as a unit ID for any other command. Target Focus will, as you might guess, target the entity you have focused. However, these bindings don’t really take full advantage of focus. In order to get the most bang for your buck, you will need to use macros with macro options.

One of the most common uses is to set a crowd control target. A mage can select a mob to sheep and set it as their focus. Now they can change targets for DPS and use the following macro whenever they need to re-sheep.

/cast [target=focus] Polymorph

Or maybe a healer could set their focus to the main tank. With an addon like FocusFrame (http://wow.curse.com/downloads/details/5681/), they would then have a frame devoted to their main tank that they could easily use for healing.

In addition to the key bindings, there are also the /focus and /clearfocus slash commands. Without any parameters, /focus works exactly like the key binding, setting your current target as your focus. You can also specify any valid unit ID (see Targeting above) or name as a parameter to /focus:

/focus party3target

Here is an example of more advanced focusing:

/focus [target=focus, noexists] [target=focus, dead] [target=focus, help] [modifier]/stopmacro [target=focus, noexists]

/cast [target=focus] Polymorph

The first line sets your focus to your current target (or clear your focus if you don’t have a target) in one of the following situations:

  • You don’t already have a focus
  • Your current focus is dead
  • Your current focus is friendly
  • You are holding down a modifier key (in case you want to change your focus after you already have a valid one)

The second line keeps the macro from proceeding if you don’t have a focus. Finally, it casts Polymorph on your focus. This gives you a one-button solution for your crowd control with focus. You may notice that we could have used an exists condition in the /cast command instead of a separate /stopmacro command. However, /stopmacro affords us a bit more flexibility by stoping any other commands we may add to the macro later (like a warning in /p).

It’s possible to swap your target and your focus, giving you in effect two targets you can toggle between:

/cleartarget [target=target, dead]/clearfocus [target=focus, dead]
/target focus
/cleartarget [target=focus, noexists]
/targetlasttarget
/focus target
/targetlasttarget

The first two lines clear the target and/or focus if they are dead (if you really want to keep track of multiple dead targets, e.g. to resurrect or loot them, then delete those lines). The fourth is needed because /target focus doesn’t clear your target if you have no current focus (without it, the fifth line would then retrieve your previous target).
credit goes to Cogwheel’s Complete Macro Guide

Posted by Wow Macros
wowmacros@yahoo.com wowmacros.googletalk

Wow Macros. We provide the most complete wow macros list for all class. Paladin, Warrior, Shaman, Priest, Mage, Warlock, Hunter, Rogue. You can use this to describe yourself, which server you play, your guild or just to show off your toons or whatever. The social contact is just an example :)

joana wow leveling guide

One Response to “Macro Option by Cogwheel” Macro

  1. nelsoneckolol says:

    Hi, very nice post, I’m impressed :)
    But I have a question.
    I’m playing on a WOTLK server, and as a fire mage, I need a macro that cast Flamestrike if there is the Firestarter proc (on WOTLK, Firestarter makes DB or Bump 50% with r1 and 100% with r2 chance to have an instant and no-mana cost cast of Flamestrike) and Blizzard if there isn’t any proc.

    First, I thought it will be an easy macro like:
    /cast [nomod, proc: Firestarter] Flamestrike
    /cast [nomod] Blizzard

    I saw that “proc” doesn’t exist, so I tried with “buff”, “spell”, or things like that, but can’t find anything, and I can’t find what I need in your Complete list :/

    Can you help me ?
    Thx,
    nelsoneckolol

Leave a Reply