View Single Post
08-11-14, 02:48 AM   #34
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You're never setting the OnUpdate script on the bars. Not sure if this was missing in my original code or not since I'm too lazy to go look, but this should fix that:
Code:
     bar.timeLeft = 0
     bar:SetMinMaxValues(0, 1)
     bar:SetScript("OnUpdate", bar_OnUpdate)
     icon.bar = bar
Another thing I noticed is this:
Code:
local function auras_PostCreateIcon(frame, icon)
     local frame = frame.__owner
Blindly renaming all "self" variables to "frame" is not a good idea. Here, you're overwriting your own variable, and losing access to whatever the first one referred to. In this case it doesn't end up affecting anything, since you didn't want to access the first one after reading its "__owner" key, but it's not something you should be in the habit of doing, as it's also fairly confusing for people reading your code, and will probably be confusing to you if you don't look at this code for a few months or years. If you really don't want any variables named "self" then there are still plenty of other things you can name your variables that make more sense:
Code:
local function auras_PostCreateIcon(element, icon)
     local frame = element.__owner
You may want to double-check the rest of the code where you've searched-and-replaced "self" with "frame" to make sure you haven't overwritten any frame references you actually need.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote