Thread Tools Display Modes
Prev Previous Post   Next Post Next
05-05-11, 01:03 PM   #1
Golle
A Kobold Labourer
Join Date: Jul 2010
Posts: 1
Threat vs Border.

I want to start off by thanking the creators of oUF, thanks to you guys I get to have a really good time enjoying the thrill of "making" my own addon.

Doing the above I just ran into a problem. Working on my layout, which I use the oUF_Lily code, I've set my player frame to contain one big frame with a black color and I call it my Border. On top of it I have a Healthbar, Healthbackground, a Powerbar and a Powerbackground. The way the bars and backgrounds are positioned makes my background-frame, the Border, look like thin borders.

Lately I figured it would be cool to make that border switch to a red color whenever I'm close to taking aggro to alert me of this. Doing so I thought I'd use threat.lua to trigger a function to change the frames color, but apparently threat.lua requires me to have a frame called Threat so I figured I could just rename my Border frame to Threat.
But I can't.

If I rename the frame and its variables from Border to Threat the frame just doesn't seem to load, but the threat-function is called properly. If I reset everything to use the name Border instead the frame now appears but the function is never called. Here's the snippet's of code I'm configuring:

Code:
local PostUpdateThreat = function(status, unit)
	print("threat: ", status, unit)
end

local Player = function(self, unit, isSingle)

        -- Threat/Border frame
        local Threat = CreateFrame("Frame", "PlayerBorder", self)
        Threat:SetPoint("TOPLEFT",0,0)
	Threat:SetFrameStrata("BACKGROUND")
	Threat:SetHeight(50)
	Threat:SetWidth(360)
	local Threattexture = Threat:CreateTexture("THREATLOL")
	Threattexture:SetAllPoints(Threat)
	Threattexture:SetTexture(.0, .0, .0, 1)
	Threat.texture = Threattexture
	self.Threat = Threat

        Threat.PostUpdate = PostUpdateThreat
end
I found that commenting out the "self.Threat = Threat" line is what breaks the code. If I comment it the frame appears, but PostUpdateThreat is never called. If I uncomment it the frame disappears but PostUpdateThreat is called.

I'm confused.
  Reply With Quote
 

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Threat vs Border.


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