WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Having issues loading images with Lua.. (https://www.wowinterface.com/forums/showthread.php?t=49396)

ImportedDj 06-16-14 11:23 AM

Having issues loading images with Lua..
 
I'm trying to load the current Image:


However when it loads up in WoW it comes up as a Green box.. From what i know that's caused by the image not being a power of 2.. However the Images Dimensions are 256x64 so they are a power of 2.. I cant see why else the green box would be appearing.. this is the current code I'm using..

Code:

--Create a Frame for UI to be placed in

local frame = CreateFrame("Frame",ShowUF,UIParent)

local ufTexture = frame:CreateTexture()
ufTexture:SetPoint("CENTER", "UIParent")
ufTexture:SetSize(256,64)
ufTexture:SetTexture("Interface\\AddOns\\WoWUI\\Background\\NaTUI")
frame.texture = ufTexture


frame:SetSize(256,64)
frame:Show()


Fizzlemizz 06-16-14 12:02 PM

If the texture is a power of 2 in size then showing a green box usually means that WoW can't find the texture in the location you provided or, you have placed the texture in the right place but you need to exit wow (all the way out) and re-start as WoW caches file locations only when it loads. Also it needs to be a .blp or a .tga with an alpha layer.

Code:

local frame = CreateFrame("Frame",ShowUF,UIParent)

frame.ufTexture = frame:CreateTexture()
frame.ufTexture:SetTexture("Interface\\AddOns\\WoWUI\\Background\\NaTUI")
frame.ufTexture:SetPoint("CENTER", UIParent)
frame.ufTexture:SetSize(256,64)


ImportedDj 06-16-14 12:48 PM

Thanks for the fast reply! i managed to get it sorted out thanks, it seems WoW was cached and wouldnt load it. At the moment im trying to get the current players health and mana to fill out the areas in the unitframe. When i get to his area

Code:

local health = UnitHealth(unit);
Should i use "Self" or "Player" in order to get your self Health and Mana?

semlar 06-16-14 01:00 PM

You should use "player", self is not a valid unitID.

ImportedDj 06-16-14 01:01 PM

Alright! Thanks a bunch! :)


All times are GMT -6. The time now is 10:32 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI