How to make a macro

kingslayer's picture

First, how is made a macro?

1) Ingame, type "/macro" or "/m" to open up the macro menu. Now you have 2 macro tabs. "General" and "YourCharacterName" macro. You can have up to 36 general macros that are shared between all your characters on the server and up to 18 macros only for your character.
2) Select the appropriate tab and click on "New" button at bottom right of the window.
3) Now you you must enter a name for your macro and choose an icon. You can select a colorful icon that will always show up or the "?" icon that will change depending of the "active" spell.
4) Click on "Okay" button.
5) Select the new macro in the list and click in the text area at bottom of the window. Macros can be up to 255 characters long (but there is a way to bypass this, see /click command).

Now, how does a macro work?

Macros are fairly simple. They are made of 3 parts:

- Command
- Conditions
- Object (Spells/Abilities/Items)

It starst with a "/" followed by a command, then conditions (separated by a ",") in between "[ ]", then the name of the spell. If there is more than one spell you want to cast with the same command, you separate their conditions/spell with a ";".
You can have more than one set of conditions for each spell, so if the first set of conditions are not true, it will check the 2nd set, then third, etc. If none are true, it will then go the next spell (if there is one) and check conditions the same way.
Do not add a ";" at the end of the macro, it would just cause bugs.

Might sound complicated, so here is a pattern and an example:
/command [condition1_1,condition1_2,condition1_3][condition2_1][condition2_2] Spell1; [condition1_1,condition1_2][condition2_1] Spell2
/cast [harm,nodead] Smite; [help,nodead][@player] Renew
(will cast Smite if your target is hostile and alive else will cast Renew if your target is friendly and alive, else will cast it on you)

Note: A macro will always read condition set in order. If the first spell condition is met, it will cast that spell, no matter what conditions are after.
Comon mistake made by people is to break down their conditions.
Example:
/cast [mod:shift][@mouseover] Power Word: Shield; [@mouseover] Renew
This is bad because now PW:S and Renew both have same condition (@mouseover), so PW:S will always be cast and Renew will never.
What he wanted to do was
/cast [mod:shift,@mouseover] Power Word: Shield; [@mouseover] Renew
Macro facts:

- Macro can't pause.
- Macro can't check for buff/debuff.
- Macro can't check for rage/energy/mana/focus/runic.
- Macro can't check for cooldowns.
- Macro can't play the game for you.

Toggleable Abilities
You can add a "!" in front of a spell name to prevent it from toggling off.
Example: /cast !Ice Block (will prevent you from turning off Ice Block if it is already active).

Spell Rank
By default a macro will cast the last rank of a spell. But you can add "Spell(Rank X)" to cast rank X of a spell.
Exception: Spell with "()" in their name require you to add "()" after the name.
Example: "Faerie Fire(Feral)()" because "Faerie Fire(Feral)" would confuse the game and it would try to cast "Faerie Fire" of rank "Feral" /duh.

scripting
This is using some API functions used by addons as macro. This is more advanced programming and I wont talk about it in this guide. The command is either /run or /script
Example: /run if(ShowingHelm()) then ShowHelm(0) else ShowHelm(1) end
This script will hide your helm if it is displayed, else will make it to show up.

Comments

kingslayer's picture

four part

These are, of course, suggestions; but, I'm going to phrase them as commands so that I can save on words. This is from the top down, so I'm not going to give much context information.

*
Mention that /m is an alias for /macro.
*
You can have up to 36 general macro>s<
*
right of the window>.<
*
>colorful< icon
*
depending >on< the "active" spell
*
Macro>s< can be up to 255 >characters< long
*
Don't mention "(but there is a way to bypass this)" unless you're going to explain it. Most stuff that is longer than 255 characters should be an addon anyway.
*
- >Actions< (Spells)
I'd say "action" is a better way to abstract the non-command, non-condition portion of a macro than "parameter".
*
It start>s< >with< a "/" followed by >a< command, then conditions, >separated< by a "," >in brackets ("[ ]")<, then >the< name of the spell.
*
you separate their conditions/spell >with< a ";".
*
so if the first set of condition>s< are not true, it will check the >second< set, then third, etc.
*
Do not add a ";" at the end of the macro, it would just cause bugs.
Does it? What bugs?
*
Might sound complicated, so here are two examples:
The first isn't really an example, it's a generic pattern. The second is an example.
*
Your order example is missing a quote block.
*
What Macros & Addons >Can't Do Macros >can't< play the game for you.
I suggest you >< read this thread to know what macros >can't< do.
*
Toggleable >Abilities<
*
You have an extra space after the toggleable heading.
*
to prevent it >from toggling off.<
*
I would use something like Heroic Strike or Maul as an example for the toggleable ability instead of Ice Block.
*
You're missing the quote block for the toggleable example.
*
(will prevent you >from turning< off Ice Block if >it is already active.<)
*
macro will cast >the< last rank
*
Spell with "()" in their name require you to add "()" after the name.
I would rephrase to: "Spells with parentheses in their name require you to add an empty set of parentheses after the name to auto-select the last rank."
*
You have a colon after the scripting heading but not after any of the others.
*
There are lots of other contractions missing their apostrophe; I won't mention those anymore.
*
This script will hide your helm if it is displayed, else will make it to show up.
Rephrase: This macro will toggle the display of your helm.
*
#show just shows the icon (if the ? is selected) with the name of the macro as the tooltip. #showtooltip shows the icon and the tooltip.
*
/assist does the same thing as /target targettarget, as well, which makes a bit more sense if you consider it via UnitIds.
*
/cancelform with no parameter will cancel whatever form you're in.
*
Missing "Example:" before your castsequence example.
*
Separated is spelled with an "a".
*
"aka" means Also Known As. You probably want "i.e." which means Id Est, "That Is" -- indicates a clarification.
*
The past tense of "cast" is "cast". Good old English.
*
You're often inconsistent with your period usage. Sometimes it's at the end of lines and sometimes it isn't. e.g. "...not after when the last spell was casted." vs. "when you leave combat".
*
/petaggressive has two Gs.
*
attack >the< nearest target or stop >attacking<.
*
make you stop >casting< any spell you were casting.
*
English uses the gerund form of the verb in that case instead of the infinitive. Not like, "Elle cesse d'attaquer."
*
I didn't know you could say /targettargettarget target to get your target's target's target. That's very odd. Are you sure?
*
If you add empty >bracket<, it will make the spell >perform its default action<.
*
4+ >depends on< your mouse
*
You can add pet and the pet suffix to your list of UnitIds.

Voila. I got tired of pointing out little stuff, so I missed some of them. I think I caught most of the rest. Your formatting style is not how I would do it, but I didn't make the post, you did Smiling. Also, I agree that you should use the [pre] tag.

kingslayer's picture

third part

Note: You can add "no" before a condition to have its opposite. Example "nocombat" means when not in combat.
Note: Every condition set must be inbetween "[ ]" and every conditions of a set must be seperated by a ",".
Note: Every conditions of a set must be "true" for the set to be considered true. Else it moves to next condition set.
Note: When a condition have a ":", you can add multiple parameters by separating them with a "/". Example "form:1/3" will check if you are in form 1 or 3.
[]
If you add empty bracket, it will make the spell to perform its default action.
actionbar:#
bar:#
If actionbar # (between 1 and 6) is active as your main bar.
bonusbar:5
If the possess bar is active (controlling a vehicle or another player)
button:#
btn:#
If the macro is activated with the given mouse button. Button 1 is left, 2 is right, 3 is middle(scroll), 4+ depends on your mouse.
channeling
channeling:
If you are channeling
combat
If you are in combat
dead
If target is dead
equipped:
worn:
If item type is equipped

List of item type:

Armor:
Cloth, Leather, Mail, Plate, Shields, Librams, Idols, Totems, Armor, SlotName
Example: [equipped:Shoulder] or [equipped:Armor] or [equipped:Plate]

Weapon:
Bow, Crossbow, Dagger, Gun, Fishing Pole, Fist Weapon, Miscellaneou, One-Handed Axe, One-Handed Mace, One-Handed Sword, Polearm, Stave, Thrown, Two-Handed Axe, Two-Handed Mace, Two-Handed Sword, Wand, One-Hand, Two-Hand, Weapon
Example: [equipped:Dagger] or [equipped:Two-Hand] or [equipped:Weapon]
exists
If the target exists. Some conditions, like "harm" and "help" imply "exists".
flyable
If the zone you are in allow to fly (not that if YOU can fly). Do not check if Wintergrasp battle is going on or not.
flying
If you are mounted or in flight form and in the air.
group:party/raid
If you are in a party/raid
harm
If target is hostile (can cast damage spell on it)
help
If target is friendly (can cast healing spell on it)
indoors
If you are indoors
modifier:shift/ctrl/alt
mod:shift/ctrl/alt
If you are holding the specified modifier.
mounted
If you are mounted
outdoors
If you are outdoors
party
If target is in your party
pet
pet:
If your pet is active. Can specify the name or the type (Cat, Bear, Devilsaur, etc).
raid
If target is in your raid
spec:#
If you are in the specified spec (1 or 2) if you have Dual Spec.
stance:#
form:#
If you are in the specified stance number. It follow the order of your stance/form bar.
stealth
If you are stealthed
swimming
If you are swimming.
target=
@
Note: "@" will only be avaible in patch 3.3
Add one of the following as :
mouseover = target model/panel under your mouse cursor
target = your current target.
targettarget = target of your target (add as many target as you want to go as far in target of target of target of etc as you want)
lasttarget = target your last target
pet = target is your pet.
pettarget = target is your pet's target.
focus = target your focus
party/raid# = will target party/raid member number #.
= to target a specificate target
player = yourself

Note: target=target is optional. Example: [target=target, help,nodead] is the same as [help,nodead].
Note: There is no "notarget" option, but a way to go around it is to use "noexists".
Warning: target is not a real condition. It only serve to assign a target.

kingslayer's picture

second part

Here is the (long) list of all commands available in WoW:

Note: It is possible to add conditions between the /command and parameters.
Note: form/stance stand for druid forms, warrior stance, DK presence, rogue stealth, priest shadowform, etc.
#show
#showtooltip
If "?" icon is selected, will show the "active" spell icon. When you mouse over the macro icon, #show will show only the name of the spell as tooltip while #showtooltip will show the whole tooltip. You can add conditions like a macro to show different spells.
/assist
Does the same thing than "/target targettarget" (see /target). You can add a name as parameter to target the target of a specific target.
/cancelaura
You must add a buff name as parameter. It will cancel the buff, just like right-clicking would do it.
/cancelform
You can add a form/stance name as parameter. It will make you leave the form/stance (doesnt work for warrior). If no parameter is added, will make you leave any form/stance you are into.
/cast
The main command of macros.
Example: /cast [conditions] Spell1; [conditions] Spell2
/castrandom
Same as /cast but will cast random spell among a list (separated by ",").
Example: /castrandom [conditions] Spell1, Spell2, Spell3, Spell5;[conditions] Spell1, Spell3, Spell4, Spell6
/castsequence
Same as /cast but will cast spell one after another in a sequence each time you use the macro. You can add reset conditions to make it restart at beginning.
Example: /castsequence [conditions] reset=alt/ctrl/combat Spell1, Spell2, Spell3; [conditions] reset=n/shift/target Spell2, Spell4, Spell5

You can add any of these after "reset=" separated by "/":
n = number of seconds macro will reset after last time macro was called (i.e. when you pressed/clicked/pushed/poked/spammed macro) and not after when last spell was cast.
target = when you change target
combat = when you leave combat
shift,alt,ctrl = when you activate the macro with specified modifier pressed (not just by pressing the modifier)
/changeactionbar #
You must add an actionbar number as parameter. Allow you to change your main actionbar to the specified bar.
/clearfocus
Clear your focus (see /focus).
/cleartarget
Clear your target (make you target nothing).
/click
Simulate a click on a specific action button. Allow you to chain macros.
Example: /click [conditions] MultiBarBottomLeftButton7

Bar name list:

ActionButton#: Main Bar
BonusActionButton# : Dynamic bar that switches based on form/stance (do same thing than ActionButton#)
MultiBarBottomLeftButton#: Bottom Left Bar
MultiBarBottomRightButton#: Bottom Right Bar
MultiBarRightButton#: Right Bar
MultiBarLeftButton#: Right Bar 2 (to the left of "Right Bar")
PetActionButton#: Pet Bar
ShapeshiftButton#: form/stance bar
/dismount
Dismount you.
/equip
You must enter an equipable item as parameter. Will equip it to default slot (main hand, first ring, first trinket).
/equipslot #
You must enter a slot number and an equipable item as parameter. Will equip an item to the specified slot number.
Example: /equipslot [conditions] 17 OffHandItemName

Here is the list of slots:

[ 1 ] . . . . . . . . . . . . . [ 10 ]
[ 2 ] . . . . . . . . . . . . . . [ 6 ]
[ 3 ] . . . . . . . . . . . . . . [ 7 ]
[ 15 ] . . . . . . . . . . . . . [ 8 ]
[ 5 ] . . . . . . . . . . . . . [ 11 ]
[ 4 ] . . . . . . . . . . . . . [ 12 ]
[ 19 ] . . . . . . . . . . . . [ 13 ]
[ 9 ] . . . . . . . . . . . . . [ 14 ]
[ 16 ] . [ 17 ] . [ 18 ] <- [ 0 ]

0 = ammo
1 = head
2 = neck
3 = shoulder
4 = shirt
5 = chest
6 = belt
7 = legs
8 = feet
9 = wrist
10 = gloves
11 = finger 1
12 = finger 2
13 = trinket 1
14 = trinket 2
15 = back
16 = main hand
17 = off hand
18 = ranged
19 = tabard
/equipset
You must enter name of an armor set as parameter. Name are the one you have set in equipement manager.
Example: /equipset [conditions] SetName
/focus
Set your current target as your focus if no parameter is added. You can add a name as parameter to focus a specific target.
/petaggressive
/petdefensive
/petpassive
Set your pet to agressive, defensive or passive
/petattack
/petfollow
/petstay
Make your pet to attack, follow or stay
/petautocastoff
/petautocaston
/petautocasttoggle
You must enter a pet spell as parameter. Will set the autocast to off, on or will toggle between on/off.
/startattack
/stopattack
Will make you to auto attack the nearest target or stop attacking.
/stopcasting
Will make you stop casting any spell you were casting
/stopmacro
Will make a macro to not go further if the conditions are met.
/swapactionbar # ##
Will make you swap between action bar # and ## (see /changeactionbar).
/target
You must enter a name of a target as parameter. Make you to target the closest name specified target ("Rag" would target "Rag" as well as "Raging", "Rager", "Ragwhatever"). You can add as many "target" as you want to select target of target of target of... etc.
Example: /target targettargettarget Bob (will target the target of the target of Bob)
/targetexact
You must enter a name of a target as parameter. Same as above, but if specified name do not exist or is near you, your target wont be changed ("Rag" will only target "Rag" and nothing else).
/targetenemy
/targetfriend
Will cycle next enemy/friend target (equivalent of Tab/Ctrl+Tab by default). Add a "1" as parameter to cycle backward.
/targetenemyplayer
/targetfriendplayer
Same as above, but will only target players. (Will pass on NPCs, minions, pet, etc). Add a "1" as parameter to cycle backward.
/targetparty
/targetraid
Same as above, but will only target party/raid members. Add a "1" as parameter to cycle backward.
/targetlasttarget
Will target last target you had selected. If you had none, it will do nothing.
/use
Samething as /cast.
/usetalents #
Will active either primary (# = 1) or secondary (# = 2) talent build if you have Dual Spec.
/userandom
Same as /castrandom.