Thread Tools Display Modes
08-05-10, 07:05 AM   #1
Miiru
A Flamescale Wyrmkin
 
Miiru's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 138
Lua Background Issue

Hello. I'm having a problem with a custom addon i've created recently. This is the lua code:
Code:
i = 1
while i <= 36 do
bla = "ContainerFrame1Item"..i
--print(i)
--print(bla)
MeinAddonFrame = CreateFrame("Frame","bla", ContainerFrame1Item1)
MeinAddonFrame:EnableMouse(true)

MeinAddonFrame:SetMovable(false)
MeinAddonFrame:SetWidth(30)
MeinAddonFrame:SetHeight(30)
MeinAddonFrame:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background",
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
edgeSize= 16, insets = { left = 0, right = 0, top = 0, bottom = 0 }})
MeinAddonFrame:SetBackdropColor(0.0,0.0,0.0,0.9)
MeinAddonFrame:ClearAllPoints()
MeinAddonFrame:SetPoint("CENTER", "ContainerFrame1Item"..i)
i=i+1
end
Everything works out fine so far. Now i want to exchange the Interface/Tooltips/UI-Tooltip-Border texture.
So i create a .tga file with dimensions which are a power of 2 (32x32) and change the path in the lua. Next thing i notice is that it doesnt show any texture anymore, but it doesnt return an error either (--print(i) and --print(bla) returns also show that everything works fine it just doesnt seem to load the file).

Maybe somebody can help me.
  Reply With Quote
08-05-10, 08:06 AM   #2
Mischback
A Cobalt Mageweaver
 
Mischback's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 221
Try

lua Code:
  1. MeinAddonFrame:SetBackdrop({bgFile = "Interface\\AddOns\\PATH\\TO\\YOUR\\texture",
  2. edgeFile = "Interface\\AddOns\\PATH\\TO\\YOUR\\texture",
  3. edgeSize= 16, insets = { left = 0, right = 0, top = 0, bottom = 0 }})
__________________
  Reply With Quote
08-05-10, 08:21 AM   #3
Miiru
A Flamescale Wyrmkin
 
Miiru's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 138
Works like a charm. So i understand is that if you write the path with / it takes texture out of the .mpq and with \\ it takes the texture out of the actual wow folder?
  Reply With Quote
08-05-10, 08:27 AM   #4
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
OK, a couple of things:

1) Textures are loaded when you start the WoW executable. If you create a new texture in a new location you will need to restart the WoW executable to be able to load the texture. (/console reloadui will not work in this scenario)

2) If your texture still does not work, then check out this guide from wowace

3) Make sure you declare variables to be local, especially if they have common names (e.g. i)
  Reply With Quote
08-05-10, 08:58 AM   #5
Mischback
A Cobalt Mageweaver
 
Mischback's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 221
Originally Posted by Neza View Post
Works like a charm. So i understand is that if you write the path with / it takes texture out of the .mpq and with \\ it takes the texture out of the actual wow folder?
I can't say 'yes' or 'no' to this. When I started addon-programming, I adapted this and stick to it, just because it works.
__________________
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Lua Background Issue


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