Thread Tools Display Modes
05-08-06, 08:37 AM   #1
wereHamster
A Black Drake
 
wereHamster's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 80
Shag's ColdFusionShell

This is the official discussion thread for the ColdFusionShell AddOn.

http://www.wowinterface.com/download...fo.php?id=4946
  Reply With Quote
05-09-06, 09:30 AM   #2
wereHamster
A Black Drake
 
wereHamster's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 80
Additional functions

This section contains additional functions to what the default LUA-Environment already provides.

Localization
Code:
L(s) -- returns localized string
Spells
Code:
SpellReady(s) -- returns true if the spell is not on cooldown
  -- does not check for mana or reagents.
CastSpell(s, onSelf) -- alias for CastSpellByName()

Inventory/Containers
Code:
local item = ItemCreate(pattern) -- returns a handle to the item
item:Type() -- returns "Container" or "Inventory" or nil if item doesn't exist
item:IsReady() -- item not on cooldown
item:IsLocked() -- item can be moved/equiped
item:Use() -- use the item
item:Equip(slot) -- slot is optional, if not specified then autoequips the item
    -- all possible slot strings can be found here
ItemUse(itemList) -- uses the first item that is not on cooldown
    -- and returns its name
Buffs/Debuffs
Code:
BuffActive(unit, buff) -- checks if the unit has an active buff
DebuffActive(unit, debuff) -- checks if the unit has an active debuff
Misc
Code:
Announce(msg) -- announce msg to SAY, RAID or PARTY chat
Debug(msg) -- prints msg to the default chatframe
ShapeshiftForm() -- returns localized shapeshift form name

Last edited by wereHamster : 05-10-06 at 07:08 AM.
  Reply With Quote
05-10-06, 12:38 AM   #3
wereHamster
A Black Drake
 
wereHamster's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 80
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")

Last edited by wereHamster : 05-11-06 at 01:58 AM.
  Reply With Quote
05-10-06, 12:42 AM   #4
wereHamster
A Black Drake
 
wereHamster's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 80
reserved for future additions
  Reply With Quote
05-20-06, 04:11 PM   #5
gnosis3d
A Deviate Faerie Dragon
 
gnosis3d's Avatar
Join Date: May 2006
Posts: 11
I am not seeing any information on the Rank of spells/abilities cast. Is it the best always? Can you extend it out ie. (WingClip,Rank2) for it to work?

Syntax please. ;-)

FYI - Much potential. Very interested as a hunter. Using a modified range version for melee as well. VERY nice.

-Gnosis
  Reply With Quote
05-20-06, 05:59 PM   #6
wereHamster
A Black Drake
 
wereHamster's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 80
Originally Posted by gnosis3d
I am not seeing any information on the Rank of spells/abilities cast. Is it the best always? Can you extend it out ie. (WingClip,Rank2) for it to work?
CastSpell() has the exact same syntax as CastSpellByName(), so you can use:
Code:
CastSpell("Wing Clip(Rank 2)")
and without rank, it casts the highest rang.

Last edited by wereHamster : 05-20-06 at 06:04 PM.
  Reply With Quote
05-20-06, 08:52 PM   #7
gnosis3d
A Deviate Faerie Dragon
 
gnosis3d's Avatar
Join Date: May 2006
Posts: 11
Perfect.

Please keep up the good work. Very powerful tool.
  Reply With Quote
05-31-06, 03:03 PM   #8
Zortje
A Murloc Raider
Join Date: May 2006
Posts: 5
im looking for a fucntion so i can get the macro to target a random class, then check if they have a buff, if they dont have then move to another class and then check, if it then find a class witch miss the current buff it buffs...

but mainly the target function, the rest i think i can make my self

FX:

i use the macro, it target a priest but the priest have the buff (blessing of kings), so it moves on to the next class druid but the druid miss the buff(blessing of kings) then the macro bless and end...

Last edited by Zortje : 05-31-06 at 03:06 PM.
  Reply With Quote
06-01-06, 02:44 PM   #9
wereHamster
A Black Drake
 
wereHamster's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 80
Originally Posted by Zortje
im looking for a fucntion so i can get the macro to target a random class
You can't just ramdomly target a class... only when you're in a party or raid.
  Reply With Quote
06-04-06, 09:30 AM   #10
gnosis3d
A Deviate Faerie Dragon
 
gnosis3d's Avatar
Join Date: May 2006
Posts: 11
What about a Rogue's combo points?

Is there a way just like you did the "if health less than" in the Hunter macro... to read combo points?

If combo points = 5 then eviscerate (with syntax of course)
  Reply With Quote
06-04-06, 09:51 AM   #11
wereHamster
A Black Drake
 
wereHamster's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 80
Originally Posted by gnosis3d
What about a Rogue's combo points?
http://www.wowwiki.com/World_of_Warcraft_API
http://www.wowwiki.com/API_GetComboPoints
  Reply With Quote
06-04-06, 10:13 AM   #12
Zortje
A Murloc Raider
Join Date: May 2006
Posts: 5
oh, you misunderstood me... i mean when im in raid... becuase its alot easier to get a macro to check if someone miss a buff instead of haft to look at every person
  Reply With Quote
06-04-06, 01:52 PM   #13
wereHamster
A Black Drake
 
wereHamster's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 80
Originally Posted by Zortje
oh, you misunderstood me... i mean when im in raid...
I understood you, you just didn't explain enough.

try this:

Code:
local unitID, spell = "raid"..math.random(1, GetNumRaidMembers())
local _, class = UnitClass(unitID)
if (class == "WARRIOR") then -- Warriors get BoL
    spell = L"GreaterBlessingOfLight"
elseif (UnitPowerType(unitID) == 0) then -- unit has mana, give Wisdom
    spell = L"GreaterBlessingOfWisdom"
else -- that laves Rogues here, let them do damage ;)
    spell = L"GreaterBlessingOfMight"
end
if (spell and not BuffActive(unitID, spell)) then
    TargetUnit(unitID)
    CastSpell(spell)
    TargetLastTarget()
end
or if you want a separate buff for each class:
Code:
local unitID, spell = "raid"..math.random(1, GetNumRaidMembers())
local _, class = UnitClass(unitID)
local map = {
    ["WARRIOR"] = L"GreaterBlessingOfLight",
    ["DRUID"] = L"GreaterBlessingOfKings",
    ["ROGUE"] = L"GreaterBlessingOfMight",
    .... add more classes here
}

if (spell and map[spell] and not BuffActive(unitID, map[spell])) then
    TargetUnit(unitID)
    CastSpell(map[spell])
    TargetLastTarget()
end

Last edited by wereHamster : 06-04-06 at 02:01 PM.
  Reply With Quote
06-05-06, 07:51 AM   #14
Zortje
A Murloc Raider
Join Date: May 2006
Posts: 5
thanks, iŽll try that
  Reply With Quote
06-05-06, 08:11 AM   #15
Zortje
A Murloc Raider
Join Date: May 2006
Posts: 5
hmm, tryed it in a 2man raid (wanted to test)
but notthing happened, the other person was in tanaris and im was in IF, but it didnt target me :S

Code:
local unitID, spell = "raid"..math.random(1, GetNumRaidMembers())
local _, class = UnitClass(unitID)
local map = {
    ["WARRIOR"] = L"GreaterBlessingOfKings",
    ["DRUID"] = L"GreaterBlessingOfKings",
    ["ROGUE"] = L"GreaterBlessingOfKings",
    ["PRIST"] = L"GreaterBlessingOfKings",
    ["MAGE"] = L"GreaterBlessingOfKings",
    ["WARLOCK"] = L"GreaterBlessingOfKings",
    ["PALADIN"] = L"GreaterBlessingOfKings",
    ["HUNTER"] = L"GreaterBlessingOfKings",
}

if (spell and map[spell] and not BuffActive(unitID, map[spell])) then
    TargetUnit(unitID)
    CastSpell(map[spell])
    TargetLastTarget()
end
  Reply With Quote
06-05-06, 08:53 AM   #16
wereHamster
A Black Drake
 
wereHamster's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 80
Originally Posted by Zortje
hmm, tryed it in a 2man raid (wanted to test)
but notthing happened, the other person was in tanaris and im was in IF, but it didnt target me :S
I guess you don't know how to write scripts...
The script can't work.. it has a bug! My fault.. sorry.

If you want to buff all units with the same buff, there is no need for the 'map'. Also, it doesn't check the range or whether the unit is offline..

Code:
local unitID = "raid"..math.random(1, GetNumRaidMembers())
local spell = L"GreaterBlessingOfKings"
if (not BuffActive(unitID, spell)) then
    TargetUnit(unitID)
    CastSpell(spell)
    TargetLastTarget()
end
  Reply With Quote
06-05-06, 12:25 PM   #17
Zortje
A Murloc Raider
Join Date: May 2006
Posts: 5
yeah im abit new to wow scripting

but it work now, THANKS ALOT
  Reply With Quote
06-05-06, 05:30 PM   #18
gnosis3d
A Deviate Faerie Dragon
 
gnosis3d's Avatar
Join Date: May 2006
Posts: 11
Actually, I should have never posted. I got it to work about 15 minutes after I asked.
  Reply With Quote
06-05-06, 07:07 PM   #19
gnosis3d
A Deviate Faerie Dragon
 
gnosis3d's Avatar
Join Date: May 2006
Posts: 11
Rogue

This is what I use for my rogue. He is level 28 and does WSG. Spec'd for stealth movement and ambush.

1.) DAMAGE SPAM - If health is under 300 HPs, then it uses a potion or healthstone. Then... If you have all 5 combo points, it will Eviscerate. If you cant Eviscerate, and ARE stealthed, it will Ambush. And lastly, if you can't do anything else it will Sinister Strike.

Code:
local itemList = {
    "Greater Healing Potion",
    "Healthstone",
}
if (UnitHealth("player") < 300) then ItemUse(itemList)
    elseif ( GetComboPoints() == 5 ) and SpellReady("Eviscerate") then CastSpell("Eviscerate")
    elseif BuffActive("player", "Stealth") and SpellReady("Ambush") then CastSpell("Ambush")
    elseif SpellReady("Sinister Strike") then CastSpell("Sinister Strike")
end
2.) DELAY SPAM - If health is under 300 HPs, then it uses a potion or healthstone. Then... If you have all 5 combo points, it will Eviscerate. If you cant Eviscerate, and ARE stealthed, it will Cheap Shot. And lastly, if you can't do anything else it will Backstab.

Code:
local itemList = {
    "Greater Healing Potion",
    "Healthstone",
}
if (UnitHealth("player") < 300) then ItemUse(itemList)
elseif ( GetComboPoints() == 5 ) and SpellReady("Eviscerate") then CastSpell("Eviscerate")
elseif BuffActive("player", "Stealth") and SpellReady("Cheap Shot") and (not BuffActive("target", "Cheap Shot")) then CastSpell("Cheap  Shot")
elseif SpellReady("Backstab") then CastSpell("Backstab")
end
3.) GOUGE SPAM - If you are not stealthed it will Gouge.

Code:
if (not BuffActive("player", "Stealth")) and SpellReady("Gouge") then CastSpell("Gouge")
end

Last edited by gnosis3d : 06-07-06 at 05:50 AM. Reason: misspelling
  Reply With Quote
06-07-06, 05:53 AM   #20
gnosis3d
A Deviate Faerie Dragon
 
gnosis3d's Avatar
Join Date: May 2006
Posts: 11
@Shag - When doing UnitHealth of a target, it is a %. For example, if you made is > 20 then that would be 20% of their health.

Now on when UnitHealth of player is done, it is of actual Hitpoints. Through level gains, this amount would change for my above script due to hitpoint increases and potion(etc) increases.

Is there a way to do UnitHealth of the player in a percent? This would make the script viable throughout all levels.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » Released AddOns » Shag's ColdFusionShell


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off