MACROS - How To
Macros An example macro would be: /cast Fireball(Rank 1) /yell "I am frying it!" This macro merely casts a fireball, and then yells for everyone to hear that you have done so. Macros have some severe limitations, and are only intended for very very simple tasks. The most important limitation is that it is difficult to cast more than one spell at a time using a macro (although it is possible, using API_SpellStopCasting). This limitation exists so that macros can't automate too much for you. You can have as many other commands within the 256 character limit as you like.
Here is a quick guide on how to make macros:
type /macro to open the menu in game. Drag your macro to the action bar. Learning about Macros Standard slash commands that you type in the chat window can be used in macros. Blizzard has made additional commands available (which can be run in the chat window, BTW) called API commands. Syntax The command format for '/cast' is: /cast [<first set of options>] <first spellname>; [<second set of options>] <second spellname> ; [<third set of options>] <third spellname>; ... Some additional tricks you can do with the options: You can add 'no' to the beginning of any option (except target) to invert it, i.e. 'nocombat' will only work if you are NOT in combat. Separating options with a comma ',' will act like an 'and' statement; if both options are true, it executes. Separating options with a slash '/' will act like an 'or' statement; if either option is true, it executes. Macro Icon Macro Feedback The first attempted cast in a macro that fails (for whatever reason - e.g. cooldown not available, out of range, line of sight, nothing to dispel, can't cast harmful spell on friendly taret) will prevent further casts in the macro. Only some of those may be checked in the macro condition. Abilities that do not trigger a global cooldown do not trigger the "no more spells in the macro may cast" rule, provided a /stopcasting follows them. This is true even if the cooldown (trinket or spell) isn't available. Further, these UI errors can be surpressed temporarily in the macro. The /cast, /use, /cancelaura, /changeactionbar, /equip, /target, /focus, /assist, /targetenemy, /targetfriend, /targetparty, and /targetraid commands can be given multiple actions and conditions on which to use those actions. The first matching action will be used. Item names can be used interchangeably with spell names in /cast, /castrandom, and /castsequence. Poisons, feeding your pet, etc. will be even easier to macro: /cast Feed Pet then /use Dry Pork Ribs. You will also be able to click on food in your action bar when you are targeting Feed Pet and other item targeting spells. If you have multiple spells you want to cast with a single button, you should use /castsequence and hit the button multiple times. They cast one after another, with cooldown of course. Naturally you can also mix in /use commands. Commands /use <itemname> Pet control /castsequence [<options>] reset=<#>/target/combat <spell1>, <spell2>, <spell3> Castsequence Examples: /castsequence Frost Nova, Blink The first time you click it, you Frost Nova, then you click again and Blink away. /castsequence [combat] Frost Nova, Blink Same as above, but only if you are in combat. /castsequence reset=24 Frost Nova, Blink The first time you click it, you Frost Nova. If you decide not to Blink, after 24 seconds it will reset back to Frost Nova. Since Frost Nova's cooldown also happens to be 24 seconds, it'll be ready to use again. /castsequence Corruption, Immolate, Curse of Agony You can just push that button three times and cast all three DoTs. /castsequence reset=combat/target Corruption, Immolate, Curse of Agony Any time you change targets (like, if the old target is almost dead and you want to start on a new one), or any time you leave combat (perhaps the critter died before you finished casting all the dots), it resets your sequence for you, leaving you ready to start over. Options actionbar:<number> - Evaluates 'true' if the current actionbar is the same as the listed one.
Equipped Option A List of Inventory Slots: Two-Hand /cast [equipped:Two-Handed Swords] Mortal Strike; Heroic Strike This will cast Mortal Strike if you are using a 2hand sword. /cast [equipped:Two-Handed Swords/Two-Handed Maces/Two-Handed Axes/Polearms] Mortal Strike This uses the '/' modifier to set up an 'or' condition. This macro will cast Mortal Strike if ANY of those types are equipped. /cast [equipped:Shields] Shield Bash This will cast Shield Bash if you have a shield equipped. /cast [equipped:Shields, equipped:Daggers] Shield Slam This will cast Shield slam only if you have a dagger AND a shield equipped. /cast [noequipped:Shields, equipped:Off Hand] Rampage This will cast Rampage if you do NOT have a shield equipped, AND you have something in the Off Hand slot. In theory, this macro will only activate if you are dual-wielding. Button Options The default button is 1, the Left Mouse button. Note that when you activate a macro via a keybinding, it treats it like a Left Mouse button click. The numbered buttons are: - 1 or LeftButton ... or any of the buttons remapped by the secure state headers. I don't know what this last bit means, to be honest, I'm simply quoting slouken. /cast [button:2,target=player] Flash Heal; [help] Flash Heal This macro would cast Flash Heal on a friendly target, OR if you clicked it with the right mouse button, it would cast Flash Heal on you. Focus /focus target ...will save your current target as your focus. This means that at any time you can use "/target focus" to target the unit you designated with "/focus target." Focus supports option parameters. Example macro: /cast [target=focus,exists] Polymorph If you want a random Polymorph This works like your "personal" raid icon which makes it easy to keep track of sheeps etc. Another useful example of using focus is a follow macro. Example: /focus [help] target /target focus /f this will focus on a friendly target and follow them, but if the target isn't friendly or there is no target it will follow your last target. Assist Focus Hover Targeting /cast [target=mouseover,exists] Healing Touch; Healing Touch This macro will cast Healing Touch on the party member whos unitframe is being hovered over by your mouse, regardless of your current target. This works with modifier keys and can do different stuff if you are not hovering over a unitframe. Macros have a 255 character limit, so the example here is not enterable. For illustration, however, here is an example of a more advanced macro: /cast [target=mouseover,exists,nomodifier:shift/ctrl/alt] Swiftmend; [target=mouseover,exists,modifier:shift] Healing Touch; [target=mouseover,exists,modifier:ctrl] Rejuvenation; [target=mouseover,exists,modifier:alt] Regrowth; [modifier:ctrl] Cat Form; [modifier:shift] Dire Bear Form; [noswimming] Travel Form; [swimming] Aquatic Form This macro would cast Swiftmend/Rejuvenation/Regrowth/Healing Touch if your mouse is hovering over a UnitFrame depending on which modifier keys you have pressed down. If your mouse, however, is NOT over a Unit Frame (but some other random place on the screen) it will shapeshift depending on the options you specified. In other words, you will technically have put all your standard healing spells and shapeshifts into a single button who acts differently depending on if your mouse is over a unitframe or not and depending on which modifier keys you use. Modifier This predates the conversion of the unit frames and action buttons to secure action buttons, so now it's easy to extend them to support modified clicks. /script PlayerFrame:SetAttribute("*type", "target"); ... etc. Shift click defaults to picking up actions from the action bar, so if you want to use the shift key, you'll need to explicitly enable it: /script ActionButton1:SetAttribute("shift-type", "action"); ... etc. It would be very easy to make an addon that does this for all of the unit frames and action buttons. In 2.0.2, the modified clicks work the same as unmodified clicks, but I wanted everyone to know how to do it themselves if they wanted to do it sooner. Remember that for key bindings, SHIFT-N and CTRL-N are already bound by default in the keybinding UI. Stance Options Each class has different numbers for it's stances. Here is a list of stances and their numbers: Stances Class: Warrior Priest Druid Rogue Shaman /cast [stance:1] <Battle Stance Ability>; [stance:2] <Defense Stance Ability>; [stance:3] <Berserker Stance Ability> Generic Stance Macro: Replace <* Stance Ability> with whatever you want. Paladin Auras are no longer treated as Stances by the Macro Option system. Keep in mind that if you skip a stance (like a Warrior who never does the Defensive Stance quest) then your stance numbers will drop down, i.e. Berserker Stance would be stance 2. Some stance examples. /cast [nostance] Bear Form If you are not in a form, this will shift you into bear form. /cast [stance:1] Overpower; [stance:2] Sunder Armor; [stance:3] Whirlwind Will cast Overpower in Battle stance, Sunder Armor in Defensive, and Whirlwind in Berserker stance /cast [stance:1] Growl; [stance:3] Claw /cast [nostance:3] Cat Form If you are not in a form, this will shift you into Cat Form. If you are currently in Cat form, this will NOT shift you out. Target Options Keep in mind that every spell has a default target of "target". So, for example: /cast [help] Greater Heal is the same as: /cast [target=target, help] Greater Heal Unless you add in a [target=unit] option, the default will be your current target. Possible examples of [target=unit]: /cast [target=player] Flash Heal This spell will always cast flash heal on yourself. Note that your current target will be unchanged. /cast [help] Flash Heal; [target=targettarget] Flash Heal This will cast Flash heal on your target if it is friendly, OR it will cast Flash Heal on your target's target. /cast [help, combat] Flash Heal; [help, nocombat] Greater Heal; [target=targettarget, help, combat] Flash Heal; [target=player] Greater Heal This will either 1) Cast flash heal if the target is friendly and you are in combat, 2) cast greater heal if the target is friendly and you are NOT in combat, 3) cast Flash Heal on your target's target if you are in combat and that unit is friendly, or if none of those conditions is true, it will cast Greater Heal on yourself. If you use the unitid "none" it acts as if you had NO target. For example: /cast [target=none] Dispel Magic This would cast Dispel Magic and then ask for a target, regardless of whom you have targetted currently. |
