Quantcast
Using SetTexture to change the texture of a frame created by another addon? - WoWInterface
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
12-18-20, 01:55 PM   #1
Krainz
A Wyrmkin Dreamwalker
Join Date: Oct 2016
Posts: 57
Using SetTexture to change the texture of a frame created by another addon?

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:
  1. UIMod_UpdateInterval = 0.3; -- How often the OnUpdate code will run (in seconds)
  2.  
  3.  
  4. f.TimeSinceLastUpdate = 0
  5.  
  6. f:SetScript("OnUpdate",function(self,elapsed)
  7.         local gwbutton = GwGarrisonButton
  8.         local garrisonType = C_Garrison.GetLandingPageGarrisonType()
  9.         local covenantID = C_Covenants.GetActiveCovenantID()
  10.     self.TimeSinceLastUpdate = self.TimeSinceLastUpdate + elapsed;
  11.  
  12.  
  13.     if (self.TimeSinceLastUpdate > UIMod_UpdateInterval) then
  14.         print("UIMOD OnUpdate");
  15.                 if gwbutton and gwbutton:IsShown() and gwbutton:IsVisible() and (covenantID ~= 0 or garrisonType == 111 or garrisonType == 3) then
  16.                         print("UIMOD OnUpdate: GW2 UI Garrison Button is shown. Editing texture.");
  17.                         gwbutton:SetTexture("Interface/AddOns/UIMod/textures/icon-1")
  18.                 end
  19.  
  20.  
  21.         self.TimeSinceLastUpdate = 0;
  22.         UIMod_UpdateInterval = 30.0;
  23.     end
  24. 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?
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Using SetTexture to change the texture of a frame created by another addon?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off