GwGarrisonButton is a frame created by GW2 UI
The goal with that code is to change gwbutton's texture to another one.
If I get it to work I'll start employing the same to other frames
Lua Code:
UIMod_UpdateInterval = 0.3; -- How often the OnUpdate code will run (in seconds)
f.TimeSinceLastUpdate = 0
f:SetScript("OnUpdate",function(self,elapsed)
local gwbutton = GwGarrisonButton
local garrisonType = C_Garrison.GetLandingPageGarrisonType()
local covenantID = C_Covenants.GetActiveCovenantID()
self.TimeSinceLastUpdate = self.TimeSinceLastUpdate + elapsed;
if (self.TimeSinceLastUpdate > UIMod_UpdateInterval) then
print("UIMOD OnUpdate");
if gwbutton and gwbutton:IsShown() and gwbutton:IsVisible() and (covenantID ~= 0 or garrisonType == 111 or garrisonType == 3) then
print("UIMOD OnUpdate: GW2 UI Garrison Button is shown. Editing texture.");
gwbutton:SetTexture("Interface/AddOns/UIMod/textures/icon-1")
end
self.TimeSinceLastUpdate = 0;
UIMod_UpdateInterval = 30.0;
end
end)
However this returns me an error. Apparently I can't use SetTexture that way. I tried googling around but only found people talking about changing Blizzard's default textures.
How do I change the texture of a frame created by another addon?
Maybe a XML file could help in this case?