Thread Tools Display Modes
06-16-14, 11:23 AM   #1
ImportedDj
A Deviate Faerie Dragon
Join Date: Jun 2014
Posts: 10
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()
  Reply With Quote
06-16-14, 12:02 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
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)
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 06-16-14 at 12:06 PM.
  Reply With Quote
06-16-14, 12:48 PM   #3
ImportedDj
A Deviate Faerie Dragon
Join Date: Jun 2014
Posts: 10
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?
  Reply With Quote
06-16-14, 01:00 PM   #4
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
You should use "player", self is not a valid unitID.
  Reply With Quote
06-16-14, 01:01 PM   #5
ImportedDj
A Deviate Faerie Dragon
Join Date: Jun 2014
Posts: 10
Alright! Thanks a bunch!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Having issues loading images with Lua..

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