Macro Examples


Back to Macro / Slash Commands Basics

Thanks to Xerin, Lynk, and other contributors to WoWwiki for these cream-of-the-crop World of Warcraft macros.

Note: Sorry about the crazy page stretch, but it's to prove a point: macros that appear on a single line must be entered on a single line to work properly.


Self-Cast (Without Losing Her Target)

/script CastSpellByName('Holy Light', 1)

This variant will cast a spell on the ally targeted. If no ally is targeted or an enemy is targetted, this macro will cast the spell on yourself.

/script if (UnitIsFriend("player", "target") ) then CastSpellByName("Mark of the Wild") else CastSpellByName("Mark of the Wild", 1); end

 

Slip-Targeting Casts

The following macro allows you to target a group position (party1 through party6, left to right) with a commonly used spell (such as a heal or buff), then automatically returns targetting focus to the previous enemy.

/script TargetUnit("party1") /cast Flash Heal /script TargetLastTarget()

 

"Smart Buffing"

This macro recognizes whether or not an ally has a particular buff already active. If so, the macro casts another buff. If not, the macro casts the original spell.

/script i=1;m=0;while(UnitBuff("target",i)~=nil) do if(strfind(UnitBuff("target",i),"Regeneration")~=nil) then m=1; end;i=i+1;end; c=CastSpellByName; if(m==1) then c("Mark of the Wild(Rank 10)");else c("Thorns(Rank 10)");end;

 

Healing Macros

The following macro checks a group mate for health below a certain threshold (in this case 0.7 or 70%), and casts a healing spell accordingly. Continuing to trigger this macro steps through the entire group or raid (up to 40 people).

/script for i=1,40 do TargetNearestFriend(); if UnitHealth("target")/UnitHealthMax("target") < 0.7 then if UnitIsPlayer("target") then CastSpellByName("Lesser Healing Wave") end end end; TargetLastEnemy();

 

Self-Bandaging

This macro offers an improvement on the default method of hotbar bandaging in that this will always self-bandage no matter who's targeted.

/script p="player";t="target";if(not UnitCanAttack(t, p))then ot=UnitName(t);TargetUnit(p);else ot=nil;end;UseAction(ActionID);if(SpellIsTargeting())then SpellTargetUnit(p);end if(ot) then TargetByName(ot);end



Item Macros

 

Equipping From Inventory

All of your inventory item slots have a sort of physical address, given as bag / slot or, for example (3, 10). Bag (0-4, left to right) is which bag the item is found in on the hotbar. Slot is given as 1-20, left to right, top to bottom.

/script PickupContainerItem(bag, slot);

 

Quickly Applying Stones to Weapons

This macro allows you to programmatically apply sharpening or weight stones to your primary weapon, just set the stone location in your inventory. (To apply these enhancements to your secondary weapon, change the 16 to 17).

/script UseContainerItem (#,#); /script PickupInventoryItem (16);

 

User Interface

The following macro clears your user interface, useful if it breaks or gets buggy during the course of play.

/script clearui

 

Jump to Low-Res

If you're ever in a raid or instance situation and your system is dragging (or maybe you're getting some Orgrimmar or Ironforge lag), this is a quick macro that will lower the biggest performance-hogging settings. Experiment with a separate macro to restore your settings to what you're used to (max is 777,2,1).

/z SetFarclip(177)
/z SetWorldDetail(0)
/z SetBaseMip(0)


Combat

Here's an assist macro, courtesy of Lynk - Gilneas on the WoWwiki. Target your tank, then hold [alt] while activating the macro. Then clicking the macro again will have you target whatever that player is attacking. Simple and effective, and no more picking through the dog pile only to attack the wrong mob and earn yourself all the threat.

Assist main tank

/script if (IsAltKeyDown() and UnitIsFriend("player","target")) then MT=UnitName("target"); DEFAULT_CHAT_FRAME:AddMessage('MT Set: ['..MT..']'); elseif (MT ~= nil) then AssistByName(MT); else DEFAULT_CHAT_FRAME:AddMessage('Set MT Noob!'); end;

Totem Killer

A simple macro to target and use (hopefully) a low-mana, quick cast spell to whack-a-mole those totems. Substitute /shoot for the /cast line to use a wand instead.

/target Totem

/cast Moonfire(Rank 1)

Pet Macros

Here's a list of pet macros:

/script PetAggressiveMode();

/script PetDefensiveMode();

/script PetPassiveMode();

/script PetFollow();

/script PetAttack();

/script PetStopAttack();

/script CastPetAction(X);

Where X is the action on the pet bar: 1, 2, 3, etc.

 

Report Quest Progress to Group

This macro lets your group know how close you are to completion on your active quest. There's no need to type it all out anymore!

/script i = GetNumQuestLeaderBoards(); for j = 1, i, 1 do a1, a2, a3 = GetQuestLogLeaderBoard(j); SendChatMesssage(a1, "PARTY"); end;

 


Back to Macro / Slash Commands Basics


To read the latest guides, news, and features you can visit our World of Warcraft Game Page.

Last Updated: Mar 13, 2016

About The Author

Jeff joined the Ten Ton Hammer team in 2004 covering EverQuest II, and he's had his hands on just about every PC online and multiplayer game he could since.

Comments

Related Content

Patch 5.4 Profession Changes