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.