Hi, does anyone know why a secure state driver wouldn't work for Forms (Shapeshifted forms).
Im inheriting from the templates SecureActionButtonTemplate, SecureHandlerDragTemplate, and SecureUnitButtonTemplate.
this is some of the code I've tried
Lua Code:
self:SetAttribute("_onstate-form", [[
if newstate == "form" then
print("form");
elseif newstate == "noform" then
print("no form!");
else
print("error!");
end
]]);
RegisterStateDriver(self, "form", "[@player, noform] noform; [@player, form] form");
Any help would be great.
[Edit] it appears that the state driver only fails to work when using it on a button widget. I Don't know why it will not work, any clues would be great.
[Edit]Apparently the only way to get this to work correctly with buttons, is to use this...
Lua Code:
self = CreateFrame("Button", name, nil, "SecureActionButtonTemplate, SecureHandlerDragTemplate, SecureHandlerStateTemplate");
SecureHandlerWrapScript(self, "OnAttributeChanged", self, [[
if (name == "state-form") then
if (value == "noform") then
self:SetAttribute("actionpage", GetActionBarPage());
elseif (value == 1) then
self:SetAttribute("actionpage", 6 + GetBonusBarOffset());
elseif (value == 3) then
self:SetAttribute("actionpage", 6 + GetBonusBarOffset());
else
self:SetAttribute("actionpage", GetActionBarPage());
end
end
]]);
RegisterStateDriver(self, "form", "[form:0] noform; [form:0] noform; [form:1] 1; [form:3] 3; noform");
Anyways though I found the answer after digging through Google and about 12 hours of work lol, i only wish there was more documentation on Secure Wow Api and it's many quirks lol