Thread Tools Display Modes
03-22-15, 04:28 PM   #1
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
making raid frame indicators

So for some reason the indicators frames I remember working are no longer working properly at all, I don't seem to be getting any errors

source code
indicator function
indicator build

config

this is just a small renew but seems to light up all the auras
Attached Thumbnails
Click image for larger version

Name:	2.PNG
Views:	197
Size:	32.0 KB
ID:	8551  
__________________
Tweets YouTube Website
  Reply With Quote
03-23-15, 02:34 PM   #2
Munglunch
Premium Member
 
Munglunch's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jun 2009
Posts: 34
Blind test

So I can't be positive without testing the full code (im at work so I can't for another hour) BUT here is something to hopefully point you in the right direction.

Your event function has no restriction on what unit its referencing aura-wise (not sure how much this matters in context)

I added an extra key to the "indicators" object that can hold the frames unit token

Lua Code:
  1. if cfg.indicators.enable then
  2.         local indicators = CreateFrame("Frame", nil ,self)
  3.         indicators:SetAllPoints(true)
  4.         indicators:EnableMouse(false)
  5.         self.indicators = indicators
  6.         self.indicators.unit = unit
  7.         -- Build the indicators
  8.         for i = 1, #indicatorPositions do
  9.             local position = indicatorPositions[i]
  10.             local indicator = CreateFrame("Frame", nil, indicators)
  11.             indicator:Hide()
  12.             indicator:SetPoint(position)
  13.             indicator:SetSize(5, 5)
  14.             indicator:SetBackdrop(indicatorBackdrop)
  15.             indicator.aura = cfg.indicators["aura"..i]
  16.             indicators[position] = indicator
  17.         end
  18.  
  19.         -- Register the event on the frame itself
  20.         self:RegisterEvent("UNIT_AURA", UpdateIndicators)
  21.     end

...which can then be referenced in the event function. Also don't know if "SetShown" will evaluate a string return as true or not so I altered it slightly.

Lua Code:
  1. local function UpdateIndicators(self, event, unit)
  2.     if(unit ~= self.indicators.unit) then return end
  3.     for i = 1, #indicatorPositions do
  4.         local position = indicatorPositions[i]
  5.         local indicator = self.indicators[position]
  6.         indicator:SetShown(UnitBuff(unit, indicator.aura) ~= nil)
  7.     end
  8. end

..again just to help give perspective.
  Reply With Quote
03-24-15, 10:46 PM   #3
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Originally Posted by Munglunch View Post
So I can't be positive without testing the full code (im at work so I can't for another hour) BUT here is something to hopefully point you in the right direction.

Your event function has no restriction on what unit its referencing aura-wise (not sure how much this matters in context)

I added an extra key to the "indicators" object that can hold the frames unit token

Lua Code:
  1. if cfg.indicators.enable then
  2.         local indicators = CreateFrame("Frame", nil ,self)
  3.         indicators:SetAllPoints(true)
  4.         indicators:EnableMouse(false)
  5.         self.indicators = indicators
  6.         self.indicators.unit = unit
  7.         -- Build the indicators
  8.         for i = 1, #indicatorPositions do
  9.             local position = indicatorPositions[i]
  10.             local indicator = CreateFrame("Frame", nil, indicators)
  11.             indicator:Hide()
  12.             indicator:SetPoint(position)
  13.             indicator:SetSize(5, 5)
  14.             indicator:SetBackdrop(indicatorBackdrop)
  15.             indicator.aura = cfg.indicators["aura"..i]
  16.             indicators[position] = indicator
  17.         end
  18.  
  19.         -- Register the event on the frame itself
  20.         self:RegisterEvent("UNIT_AURA", UpdateIndicators)
  21.     end

...which can then be referenced in the event function. Also don't know if "SetShown" will evaluate a string return as true or not so I altered it slightly.

Lua Code:
  1. local function UpdateIndicators(self, event, unit)
  2.     if(unit ~= self.indicators.unit) then return end
  3.     for i = 1, #indicatorPositions do
  4.         local position = indicatorPositions[i]
  5.         local indicator = self.indicators[position]
  6.         indicator:SetShown(UnitBuff(unit, indicator.aura) ~= nil)
  7.     end
  8. end

..again just to help give perspective.
Perspective is better than nothing
__________________
Tweets YouTube Website
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » making raid frame indicators

Thread Tools
Display Modes

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