Hi all
I have a list of spells, (hearthstones), that I want to cancel during it's cast.
This is a secure action so I have set up the button as a SecureActionButtonTemplate.
Lua Code:
if event == "UNIT_SPELLCAST_SENT" then
unit, _, _, spellID = ...
if unit == "player" then
for k, v in pairs(hearthtonesList) do
if spellID == v then
print("found") -- debug --
b.hiddenSpellStopButton:Click()
end
end
end
end
b.hiddenSpellStopButton = CreateFrame("Button", nil, nil, "SecureActionButtonTemplate")
b.hiddenSpellStopButton:RegisterForClicks("AnyDown")
b.hiddenSpellStopButton:SetAttribute("type", "macro")
b.hiddenSpellStopButton:SetAttribute("macrotext", "/stopcasting")
b.hiddenSpellStopButton:SetScript(
"OnClick",
function()
print("here i am") -- debug --
end
)
b:RegisterEvent("UNIT_SPELLCAST_SENT")
I get both of the prints, so I can confirm that the button does click yet the spell does not stop the cast.
I have been banging away for the last few days trying to get this working.
Is there a way to stop a cast?