My last code for toggle spells by using macros:
PHP Code:
if INIT == nil then INIT = true
VFQ = { {GetSpellInfo(122470), 0}, -- Touch of karma
{GetSpellInfo(122783), 0}, -- Diffuse magic
}
function RVFQ(SpellName)
for i = 1, #VFQ do
if VFQ[i][1] == SpellName then return true, i, VFQ[i][2] end
end
end
SLASH_TOGGLESPELL1 = "/ToggleSpell"
SlashCmdList["TOGGLESPELL"] = function(SpellName)
SpellExist, N = RVFQ(SpellName)
if SpellExist then
VFQ[N][2] = (VFQ[N][2] == 1) and 0 or 1
print(string.format("The following spell has been %s the rotation: %s", VFQ[N][2] == 1 and "|cff00ff00included|r in" or "|cffff0000excluded|r from", GetSpellLink(SpellName)))
end
end
end
works fine but only while all the addons are disabled.
With addons and in combat, if i do any action with VFQ table, like
PHP Code:
if select(3, RVFQ(GetSpellInfo(122470))) == 1 then CastSpellByName(GetSpellInfo(122470), "target") end
or
if VFQ[1][2] == 1 then CastSpellByName(GetSpellInfo(122470), "target") end
or even
PHP Code:
if select(3, RVFQ(GetSpellInfo(122470))) == 1 then print(" ") end
or
if VFQ[1][2] == 1 then print(" ") end
or something else, it causes an error message "Modification has been blocked from an action only available to the Blizzard UI". I can't turn off the error message and rotation no longer use abilities, just auto-attack until /reload.