April 28, 2007

Macro Commands and You

This list attempts to cover the most commonly used macro slash commands—excluding the /script command, which is out of the scope of this entry. A few are unlikely to be used in macros, but are included anyway for completeness and edification.

A number of commands may accept a unit id as a parameter. This lets you refer to a player or unit without hardcoding their name. Valid unit ids include:
  • player: You.
  • target: Your target.
  • pet: Your pet.
  • focus: Your focus.
  • mouseover: The player you are hovering your mouse over, either their interface representation or their character in-game.
  • party{1-4}: A specific member of your party (not including yourself).
  • raid{1-40}: A specific member of your raid (including yourself).
  • partypet{1-4}: The pet of a specific member of your party (not including your pet).
  • raidpet{1-40}: The pet of a specific member of your raid (including your pet).
You may also append target to any of these an indefinite number of times to refer to their targets. (For example, targettarget refers to your target's target.)

Also, italics around a parameter indicate that the parameter is optional.

Many commands allow you to specify conditions or options inside square brackets. Multiple conditions or options are seperated with commas. Valid conditions are:
  • actionbar:{1-6}: True if a specific action bar is currently active.
  • button:{1-5}: True if the macro was activated with a specific mouse button (activating from a keypress counts as button #1).
  • channeling: True if you are channeling a spell.
  • channeling:{spell}: True if you are channeling a specific spell.
  • combat: True if you or your pet is in combat.
  • dead: True if the command's target is dead.
  • equipped:{item type}: True if you have an item equipped of the specified type.
  • exists: True if the command's target exists.
  • flyable: True if you are in a zone where flying is allowed.
  • flying: True if you are on a flying mount or are in a flying form.
  • group: True if you are in a group.
  • group:{party/raid}: True if you are in a specific type of group.
  • harm: True if the command's target is hostile.
  • help: True if the command's target is friendly.
  • indoors: True if you are indoors.
  • modifier: True if you are pressing down a modifier key.
  • modifier:{shift/alt/ctrl}: True if you are pressing down a specific modifier key.
  • mounted: True if you are mounted.
  • outdoors: True if you are outdoors.
  • party: True if the command's target is in your party.
  • pet: True if you have a pet currently.
  • pet:{name/family}: True if your current pet has a specific name or is of a specific animal family.
  • raid: True if the command's target is in your raid.
  • stance: True if you are in a stance or are shapeshifted.
  • stance:{#}: True if you are in a specific stance or shapeshift form.
  • stealth: True if you are stealthed.
  • swimming: True if you are swimming.
If a condition has options, you can specify that the condition is true for multiple parameters by seperating them with a slash (/) character.

The only valid option is:
  • target={unit}: Specifies the command's target. This is used for all places where the "command's target" is referred to above, and it is used as the target of a command by several of the commands below. It may be a name or a unit id.
And now, the commands:

/assist [{conditions}] {player}
Assist a specified player if the conditions are satisfied, by name or unit id. If no player is specified, uses your current target.

/cancelaura [{conditions}] {buff name}
Cancels a beneficial buff on your character if the conditions are satisfied.

/cast [{options}] {action}; [{options}] {action}; …
Casts the first spell or uses the first item whose conditions are satisfied.

/castrandom [{options}] {action 1}, {action 2}, …; [{options}] {action 1}, {action 2}, …; …
Casts a random spell or uses a random item from the first list whose conditions are satisfied.

/castsequence [{options}] reset={reset conditions} {action 1}, {action 2}, …; [{options}] reset={reset conditions} {action 1}, {action 2}, …; …
Casts a spell or uses an item from the first sequence whose conditions are satisfied. Starts at the beginning of the list and uses each consecutive spell or item, one at a time. It will only advance to the next spell or item if the prior one was used successfully. Upon reaching the end, restarts at the beginning. Also restarts if any of the reset conditions are satisfied. The reset options are:
  • {number}: Restart after this many seconds from the first cast have elapsed.
  • target: Restarts if your target changes.
  • combat: Restarts every time you enter combat.
  • shift: Restarts if you activate the sequence while holding down Shift.
  • alt: Restarts if you activate the sequence while holding down Alt (Option on a Mac).
  • ctrl: Restarts if you activate the sequence while holding down Control.
/concede
Surrender to the player you are currently dueling.

/changeactionbar [{conditions}] {bar}
Switches to a specified action bar (numbered from 1 to 6) if the conditions are satisfied.

/dismount [{conditions}]
Dismounts from your mount if the conditions are satisfied.

/duel {player name}
Challenge a player to a duel, by name. If no name is specified, uses your current target.

/equip [{conditions}] {item name}
Equips a specified item if the conditions are satisfied.

/equipslot [{conditions}] {slot number} {item name}
Equips a specified item into a specific slot if the conditions are satisfied. For slot numbers, see /use, below.

/focus [{conditions}] {unit}
Uses a specified player or unit as your focus if the conditions are satisfied, by name or unit id. If no player is specified, uses your current target.

/clearfocus [{conditions}]
Clears your focus if the conditions are satisfied.

/follow {player}
/f {player}
Starts following a specified player, by name or unit id. If no player is specified, uses your current target.

/friend {player name}
Adds a specified player to your friends list, by name. If no player is specified, opens the Friends frame.

/removefriend {player name}
/remfriend {player name}
Removes a specified player from your friends list, by name.

/ignore {player name}
Adds a specified player to your ignore list, by name. If no player is specified, opens the Ignore frame.

/unignore {player name}
Removes a specified player from your ignore list, by name. If no player is specified, opens the Ignore frame.

/inspect {player}
/ins {player}
Inspects a specified player, by name or unit id. If no player is specified, uses your current target.

/invite {player}
/i {player}
Invites the specified player to a group, by name or unit id. If no player is specified, uses your current target.

/uninvite {player}
/u {player}
Removes the specified player from your group (if you are the leader or a raid assistant), by name or unit id. If no player is specified, uses your current target.

/petaggressive [{conditions}]
Switches your pet to Aggressive mode if the conditions are met.

/petattack [{conditions}]
Orders your pet to attack if the conditions are met.

/petautocaston [{conditions}] {ability}
Activates autocast on a specific pet ability if the conditions are met.

/petautocastoff [{conditions}] {ability}
Deactivates autocast on a specific pet ability if the conditions are met.

/petdefensive [{conditions}]
Switches your pet to Defensive mode if the conditions are met.

/petfollow [{conditions}]
Orders your pet to follow you if the conditions are met.

/petpassive [{conditions}]
Switches your pet to Passive mode if the conditions are met.

/petstay [{conditions}]
Orders your pet to stay where it is if the conditions are met.

/promote {player name}
/pr {player name}
If you are the current group leader, promotes a new player to group leader, by name.

/pvp
Toggles your PvP flag.

/readycheck
If you are the group leader, perform a ready check.

/startattack [{conditions}]
Activates melee autoattack if the conditions are satisfied.

/stopattack [{conditions}]
Deactivates melee autoattack if the conditions are satisfied.

/stopcasting [{conditions}]
Stops any spellcasting if the conditions are satisfied. Has the side effect of allowing you to cast another spell in the same macro afterwards, if none of the spells you've already cast invoke the global cooldown.

/stopmacro [{conditions}]
Immediately stops execution of the macro if the conditions are met.

/swapactionbar {bar 1} {bar 2}
Specify two action bar numbers (from 1 to 6). Toggles between the two action bars. If neither are currently activated, switches to the first one specified.

/target [{conditions}] {player}; [{conditions}] {player}; …
Targets the first player whose conditions are satisfied, by name or unit id.

/cleartarget [{conditions}]
Clears your target if the conditions are satisfied.

/targetenemy [{conditions}] {reverse}
Cycles through nearby hostile players or units. If the parameter is 1, cycles in reverse order.

/targetfriend [{conditions}] {reverse}
Cycles through nearby friendly players. If the parameter is 1, cycles in reverse order.

/targetparty [{conditions}] {reverse}
Cycles through nearby players in your party. If the parameter is 1, cycles in reverse order.

/targetraid [{conditions}] {reverse}
Cycles through nearby players in your raid group. If the parameter is 1, cycles in reverse order.

/use [{options}] {item name}
/use [{options}] {inventory item number}
/use [{options}] {bag id} {slot number}
Uses an item by name, in a specific inventory slot (equipped on your character), or in a bag. Useful inventory slot numbers:
  • 1: Helm.
  • 2: Necklace.
  • 3: Shoulder slot.
  • 5: Chest armor.
  • 6: Belt.
  • 7: Pants.
  • 8: Boots.
  • 9: Bracers.
  • 10: Gloves.
  • 11: Upper ring slot.
  • 12: Lower ring slot.
  • 13: Upper trinket slot.
  • 14: Lower trinket slot.
  • 15: Cloak.
  • 16: Main-hand weapon.
  • 17: Off-hand weapon/shield.
  • 18: Ranged weapon/Relic.
Bags are numbered right-to-left, starting with 0 for the backpack and 1-4 for your other bags.

/userandom [{options}] {item 1}, {item 2}, …; [{options}] {item 1}, {item 2}, …; …
As /castrandom, above, except it can only use items and you can specify items as you can in /use.

If there are any inaccuracies or glaring omissions, please let me know!