Wikia

WoWWiki

Complex heal macro notes

Talk1
102,031pages on
this wiki
Revision as of 20:37, September 25, 2006 by Kirkburn (Talk | contribs)

These are the notes I took while building & testing the Complex heal macro. It's a little messy and I wouldn't use it to get a copy of the macro, but if you are learning to create WOW macros this might be useful. As you follow down the list you'll see how I move different commands around and try to find the right command or order to get something done. It is often useful to break a task down into smaller parts and try to solve them first as I do here with the friendly and nil target parts. Hope this helps and if you have any comments feel free to use the Talk:Complex_heal_macro_notes page...

/UnitMana("unit")

/run t="target" p="player" b="Innervate" if (UnitIsFriend(p,t) and UnitManaMax(t)>200) then for i=1,16 do if UnitBuff(t,i) then if not string.find(UnitBuff(t,i), b) then CastSpellByName(b) end end end else ChatFrame1:AddMessage("Did not "..b.."!") end


Original script

/script if (UnitName("target") ~=nil and UnitIsFriend("player","target")) then CastSpellByName("Healing Touch(Rank 9)") SendChatMessage("Healing %T", "Party") else TargetUnit("player") CastSpellByName("Healing Touch(Rank 9)") TargetLastEnemy(); end


First version - reduction - no mana check

/run t="target" p="player" h="Healing Touch" if (UnitName(t) ~=nil and UnitIsFriend(p,t)) then CastSpellByName(h) SendChatMessage("Healing %T", "Party") else TargetUnit(p) CastSpellByName(h) TargetLastEnemy(); end


second version - mana check

/run t="target" p="player" h="Healing Touch" m=200 if UnitMana(p) > m then if (UnitName(t) ~=nil and UnitIsFriend(p,t)) then CastSpellByName(h) SendChatMessage("Healing %T", "Party") else TargetUnit(p) CastSpellByName(h) TargetLastEnemy() return else SendChatMessage("/oom"); end


third version - (2nd too long removing oom emote)

/run t="target" p="player" h="Healing Touch" m=546 if UnitMana(p) > m then if (UnitName(t) ~=nil and UnitIsFriend(p,t)) then CastSpellByName(h) SendChatMessage("Healing %T", "Party") else TargetUnit(p) CastSpellByName(h) TargetLastEnemy() return; end end


fourth version

/run t="target" p="player" h="Healing Touch" m="546" if UnitMana(p) > m then if (UnitName(t) ~=nil and UnitIsFriend(p,t)) then CastSpellByName(h) s="Healing %T" else TargetUnit(p) CastSpellByName(h) TargetLastEnemy() return; else s="/oom" end SendChatMessage(s, "Party") end


fifth version

/run t="target" p="player" h="Healing Touch" s="oom" m=546 if UnitMana(p) > m then if (UnitName(t) = nil or UnitIsEnemy(p,t)) then TargetUnit(p) return; CastSpellByName(h) s="Heal %T" TargetLastEnemy() end SendChatMessage(s, "Party") end


test friendly

/run t="target" p="player" if ((UnitName(t)=nil) or UnitIsEnemy(p,t)) then TargetUnit(p) SendChatMessage(p, "Party") end
/run t="target" p="player" if (UnitName(t) = nil or UnitIsEnemy(p,t)) then TargetUnit(p) SendChatMessage(p, "Party") end
/run t="target" p="player" if UnitIsEnemy(p,t) then TargetUnit(p) SendChatMessage(t, "Whisper", "Common", UnitName(p)) end

working half of friendly

/run t="target" p="player" if UnitIsEnemy(p,t) then TargetUnit(p) end SendChatMessage(UnitName(t), "Whisper", "Common", UnitName(p))

test other half of friendly

/run t="target" p="player" if (UnitName(t)=nil) then TargetUnit(p) end SendChatMessage(UnitName(t), "Whisper", "Common", UnitName(p))

test other half of friendly v2

/run t="target" p="player" if not (UnitName(t)) then TargetUnit(p) t="player" end SendChatMessage(UnitName(t), "Whisper", "Common", UnitName(p))

test - doesn't work - lua treats all values as non nil (even 0)

/run t="target" p="player" if ((UnitName(t) or UnitIsEnemy(p,t)) then TargetUnit(p) end SendChatMessage(UnitName(t), "Whisper", "Common", UnitName(p))

It's having a problem with sending the message because the target name is nil

/run t="target" p="player" if ((UnitName(t) or UnitIsEnemy(p,t)) then TargetUnit(p) t="player" end SendChatMessage(UnitName(t), "Whisper", "Common", UnitName(p))


Working second half of friendly

/run t="target" p="player" if not (UnitName(t)) then TargetUnit(p) t="player" end SendChatMessage(UnitName(t), "Whisper", "Common", UnitName(p))

Merged friendly

/run t="target" p="player" if not UnitName(t) or UnitIsEnemy(p,t) then TargetUnit(p) t="player" end SendChatMessage(UnitName(t), "Whisper", "Common", UnitName(p))


sixth version - IT WORKS!!!!

/run t="target" p="player" h="Healing Touch" s="oom" m=546 if UnitMana(p) > m then if not UnitName(t) or UnitIsEnemy(p,t) then TargetUnit(p) t="player" end CastSpellByName(h) s="Heal %T" TargetLastEnemy() end SendChatMessage(s, "Party")


Seventh version -removed spell name variable to add better text

/run t="target" p="player" s="oom" m=546 if UnitMana(p) > m then if not UnitName(t) or UnitIsEnemy(p,t) then TargetUnit(p) t="player" end CastSpellByName("Healing Touch") s="Healing %T" TargetLastEnemy() end SendChatMessage(s, "Party")


eighth version - trying to get emote

/run t="target" p="player" s="oom" x="Emote" m=5546 if UnitMana(p) > m then if not UnitName(t) or UnitIsEnemy(p,t) then TargetUnit(p) t="player" end CastSpellByName("Healing Touch") x="Party" s="Healing %T" TargetLastEnemy() end SendChatMessage(s, x)
/run t="target" p="player" s="oom" c="Emote" m=5546 if UnitMana(p) > m then if not UnitName(t) or UnitIsEnemy(p,t) then TargetUnit(p) t="player" end CastSpellByName("Healing Touch") c="Party" s="Healing %T" TargetLastEnemy() end SendChatMessage(c, "Party")
/run t="target" p="player" m=3546 if UnitMana(p) > m then if not UnitName(t) or UnitIsEnemy(p,t) then TargetUnit(p) t="player" end CastSpellByName("Healing Touch") x="Party" s="Healing %T" TargetLastEnemy() else s="oom" x="Emote" end SendChatMessage(s, x)
/run t="target" p="player" m=546 if UnitMana(p) > m then if not UnitName(t) or UnitIsEnemy(p,t) then TargetUnit(p) t="player" end CastSpellByName("Healing Touch") TargetLastEnemy() SendChatMessage("Healing %T","Party") else DoEmote("oom") end 

test mana

/run p="player" SendChatMessage(UnitMana(p), "Whisper", "Common", UnitName(p));


test mana

/run p="player" m=2000 if UnitMana(p) > m then SendChatMessage(UnitMana(p), "Whisper", "Common", UnitName(p)) else SendChatMessage("oom", "Whisper", "Common", UnitName(p)); end


test mana

/run p="player" m=2000 s="oom" if UnitMana(p) > m then s=UnitMana(p); end SendChatMessage(s, "Whisper", "Common", UnitName(p))

Around Wikia's network

Random Wiki