Ok I have a problem. My script that I run on my WoWLua is not working. I've tried to work with SecureActionTemplate to run the cast with one click. The script is:
---------------------------------------------------------------------------------------------------------------
local button = CreateFrame("Button", "MyCastButton", handler, "SecureActionButtonTemplate")
local start, duration, enabled = GetSpellCooldown("Shield block");
if enabled == 0 then DEFAULTCHATFRAME:AddMessage("Shield block is currently active, use it and wait " .. duration .. " seconds for the next one."); elseif ( start > 0 and duration > 0) then DEFAULTCHATFRAME:AddMessage("Shield block is cooling down, wait " .. (start + duration - GetTime()) .. " seconds for the next one."); else DEFAULTCHATFRAME:AddMessage("Shield block is ready."); button:SetAttribute("type", "spell"); button:SetAttribute("spell", "Shield block"); end
----------------------------------------------------------------------------------------------------------------
Busically what it have to do is Casting spell when cooldown is ready and writing messages when the cooldown will be ready everytime click the macroed button with "/click MyCastRandButton" on my action bar.
What's wrong and how can I do it correctly? Thank you!