-
Posted by vyntrox on Fri, 19 Jul 2013 13:01:42
hi all,
working on my own addon and ran into am dead end.
so basically what i want. iv'e got my frame with texture. this texture should change if the target is elite, rare, normal, boss etc. but change should be done with SetTexCoord.
so this is what i got with some help, but it does nothing at the moment.
--- <| BACKGROUND |> ------------------------- ---------------------------------------------- Back = CreateFrame('Frame', nil, self) Back:SetPoint("TOPLEFT", self) Back:SetPoint("BOTTOMRIGHT", self) Back:SetFrameStrata("BACKGROUND") local MyTargetBGTex = Back:CreateTexture() MyTargetBGTex:SetParent(Back) MyTargetBGTex:SetAllPoints(Back) MyTargetBGTex:SetTexture("Interface\\Addons\\zAoCTextures\\media\\unitframe_bgs.tga") MyTargetBGTex:SetTexCoord(0,0.5,0,0.5) -- (left,right,top,bottom) local function MyTargetBGTex_Update() local class = UnitClassification("target") if ( class == "worldboss" ) then MyTargetBGTex:SetTexCoord(0.5,1,0.5,1) elseif ( class == "rareelite" or class == "elite" ) then MyTargetBGTex:SetTexCoord(0,0.5,0.5,1) elseif ( class == "rare" ) then MyTargetBGTex:SetTexCoord(0.5,1,0,0.5) else MyTargetBGTex:SetTexCoord(0,0.5,0,0.5) end end Back:RegisterEvent("PLAYER_TARGET_CHANGED", MyTargetBGTex_Update) Back:RegisterEvent("UNIT_CLASSIFICATION_CHANGED", MyTargetBGTex_Update)
can someone please help me?
greetings a programming newbie named vyntrox :)
-
Posted by jnwhiteh on Thu, 08 Aug 2013 05:15:28
Which part of it isn't working? Have you tested the individual functionality by calling things directly? WowLua (the addon) can be a big help for doing this. I'd play with the individual bits and see if you can figure out what precisely isn't working.