Thread Tools Display Modes
08-16-06, 12:55 PM   #1
Lathek
A Kobold Labourer
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 1
Help with SetTexture()

This is my first time using lua and the WoW API. I am trying to make a target of target buff frame, but I am having trouble with SetTexture(). The only way I can seem to get any texture to appear is by putting file="texturelocation" as an attribute for <Texture>

Here is the relevant code:

xml
Code:
	<Frame name="sToTBuff">
		<Layers>
			<Layer level="BACKGROUND">
				<Texture name="sToTBuff1">
					<Size>
						<AbsDimension x="30" y="30" />
					</Size>
                       			<Anchors>
						<Anchor point="TOPLEFT" relativeTo="sToT" relativePoint="BOTTOMLEFT" />
					</Anchors>
				</Texture>
				<Texture name="sToTBuff2">
					<Size>
						<AbsDimension x="30" y="30" />
					</Size>
					<Anchors>
						<Anchor point="LEFT" relativeTo="sToTBuff1" relativePoint="RIGHT" />
					</Anchors>
				</Texture>
				<Texture name="sToTBuff3">
					<Size>
						<AbsDimension x="30" y="30" />
					</Size>
					<Anchors>
						<Anchor point="LEFT" relativeTo="sToTBuff2" relativePoint="RIGHT" />
					</Anchors>
				</Texture>
			</Layer>
		</Layers>
		<Scripts>
			<OnUpdate>
				sToT_UpdateBuff();
			</OnUpdate>
		</Scripts>
	</Frame
and lua
Code:
function sToT_UpdateBuff()
	--if event=="UNIT_AURA" then
		--for i = 1,16 do
			buff = UnitBuff("targettarget", 1);
			if buff then
				buff = string.gsub(buff, "\\", "\\\\");
			end
			sToTBuff1:SetTexture(buff); --sToTBuff..i doesn't work. Is there any way to set textures for each buff slot easily? Just using this to get one buff texture working.
		--end
	--end
end
I originally called sToT_UpdateBuff() from <OnEvent> but somehow that didn't work at all, so I stuck it in <OnUpdate> for now.

Anyone see what I am doing wrong? I hope the whole hing isn't completely incorrect.
  Reply With Quote
08-16-06, 03:47 PM   #2
MetaHawk
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5
How about...

getglobal("sToTBuff"..i):SetTexture(buff);

I take it you are also registering that event in an 'OnLoad' statement?
ie: this:RegisterEvent("UNIT_AURA");


Last edited by MetaHawk : 08-16-06 at 03:58 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Help with SetTexture()


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