This is what is used to name the function and call it in game. You can name it whatever you want. Since this is a macro using Blood Arrow that's why I call it that.

local focus = UnitMana("player")

local rage = UnitSkill("player")

The words focus and rage are just to help the coder understand what he is concerned about. UnitMana refers to the PRIMARY class's mana/focus/rage. UnitSkill("player") refers to the SECONDARY class's mana/focus/rage. So if Matt made a macro for a Warrior/Scout, UnitMana would be rage and UnitSkill would be focus. It is ENTIRELY DEPENDENT ON YOUR PRIMARY AND SECONDARY CLASS AT THE TIME. These two lines simply keep track of how much mana/rage/focus a person has. If both classes use Mana, then you only need to use UnitMana.

local combat = GetPlayerCombatState()

Simply returns if the player is in combat or not.

local friendly = (not UnitCanAttack("player","target"))

Simply returns if the player can attack the target.

local enemy = UnitHealth("target")

Simply returns how much health the enemy has.

local self = PctH("player")

Simply returns the current percentage of the player's health. If you are at 100%, 70%, or only 10%.

local _1, _2, _3, _4, _5, ASon = GetActionInfo(AS_slot)

Is only for Autoshot on Scouts.

The next part has three different sections which will be the part that needs edited the most. The three, most likely, things that need coding are buffs, debuffs, and attacks.

This first off calls the skill by NAME, not action bar slot. This code says I want to use Blood Arrow when I do not have the buff Blood Arrow, when I am above 70% health, and when I am in combat. It will deactivate when I am below 40% health or out of combat.

NOTE: Item-Set Skills are handled differently. I am not sure how they can be referenced.

This is a simpler buff than the first. It will check if I do not have the buff on, if I don't then it will cast. Simple, effective, and does it before you even attack.

i=i+1; Skill[i] = { name = "Target Lock", use = (not friendly)}

This is a debuff. Most debuffs can be treated as attacks due to most having longer cooldowns than the effective time of the debuff. This is the base code needed for attack skills. It checks to make sure your target is an enemy and uses the move on them.

This is a more advanced attack. Along with checking to make sure my target is an enemy, it also makes sure I have more than 20 focus. If I have less than 20 focus, this move will be ignored. Also, this move will only be used if the enemy has more than 100,000 health. NOTE: For moves that require rage/focus/mana it is important to put a minimum amount. Without the minimum amount it will repeatedly try to use the move, unless it is on cooldown, and will not move on to any additional skills.

Using a mixture of those, it should be possible to code any attack. There are more advanced maneuvers, such as detecting if the Shift key is being held to activate specific attacks only when shift is held (good for rogues when they want to use this macro and tell it that they are BEHIND the enemy.)

The order of skills is important!!! I have Wind Arrows at the bottom as it is my last resort skill. When I have nothing left to cast, I cast Wind Arrows. The skills at the top are FIRST PRIORITY and as they approach the end they are lower priority. If you put a skill that has no cooldown on top, you will never be able to use any other skills. Make sure to know which skills result in a global cooldown, such as Wind Arrows.

There are premade setups on the RoM forums that you can grab and edit if you want. Some get pretty heavy and include, heals, items, etc. If you need any help setting one up, PM me here on the site. If you have a setup you think is golden, post it here.