hello everyone!
couldn't find much on the following, so here it goes:
is there any (be it a macro or an addon etc.) possiblity to cancel a buff by ID?
hello everyone!
couldn't find much on the following, so here it goes:
is there any (be it a macro or an addon etc.) possiblity to cancel a buff by ID?
No, the responsible API only accepts spell name or buff index. Theoretically you could update a macro to match the index of the buff with the correct spell id. But that would only be possible while not in combat and as such would not be very useful.
You can use GetSpellInfo if you don't know the spell name in a specific localisation, but it's not going to help for 2 spells with the same name...
Last edited by Crudor; 2014-09-17 at 07:41 PM.
obviously you can't use this in combat, as you can't cancel buffs in combatCode:/run CancelUnitBuff("player", GetSpellInfo("spellID"))
strange, i didn't test it but the function itself should be tagged nocombat
good thing to know, it used to be nocombat because of str dps cancelbuff "exploit" with Wotlk legendary 2H
It is protected in combat for me (on live, zero addons):
You really only can do /cancelaura, which doesn't accept lua code.Originally Posted by taintlog
Last edited by Crudor; 2014-09-17 at 10:52 PM.
The following code will create and update a macro (called "cancelBySpellID") to remove the spell with spellID (change the first line in the code to the id you want). Just turn it into an addon and drag the macro to your bar.
As stated above, this will only work when out of combat, so it's pretty much useless.
Code:local spellID = 1126 local macroText, macroName, buffIndex, lastIndex, blizz, combat = "/cancelaura %d", "cancelBySpellID", "", "", "Blizzard_MacroUI", false local function getBuff() for i=1,40 do if select(11,UnitBuff("player",i)) == spellID then return i end end return 0 end local m = CreateFrame("Frame") m:RegisterEvent("ADDON_LOADED") m:RegisterEvent("PLAYER_REGEN_DISABLED") m:RegisterEvent("PLAYER_REGEN_ENABLED") m:SetScript("OnEvent",function(self,event,addon) if event == "PLAYER_REGEN_DISABLED" then combat = true EditMacro(macroName, nil, nil, "") elseif event == "PLAYER_REGEN_ENABLED" then combat = false elseif addon == blizz then if not GetMacroInfo(macroName) then CreateMacro(macroName,"INV_Misc_QuestionMark","") end end end) local f = CreateFrame("Frame") f:RegisterUnitEvent("UNIT_AURA","player") f:SetScript("OnEvent",function() if not (InCombatLockdown() or combat) then if IsAddOnLoaded(blizz) ~= 1 then LoadAddOn(blizz) end buffIndex = getBuff() if buffIndex~=lastIndex then lastIndex = buffIndex if buffIndex>0 then EditMacro(macroName, nil, nil, macroText:format(buffIndex)) else EditMacro(macroName, nil, nil, "") end end end; end)
Last edited by Crudor; 2014-09-18 at 09:52 PM.
that is exactly was I was looking for man! :-) :-)
unfortunately though I can't get it to work and simply can't figure out why. (tried it with mark of the wild) I'd really appreciate if you took another look at it!
here's the 'addon version' of what you posted: dl.dropboxusercontent.com/u/41246971/GWM.rar
(can't post proper links yet :P)
Indeed there was a little typo, should work now:
Code:local spellID = 1126 local macroText, macroName, buffIndex, lastIndex, blizz, combat = "/cancelaura %d", "cancelBySpellID", "", "", "Blizzard_MacroUI", false local function getBuff() for i=1,40 do if select(11,UnitBuff("player",i)) == spellID then return i end end return 0 end local m = CreateFrame("Frame") m:RegisterEvent("ADDON_LOADED") m:RegisterEvent("PLAYER_REGEN_DISABLED") m:RegisterEvent("PLAYER_REGEN_ENABLED") m:SetScript("OnEvent",function(self,event,addon) if event == "PLAYER_REGEN_DISABLED" then combat = true EditMacro(macroName, nil, nil, "") elseif event == "PLAYER_REGEN_ENABLED" then combat = false elseif addon == blizz then if not GetMacroInfo(macroName) then CreateMacro(macroName,"INV_Misc_QuestionMark","") end end end) local f = CreateFrame("Frame") f:RegisterUnitEvent("UNIT_AURA","player") f:SetScript("OnEvent",function() if not (InCombatLockdown() or combat) then if IsAddOnLoaded(blizz) ~= 1 then LoadAddOn(blizz) end buffIndex = getBuff() if buffIndex~=lastIndex then lastIndex = buffIndex if buffIndex>0 then EditMacro(macroName, nil, nil, macroText:format(buffIndex)) else EditMacro(macroName, nil, nil, "") end end end; end)