|
 |
« Reply #4 on: January 17, 2018, 11:54:01 pm » |
|
Spam sheep macro
Macro code:
/script polymorphIndx = findPolymorph() /script CastSpellByName("Polymorph"); /script if GetSpellCooldown(polymorphIndx, "spell")>0 then SpamAnnounce() ; end
LUA code:
Spammable_channel = "xxx" Spammable_cast = "sheep"
function findPolymorph() i, s, S = 1, "spell", GetSpellName; f="Polymorph"; n, r=S(i,"spell") findPoly_spells = { } repeat if strfind(n,f)~=nil then findPoly_spell = { } findPoly_spell["index"] = i findPoly_spell["name"] = n findPoly_spell["rank"] = r tinsert(findPoly_spells, findPoly_spell) end i=i+1; n, r = S(i,"spell") until n==nil for _, spell in ipairs(findPoly_spells) do if spell["rank"] == "Rank 2" then return spell["index"] end end end
function SpamAnnounce() local cd, t= 5, GetTime() if (t-cd) >= (LAST_SAY or 0) then LAST_SAY = t; whisperNextGroup2() end end
function whisperNextGroup2() local channelID=GetChannelName(Spammable_channel); local targetName = UnitName("target"); if targetName == nil then targetName = "<no target>" end SendChatMessage("I "..Spammable_cast.." "..string.upper(targetName), "CHANNEL", nil, channelID); SendChatMessage("I "..Spammable_cast.." "..string.upper(targetName), "SAY", nil); end
|