Sample scripts
This section will contain sample scripts to give you an idea what can and can't be done.
Hunter
one-button grinding
(works for lvl 10-20 hunters, don't know what higer-level hunters do
)
Code:
-- when we start attacking, at 90%
-- to give the pet time to build up initial aggro
local attackThreshold = 90
-- when we start zerging, eg. using arcane shot
local zergThreshold = 40
-- if the pet is in combat, target its target
if (UnitAffectingCombat("pet")) then
TargetUnit("pettarget")
end
-- if our current target is invalid, clear it an look for enemies
if (UnitIsDead("target") or not UnitCanAttack("player", "target")) then
ClearTarget()
TargetNearestEnemy()
end
-- if we have a target, send the pet
-- if not print a message that we haven't found anything to attack
if (UnitExists("target")) then
PetAttack()
else
Debug("Nothing to attack")
return
end
-- cast Hunter's Mark
if (not DebuffActive("target", "Hunter's Mark")) then
CastSpell("Hunter's Mark")
return
end
-- don't attack as long as the pet hasn't built up initial aggro
if (UnitHealth("target") > attackThreshold) then
return
end
-- do we have aggro? cast Concussive Shot
-- but only if the target has > 20%
-- don't waste mana if that target is dead soon
if (UnitIsUnit("player", "targettarget") and SpellReady(L"ConcussiveShot")
and UnitHealth("target") > 20) then
CastSpell(L"ConcussiveShot")
return
end
-- zerg the target down if its health is below zergThreshold
-- otherwise renew Serpent Sting or do Auto Shoot
if (UnitHealth("target") < zergThreshold and SpellReady(L"ArcaneShot")) then
CastSpell(L"ArcaneShot")
elseif (not DebuffActive("target", L"SerpentSting")) then
CastSpell(L"SerpentSting")
else
CastSpell("Auto Shot")
end
Priest
DesperatePrayer/PowerWordShield/HealingPotion/Healthstone
aka the I-DON'T-WANT-TO-DIE button
Code:
local dp, pws = L"DesperatePrayer", L"PowerWordShield"
if (SpellReady(dp)) then
CastSpell(dp)
return
end
if (SpellReady(pws) and not DebuffActive("player", "Weakened Soul")) then
CastSpell(pws, true)
return
end
local itemList = {
"Major Healing Potion",
"Healthstone",
}
local usedItem = ItemUse(itemList)
if (usedItem) then
Announce("Used "..usedItem)
end
Grinding protection
simple macro to protect you when grinding
Code:
if (DebuffActive("player", L"WeakenedSoul")) then
CastSpell(L"Renew", true)
else
CastSpell(L"PowerWordShield", true)
end
Warrior
Overpower/Revenge
Code:
if (ShapeshiftForm() == L"BattleStance") then
CastSpell(L"Overpower")
elseif (ShapeshiftForm() == L"DefensiveStance") then
CastSpell(L"Revenge")
elseif (ShapeshiftForm() == L"BerserkerStance") then
CastSpell(L"Overpower")
end
Combat opening
Code:
if (ShapeshiftForm() ~= L"BattleStance") then
CastSpell(L"BattleStance")
end
if (SpellReady(L"Charge")
and UnitExists("target")
and UnitCanAttack("player", "target")) then
CastSpell(L"Charge")
elseif (SpellReady(L"Bloodrage")) then
CastSpell(L"Bloodrage")
elseif (not BuffActive("player", L"BattleShout")
and UnitMana("player") > 10) then
CastSpell(L"BattleShout")
elseif (UnitMana("player") > 15) then
CastSpell(L"HeroicStrike")
end
Equip trinkets
Code:
local item = ItemCreate("Onyxia Blood Talisman")
item:Equip("Trinket0Slot")
local item = ItemCreate("Force of Will")
item:Equip("Trinket1Slot")