Yeah I used a XML file because the
wowwiki article instructed to...
So I shouldn't use XML files when I'm not creating actually graphical UI frames?
Originally Posted by Kanegasi
Put the OnUpdate in Lua.
Lua Code:
self.TimeSinceLastUpdate = 0 f:SetScript("OnUpdate",function(self,elapsed) local gwbutton = GwGarrisonButton self.TimeSinceLastUpdate = self.TimeSinceLastUpdate + elapsed; if (self.TimeSinceLastUpdate > UIMod_UpdateInterval) then print("UIMOD OnUpdate"); if gwbutton then print("UIMOD OnUpdate: GW2 UI Garrison Button is shown. Hiding."); gwbutton:Hide(); end -- self.TimeSinceLastUpdate = 0; end end)
|
This is my core.lua now but the OnUpdate funcion still isn't happening. Not even firing the debug prints
Lua Code:
local addon, ns = ...
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:RegisterEvent("PLAYER_LOGIN");
f:SetScript("OnEvent", function(self, event, ...)
local garrisonType = C_Garrison.GetLandingPageGarrisonType()
local covenantID = C_Covenants.GetActiveCovenantID()
local gwbutton = GwGarrisonButton
if event == "PLAYER_ENTERING_WORLD" then
print("UIMOD: Hello! Hello " .. event);
print(covenantID);
if gwbutton then
print("UIMOD Entering World: GW2 UI Garrison Button is shown. Hiding.");
gwbutton:Hide();
end
-- if not covenantID=0 or garrisonType=3 then
-- print("UIMOD: Covenant Chosen or Order Hall enabled.");
-- if gwbutton and gwbutton:IsShown() then
-- print("UIMOD: GW2 UI Garrison Button is shown. Hiding.");
-- gwbutton:Hide();
-- end
-- end
elseif event == "PLAYER_LOGIN" then
print("UIMOD: Hello! Hello " .. event);
print(covenantID);
if gwbutton then
print("UIMOD Player Login: GW2 UI Garrison Button is shown. Hiding.");
gwbutton:Hide();
end
end
end)
UIMod_UpdateInterval = 1.0; -- How often the OnUpdate code will run (in seconds)
self.TimeSinceLastUpdate = 0
f:SetScript("OnUpdate",function(self,elapsed)
local gwbutton = GwGarrisonButton
self.TimeSinceLastUpdate = self.TimeSinceLastUpdate + elapsed;
if (self.TimeSinceLastUpdate > UIMod_UpdateInterval) then
print("UIMOD OnUpdate");
if gwbutton then
print("UIMOD OnUpdate: GW2 UI Garrison Button is shown. Hiding.");
gwbutton:Hide();
end
--
self.TimeSinceLastUpdate = 0;
end
end)
I tried removing core.xml from the TOC to no avail