WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Issue Changing CraftFrame Colors (https://www.wowinterface.com/forums/showthread.php?t=58739)

pinkney 05-17-21 03:02 AM

Issue Changing CraftFrame Colors
 
I have an addon (Lorti-UI-Classic) that recolors the default WoW UI frames. However it's not applied to the craft frame and tradeskill frames. I am trying to add that.

Here's an example of the code it has that successfully recolors the Character frame:

--PAPERDOLL/Characterframe
local a, b, c, d, _, e = PaperDollFrame:GetRegions()
for _, v in pairs({a, b, c, d, e

})do
v:SetVertexColor(.35, .35, .35)
end


When I try to do the same to the CraftFrame window, it throws a Lua error.

The code I used is basically the same as above:

--CraftFrame
local a, b, c, d, _, e = CraftFrame:GetRegions()
for _, v in pairs({a, b, c, d, e

})do
v:SetVertexColor(.35, .35, .35)
end


I used "/framestack" to get the names of the windows. I did it for CraftFrame and TradeFrame. The error says:

Message: Interface\AddOns\Lorti-UI-Classic\core\frames.lua:383: attempt to index global 'CraftFrame' (a nil value)

Even if I try to just manually set the region windows without the loop, it still doesn't seem to work. However there is no error -- I think it just doesn't recolor anything.

Any ideas? Thanks in advance!

Rilgamon 05-17-21 03:49 AM

I'm confused. What frame and what error belong together?

For the Lua-Error "Message: Interface\AddOns\Lorti-UI-Classic\core\frames.lua:383: attempt to index global 'ChatFrame' (a nil value)"

Thats because there is not one chatframe but as many as you create.
NUM_CHAT_WINDOWS represents the number of chatframes and the name would be "ChatFrame1" to "ChatFrameN".

pinkney 05-17-21 04:17 AM

I'm sorry I put "ChatFrame" but it's actually "CraftFrame."

Interface\AddOns\Lorti-UI-Classic\core\frames.lua:382: attempt to index global 'CraftFrame' (a nil value)

pinkney 05-17-21 05:45 AM

I think I narrowed something down... when I do:

/dump CraftFrame:GetRegions()

It throws an error. However, if I open the CraftFrame (my enchanting window) and then re-run the command, it returns a value.

I guess I need the re-coloring to occur after the window has been opened? Or force open+close the window somehow on load? I dunno.

Rilgamon 05-17-21 08:57 AM

CRAFT_SHOW fires for it. Should be easy to wait for it.


All times are GMT -6. The time now is 09:10 AM.

vBulletin © 2021, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI