Macro Scripting in World of Warcraft
Creating a Macro
Macros allow you to create special commands that you can do at the touch of a button.
- Type /macro or click on the talk button and select macro. A box will pop up with your current macros.
- Click on "New" at the bottom of that box. Another box will pop up, with a place to enter the macro name and a choice of an icon for the macro.
- Name your macro. Select a name that will make sense to you when you see it again.
- Select an icon.
- Select "Okay" - You should now see the icon you selected along with your icon name in your current macros box.
- Now Left-Click on the icon to highlight it. There is a button there to change the name or icon for your macro if you later decide to rename it or select a different icon.
- Once your icon is highlighted, move your mouse pointer into the "Enter Macro Commands" box. This is where you can type what you want the button to do when you press it. You will need to add a "/" in front of the command, if it is a slash command, just as you would enter in your text entry box.
- Type "{Your Macro Here}".
- Move your mouse pointer back over the icon and left-click and hold down the button over the icon.
- Now, drag the icon over to an empty slot on your action bar.
To use your new macro icon, press the number associated with that action button, or right-click on the button itself.
Finishing Macros
When you are done editing or creating macros, click the "x" in the top right-hand side of the box to close the macro window.
Editing Existing Macros
Type /macro then left-click on the macro button you wish to change. You can now make changes in the "Enter Macro Commands" box. Click the "x" to close the macro box when you are done.
Macro Limit
There is a character limit of 255 for each macro you create.
Other Information
You can use "%t" in your macro text to insert the targeted monster, creature, player that you wish to be inserted in your sentence. For example, "/say Hi %t" will say "Hi Dredlom" if you have the player Dredlom selected.
/cast allows you to cast spells by name. Type /cast (spell subtext) - Example: "/cast Fireball (Rank 1)". To add spell casting to a macro you can type it manually, or shift-click a spell in your spell book to add the proper /cast line to the macro.
"Self Bandage Macro"
This script allow you to bandage your self with one press.
/target {YourNameHere};
/script UseContainerItem(3,3);
/script TargetLastEnemy();
[FOR THIS SCRIPT TO WORK]
1. Requires edit of script. {YourNameHere}
2. Put your bandage at bag number 3 slot 3
"2hand --> 1hand + shield"
This script allows you to change from a two hand weapon to one hand weapon and off hand weapon combo.
/script PickupInventoryItem(16);
/script PickupContainerItem(3,1);
/script UseContainerItem(3,2);
/script UseContainerItem(3,3);
[FOR THIS SCRIPT TO WORK]
1. Put 2hand weapon at bag3, slot1
2. Put shiled at bag3, slot2
3. Put 1hand at bag3, slot3
"1hand + shield --> 2hand"
This script allows you to change from a one hand weapon and off hand weapon combo to a two hand weapon.
/script PickupInventoryItem(16);
/script PickupContainerItem(3,3);
/script PickupInventoryItem(17);
/script PickupContainerItem(3,2);
/script UseContainerItem(3,1);
[FOR THIS SCRIPT TO WORK]
1. Put 2hand weapon at bag3, slot1
2. Put shiled at bag3, slot2
3. Put 1hand at bag3, slot3
"One Button: Weapon Change"
This script allows you to change from a two hand weapon to one hand weapon * off hand weapon combo. And back again.
/script PickupInventoryItem(17);
if(CursorHasItem()) then PickupContainerItem(4,2);
PickupContainerItem(4,1);
PickupInventoryItem(16);
else PickupContainerItem(4,1);
PickupInventoryItem(16);
PickupContainerItem(4,2);
PickupInventoryItem(17);
end
[FOR THIS SCRIPT TO WORK]
1. Put 2hand weapon in Inventory
2. Put 1hand at bag4, slot1
3. Put offhand at bag4, slot2
"Faster Quest Text"
Makes the quest text scribble in faster.
/script setglobal("QUEST_DESCRIPTION_GRADIENT_CPS",600000);
/script DEFAULT_CHAT_FRAME:AddMessage("Quests are now SUPER SPEEDY!");
Makes the quest text scribble return to normal speed.
/script setglobal("QUEST_DESCRIPTION_GRADIENT_CPS",40);
/script DEFAULT_CHAT_FRAME:AddMessage("Quests are now regular speed!");
[FOR THIS SCRIPT TO WORK]
1. No Modification needed
"Casting Call"
The macro below will let your party know whom you’re targeting for an attack or heal.
/p I’m casting {name of CAST} on %t!;
/cast {name of CAST};
/script TargetLastEnemy();
[FOR THIS SCRIPT TO WORK]
1. Requires edit of script. {name of CAST}
"Fast Bags"
Open/Close ALL bag slots.
/script ToggleBag(0);
/script ToggleBag(1);
/script ToggleBag(2);
/script ToggleBag(3);
/script ToggleBag(4);
[FOR THIS SCRIPT TO WORK]
1. No Modification needed
"Fast Hotbar"
Switching Hotbars with a macro.
/script CURRENT_ACTIONBAR_PAGE = {X};
/script ChangeActionBarPage();
[FOR THIS SCRIPT TO WORK]
1. Requires edit of script. {X}
"Semi-Track"
Not a Hunter? this macro will semi track a names beast.
/target {BEAST}
[FOR THIS SCRIPT TO WORK]
1. Requires edit of script. {BEAST}
"UI Mem Usage"
Needing to know how much memory all your UI additions are using? this macro will tell you just that.
/script DEFAULT_CHAT_FRAME:AddMessage("Memory used by user interface: " .. floor(gcinfo()/102.4)/10 .. " MB");
[FOR THIS SCRIPT TO WORK]
1. No Modification needed
"Set Assist"
An semi-auto changing assist button.
/script if (UnitName("target") ~= nil) then EditMacro(1, "Assist "..UnitName("target"), nil, "/assist "..UnitName("target"), 1) end
/script SaveMacros()
[FOR THIS SCRIPT TO WORK]
1. Create a macro in the first slot, basically to reserve that slot and choose an icon. This will be the assist button.
2. Then create this macro, Set Assist.
3. Now when you hit Set Assist, it will edit the first macro to be named "Assist (Target)" and edit the macro"s text to "/assist (Target)".
4. So to use: simply target who the assist is going to be, hit set assist, and you can keep using the same assist button. The assist name won"t change until you set assist again.
"Global Variables"
Set Variable.
/script setglobal("{variable name}","{string}");
[FOR THIS SCRIPT TO WORK]
1. Requires edit of script. {variable name} & {string}
Call Variable.
getglobal("{variable name}")
[FOR THIS SCRIPT TO WORK]
1. You must initialize the variables each time you enter a realm.
Exemples:
Macro initializer:
/script setglobal("HT1","Healing Touch(Rank 3)"); setglobal("HT2","Healing Touch(Rank 4)"); setglobal("RJ","Rejuvenation(Rank 4)");
An exemple of variable usability:
/script if (UnitName("target") ~=nil and UnitInParty("target")) then CastSpellByName(getglobal("RJ")) else TargetUnit("player")
CastSpellByName(getglobal("RJ")) end; TargetLastEnemy();
"Pet Attack"
Don"t like using CTRL-1 to make pet attack, make macro.
/cast Hunter"s Mark(Rank 1)
/script PetAttack();
[FOR THIS SCRIPT TO WORK]
1. No Modification needed
"Pet Pull"
Pet pulls nearest enemy.
/script TargetNearestEnemy();
/cast Hunter"s Mark(Rank {X})
/p Pulling %t
/script PetAttack();
[FOR THIS SCRIPT TO WORK]
1. Requires edit of script. {X}
"Feed Pet"
The macro below will take whatever item that is in slot #1 of your 4th bag (the one all the way left) and feed it to your pet.
/script if (not PlayerFrame.inCombat) then
if (not GetContainerItemLink(4, 1)) then
OpenBag(4); else CastSpellByName("Feed Pet");
PickupContainerItem(4, 1); end end
[FOR THIS SCRIPT TO WORK]
1. Food item has to be located in bag4, slot1
The following macros are designed for usage in BOTH Defensive and Battle stance. The macro will "LIGHT UP" if you click the appropate hotkey, if you are in the correct stance, it will use the ability, if not it will swap you to the correct stance. Hitting the button again will then activate the ability. For example, if you are in battle stance and need to taunt, double tap the taunt macro and it will swap to battle and then taunt.
"Taunt"
This macro checks for defensive stance - GetShapeshiftFormInfo(2) - If in stance it casts taunt, if not it swaps the stance.
/script texture,name,isActive,isCastable = GetShapeshiftFormInfo(2);
if isActive then CastSpellByName("Taunt()");
else CastSpellByName("Defensive Stance()");
end;
[FOR THIS SCRIPT TO WORK]
1. No Modification needed
"Execute"
This macro checks for battle stance - GetShapeshiftFormInfo(1) - If in stance it casts execute, if not it swaps the stance.
/script texture,name,isActive,isCastable = GetShapeshiftFormInfo(1);
if isActive then CastSpellByName("Execute(Rank 4)");
else CastSpellByName("Battle Stance()");
end;
[FOR THIS SCRIPT TO WORK]
1. No Modification needed
"Overpower"
This macro checks for battle stance - GetShapeshiftFormInfo(1) - If in stance it casts overpower, if not it swaps the stance.
/script texture,name,isActive,isCastable = GetShapeshiftFormInfo(1);
if isActive then CastSpellByName("Overpower(Rank 3)");
else CastSpellByName("Battle Stance()");
end;
[FOR THIS SCRIPT TO WORK]
1. No Modification needed
"Charge"
This macro checks for battle stance - GetShapeshiftFormInfo(1) - If in stance it casts charge, if not it swaps the stance.
/script texture,name,isActive,isCastable = GetShapeshiftFormInfo(1);
if isActive then CastSpellByName("Charge(Rank 3)");
else CastSpellByName("Battle Stance()");
end;
[FOR THIS SCRIPT TO WORK]
1. No Modification needed
"Revenge"
This macro checks for defensive stance - GetShapeshiftFormInfo(2) - If in stance it casts revenge, if not it swaps the stance.
/script texture,name,isActive,isCastable = GetShapeshiftFormInfo(2);
if isActive then CastSpellByName("Revenge(Rank 4)");
else CastSpellByName("Defensive Stance()");
end;
[FOR THIS SCRIPT TO WORK]
1. No Modification needed
"Disarm"
This macro checks for defensive stance - GetShapeshiftFormInfo(2) - If in stance it casts disarm, if not it swaps the stance.
/script texture,name,isActive,isCastable = GetShapeshiftFormInfo(2);
if isActive then CastSpellByName("Disarm()");
else CastSpellByName("Defensive Stance()");
end;
[FOR THIS SCRIPT TO WORK]
1. No Modification needed