1. Introduction To Macros
Ok to start with, for those who are completely new to the term and haven't got a clue what I am refering to, there is a function in wow that allows you to create Macros (to access this functionality simply type /macro into your chat window, this will bring up the Macro interface). The UI in wow works off of the LUA Programming code and as such the Macro's used adhere to the same structure and syntax as LUA. For those of you who are familiar with LUA you should find this relatively simple and will probably only need to familiar yourself with the wow Application Program Interface (API). To find a complete list of all the wow Function Commands this site will be your best resource //www.wowwiki.com
For those who are not at all familiar with LUA or Macro's in general the following guide will go through most of the commands that you will want to use as a Warrior and how to use them.
Please note, This Guide is intended for Warriors, While it may still be of Benefit to other class's, Please do not post or ask questions relating to other class's
First of all I will list a few rules to remember to stick to when creating macros
All Macro's are Case Sensitive. The LUA commands should be written in lower case, while the wow Function Commands will tend to have a Capital Letter at the beginning of each word.
Example:
if, else, then, and, not, end, Are all examples of LUA commands and should always be written in lower case.
CastSpellByName "Spell()", Is an example of a wow Function Command and as you can see the beginning of each word has a capital letter.
/script must always be put at the beginning of a string of commands, unless you are using wow in game slash commands.
Example:
/script CastSpellByName "Spell()" This is a Function Command and not a standard in game slash command and therefore needs to have /script at the beginning of the sentence.
/logout, /laugh, These are examples of in game slash commands and do not need /script at the beginning of the sentence
Putting Paragraphs in between scripts will seperate the two scripts from one another, and they will be recognised by the game as two completely different and independant scripts. So if you are using the 'if' command in a script the entire script up until you reach 'end' must be on the same sentence, you cannot use paragraphs to seperate the text out for clarity or tidyness. Also if you start a new paragraph you must also type /script again as you have effectively started a new script command line.
; is a common denominator used to seperate function commands from one another, ; would be used to signal the end of one Function Command and the Start of a new Function Command.
If you are using 'if' command lines the script must contain 'if' followed by 'then' followed by 'end' in order to be accepted by the game, otherwise you will recieve an error. 'else' or 'and' are optional commands to use.
Example:
if Something is true then Do Something end
Some wow Function Commands will have () at the end of the Command, even though there is no information put in between these brackets they must still be typed in order for the Function Command to work.
I believe these are the main rules to stick to, If any of these rules are not stuck to your macro will not work.
2. Basic Macro's For Warriors
In this part I am going to introduce you to a few Function Commands you will probably want to use as a warrior, how they work and how to use them. I will start with keeping it simple, and further down the guide I'll introduce ways to use these commands to gain much more specific effects.
The request I see a lot from Warriors, is "How do I create a Macro for Changing Stances", So i'll start with this area:
To Cast a Stance Position can be done one of two ways, you can use the common Function Command CastSpellByName"Spell()" or you can use the Correct Function Command For Changing Stances CastShapeshiftForm()
I'll start with the simple and common Function Command. CastSpellByName"Spell()" This command will cast whatever spell is typed between the two "" marks, where "Spell()" is currently written. A Stance is a Spell just the same as Charge or Attack. If you open your spell book (press 'P') every single action in your spell book can be cast using the CastSpellByName""() Function. Below are the three examples of Casting each individual Stance using this Function Command.
/script CastSpellByName"Battle Stance()" This will put you in Battle Stance
/script CastSpellByName"Defensive Stance()" This will put you in Defensive Stance
/script CastSpellByName"Berserker Stance()" This will put you in Berserker Stance
Notice how /script is at the beginning of each of these command lines, and that the spell name is in between the two "" marks, and that the spells each have () at the end of their name.
Now I'll show you how to use the correct Function Command for Casting Stances, the reason it is better for using this command than the one just mentioned is because this one uses much less characters, and as you are only allowed a maximum of 255 characters per Macro it is important to use as little characters per command as possible. Below are the three examples of casting each Stance using this Function Command.
/script CastShapeshiftForm(1) - This will put you in Battle Stance
/script CastShapeshiftForm(2) - This will put you in Defensive Stance
/script CastShapeshiftForm(3) - This will put you in Berserker Stance
As you can see with this Command, the number between the brackets represents each Stance (1) = Battle Stance, (2) = Defensive Stance, (3) - Berserker Stance.
Now that you know what commands to use to cast each stance, I'll show you what command to use to Check which Stance you are in. Icon, Name, IsActive = GetShapeshiftFormInfo() This Command returns information based on what stance you specify. Icon, will return the position and name of the Icon used for the Stance. Name, Returns the name of the Stance. IsActive, Returns True if the Stance specified is currently Active, False otherwise. See below to see examples against each stance
/script Icon, Name, IsActive = GetShapeshiftFormInfo(1) = Gets Information about Battle Stance
/script Icon, Name, IsActive = GetShapeshiftFormInfo(2) = Gets Information about Defensive Stance
/script Icon, Name, IsActive = GetShapeshiftFormInfo(3) = Gets Information about Berserker Stance
Once again the numbers in brackets represent each Stance
This Function Command is pretty useless unless you use it in an if Statement. An if Statement is simply a logical argument that checks to see if an argument is true and then proceeds to do an action depending on the result.
I'll start with a simple Logical Argument to check If I am in Battle Stance and If I am in Battle Stance, then Cast Charge.
/script Icon, Name, IsActive = GetShapeshiftFormInfo(1); if IsActive then CastSpellByName"Charge()" end
This will cast charge if I am in Battle Stance, However if I am not in Battle Stance it will do nothing, so we need to include the else statement to perform a command if the argument is false.
/script Icon, Name, IsActive = GetShapeshiftFormInfo(1); if IsActive then CastSpellByName"Charge()" else CastShapeshiftForm(1) end
This will now Cast Charge when I am in Battle Stance, and if I am not in Battle Stance it will put me into Battle Stance so that the next time this Macro is pressed it will cast Charge.
Now that Stance changing has been covered I'll move onto another ever popular topic "How to Change weapons over using Macros". This is done using a Few Command Functions that fall into the categories of Inventory Functions and Container Functions.
The Container Function you will need to familiar yourself with is:
/script PickupContainerItem(BagSlotID, ContainerSlotID)
This command will pickup what ever item is in the specified location and place it in ur cursor... BagSlotID is the bag slot number you wish to pick from, they range from 0-4, 0 is the 16slot bag that you start with in the bottom right, and 4 is Bag slot ID on the left. ContainerSlotID is the Container Slot Number you wish to pick from within the specified BagSlot, the amount of Container Slots you have to choose from depends on the size of the bag you are picking up from, We'll imagine we are picking from the 16slot bag that you start with, so the Container Slots range from 1-16, 1 is the top left container in your bag, 16 is the bottom right slot in your bag, the slots count from left-to-right, starting at the top and working down. Below is an Example of this:
/script PickupContainerItem(0, 1)
This will pick up the item in the top-left slot of your first bag
Now The Inventory Function that you need to familiar yourself with is:
/script PickupInventoryItem(InventorySlotID)
This will pick up an item from the specified location in your characters inventory. InventorySlotID is the Slot Number within your Characters Inventory, they range from 0-19. For now we will only concern ourselves with two, the Mainhand Weapon Slot and the Offhand Weapon Slot. The Mainhand Weapon slot is SlotID - 16, The Offhand Weapon Slot is SlotID - 17. The below example shows this.
/script PickupInventoryItem(16) = This Picks up your MainHand Weapon
/script PickupInventoryItem(17) = This Picks up your OffHand Weapon
One thing to remember is that when you pickup from either an Inventory Location or a Container Location, if you already have something picked up in your cursor, the command will automatically pickup the new item you have specified and put it its place the other item you already had picked up. This will always work except if you try to put an object in an inventory slot where it is not compatible, for example, if you try to put a Shield into the Mainhand Weapon Slot, or if you try to put a Mainhand Weapon into the Offhand Weapon Slot.
Lets Imagine you have a 2h weapon equiped and you want to replace it with another 2h Weapon in your bag slot, to keep it simple we will imagine that it is in the first slot of your main bag. The Following Macro will do just that.
/script PickupInventoryItem(16); PickupContainerItem(0,1); PickupInventoryItem(16);
Another Command that is very useful in this instance is:
UseContainerItem(BagSlotID, ContainerSlotID)
This will automatically equip which ever item it is that you have specified, or use it if it is a useable item. If there is an item in your inventory already it will automatically put the equiped item in its place, so it is like a straight swap.
One thing to be weary of when switching weapons over etc. is If you have a 2h weapon equiped, and you want to put something in your offhand, you must unequip the 2h weapon first, if you try to equip the offhand weapon first whether it is a shield or weapon, the 2h weapon will be put into the first available slot in your container, and not where you specify. A good way to stop this happening is check if you have got something equiped in ur offhand, if you havent then you know that you have got equiped a 2h weapon, if you have then you know that you havent got a 2h weapon equiped. To do this you can use the following command:
/script CursorHasItem() = This returns True if the cursor has an item and False otherwise
Using this command, you can pick up your offhand Weapon and check if your cursor has an item picked up, if it does then you know that your offhand has an item equiped. If it doesn't then you know that you have a 2h Weapon equiped. The following Command line is very good for switching between a 2h weapon and a 1h+Shield and back again.
/Script PickupInventoryItem(17); if CursorHasItem() then PickupContainerItem(0,2); UseContainerItem(0,1); else UseContainerItem(0,1); UseContainerItem(0,2); end
This Command Line assumes that your Shield is in slot 2 of your first bag and your 1h is in slot 1 of your first bag. If you prefer to use different slots then you must change it accordingly
Using these Inventory and Container Functions requires a bit of experimenting to get used to exactly what works and what doesn't as I can't list everything here, But I have tried to outline the main things you need to know.
3. From the Basics to the More Specific Macros
Now that I have covered the basic stance switching and container functions and introduced you to the if statements, I'm going to go into macros that are useful for more specific events and outcomes.
I will start with the Warriors opening move as I think this is apropriate, Charge and Intercept, both are the warriors opening move, depending if we are in combat or not in combat. Obviously we would prefer to use charge over intercept as this gives us rage rather than costing us rage. In order for our macro to know when to use charge and when to use Intercept we need to check our combat Status. If we are not in combat then the macro will cause us to charge, If we are in combat then the macro will cause us to use Intercept. The following Command will check our Combat Status.
/script UnitAffectingCombat("Player") = This returns True If you are in combat and False otherwise.
Using this and the Stance Change Commands we have already gone over we can now create a macro that will put us into Battle Stance and Cast Charge when we are not in Combat.
/script Icon, Name, IsActive = GetShapeshiftFormInfo(1); if IsActive and not UnitAffectingCombat("Player") then CastSpellByName"Charge()" elseif not UnitAffectingCombat("Player") then CastShapeshiftForm(1) end
This macro will cast Charge if we are in Battle Stance and not in Combat, If we are not in combat but not in Battle Stance then it will cast Battle Stance first, If we are in combat then it will do nothing
This Macro is obviously for Charge, so lets go over one for Intercept as well. In order to cast Intercept we need at least 10 rage points or more. In order to check how much rage we have we can use the following command:
/script UnitMana("Player") = This returns how much Rage points we have in our Rage Bar.
If we dont have more than 10 rage points then we will need to cast Bloodrage before we can cast Intercept to give oursleves enough Rage Points. We can use the following Command line to do this:
/script if UnitMana("Player") < 10 then CastSpellByName"Bloodrage()" end
Now that we have this we also need to check that we are in Beserker Stance before we can cast intercept. So using the command line just mentioned and what we already know from Stance Changing, we get the following macro to cast intercept:
/script Icon, Name, IsActive = GetShapeshiftFormInfo(3); if IsActive and UnitMana("player") <10 then CastSpellByName "Bloodrage" elseif IsActive then CastSpellByName "Intercept()" else CastShapeshiftForm(3) end
This Macro will cast Intercept if we are in Berserker Stance and have more than 10 rage points, If we dont have more than 10 Rage Points it will cast Bloodrage and If we are not in Beserker Stance it will put us into Berserker Stance
Obviously the problem here is that the Charge Macro and the Intercept Macro are 2 completely seperate Macro's and do not lead onto one another. and we cannot combine them together due to the 255 character limit. But thankfully the warriors action bars change depending on what stance you are in, so we can make 3 completely independant macros, one for each Stance, and put them in the same Action Bar Slot, for simplicity we will use Slot 1, by doing this, we can have the three macros leading onto each other from when we change stances, effectively combining the three together to make 1 big macro.
First we will Create the Macro to be put into Action Bar Slot 1 of Battle Stance:
/script if UnitAffectingCombat("Player") then CastShapeshiftForm(3) else CastSpellByName"Charge()" end
If your not in Combat then this Macro will cast Charge, if you are in combat this macro will cast Berserker Stance
Next we will create the Macro to be put into Action Bar Slot 1 of Defensive Stance:
/script if UnitAffectingCombat("Player") then CastShapeshiftForm(3) else CastShapeshiftForm(1) end
If your in combat this will cast Berserker Stance, if your not in combat it will cast Battle Stance
Now we will Create the Macro to be put into Action Bar Slot 1 of Berserker Stance:
/script if UnitMana("Player") < 10 and UnitAffectingCombat("Player") then CastSpellByName"Bloodrage()" elseif UnitAffectingCombat("Player") then CastSpellByName"Intercept()" else CastShapeshiftForm(1) end
If you have less than 10 rage and are in combat then this will cast Bloodrage, If you have 10 rage or more and are in combat this will cast intercept, if you are not in combat this will cast Battle Stance
These three combined will mean that by pressing the Action Key 1 either 1,2 or 3 times will either cast charge or intercept depending if you are in combat or not in combat. So this gives u all these functions and combat checks assigned to one simple action key. YOU GOTTA LOVE THAT!
4. Casting More Than One Spell In One Macro At The Same Time
Ok this is an issue that has been argued by several people over and over, alot of people will tell you that it is not possible to cast more than one spell in one macro at the same time. I can confirm that it is infact Possible to Cast more than one spell in one Macro at the same time. This is done using the following command:
SpellStopCasting() - This stops any Spell that is in the process of being casted, it also stops any action that is in progress after a spell has just been casted, therefore allowing another spell to be cast.
There are limitations in place with this command and casting spells simultaneously, and before I go into how to cast spells simultaneously I will go through all of the limitations in place.
When you cast two spells at the same time using a macro, they are not cast one after the other as you would think, each action is still done in the order that you have specified, but everything happens at exactly the same time. Because of this it is not possible to cast spells that require something else to be done first. Examples of this are below.
-If you wish to create a Macro that will cast Bloodrage and then Mortal Strike, Mortal Strike will be actioned before the effect of Bloodrage has taken place, therefore, you will recieve an error from Mortal Strike saying 'not enough rage' unless of course you already had enough rage to begin with.
-If you wish to cast a spell that requires you to be in a certain stance, for instance, if you cast Berserker Stance and then Whirlwind, Whirlwind will be actioned before the effect of Berserker Stance had taken place, therefore you will recieve an error saying 'I can't do that'. unless ofcourse you were already in Berserker Stance to begin with.
I believe these are the two restrictions with using the SpellStopCasting() command, however you may find more restrictions when experimenting with other spells.
An example of a Macro that works with the StopSpellCasting() command is the following:
/script CastSpellByName"Charge()"; SpellStopCasting(); CastShapeshiftForm(3); SpellStopCasting(); CastSpellByName"Bloodrage()"; SpellStopCasting();
This will cast charge, immediately put u into Berserker Stance and then Cast Bloodrage all before you reach the target. and if you have Improved Charge, you will have 40 rage points before you have even struck your first blow
This is an extremely useful tool, and although there are some restrictions is a very good command to use in macros.
Copyright@Connovar(Twisting Nether)