Quantcast
.visibleAuras - WoWInterface
Thread Tools Display Modes
07-23-10, 07:58 AM   #1
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 264
.visibleAuras

From what I can gather from ouF aura.lua, .visibleAuras gives me the current number of Auras (Buffs + Debuffs) visible, is that right?

I'm trying to get its value on my custom PostUpdateIcon function, but everytime I call it, it returns an error.

For example this in my PostUpdateIcon

Code:
i = Auras.visibleAuras
local i=i+i
Returns this error:

Interface\AddOns\oUF_lumen\oUF_lumen.lua:630: attempt to perform arithmetic on local 'i' (a nil value)

Am I getting it wrong? Shouldn't it return an arithmetic value? I think .visibleAuras is a global on oUF right? So I don't need to declare it. I've search for other ouF authors layouts but rarely anyone makes use of this.

Thanks!
__________________
My oUF Layout: oUF Lumen
  Reply With Quote
07-23-10, 09:30 AM   #2
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,698
.visibleAuras is the value you set as a max number of auras shown.
It doesnt return you anything than the value you've set yourself.
  Reply With Quote
07-23-10, 10:20 AM   #3
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 154
Originally Posted by neverg View Post
From what I can gather from ouF aura.lua, .visibleAuras gives me the current number of Auras (Buffs + Debuffs) visible, is that right?

I'm trying to get its value on my custom PostUpdateIcon function, but everytime I call it, it returns an error.

For example this in my PostUpdateIcon

Code:
i = Auras.visibleAuras
local i=i+i
Returns this error:

Interface\AddOns\oUF_lumen\oUF_lumen.lua:630: attempt to perform arithmetic on local 'i' (a nil value)

Am I getting it wrong? Shouldn't it return an arithmetic value? I think .visibleAuras is a global on oUF right? So I don't need to declare it. I've search for other ouF authors layouts but rarely anyone makes use of this.

Thanks!
Is that element really your .Auras element, or is it stored as .Buffs or .Debuffs? The speciallized buff/debuff element versions don't actually set .visibleAuras; They use .visibleBuffs and .visibleDebuffs.

Update code for .Auras element (oUF/elements/aura.lua):
Code:
auras.visibleBuffs = filterIcons(unit, auras, auras.buffFilter or auras.filter or 'HELPFUL', numBuffs, nil,  0, true)
auras.visibleDebuffs = filterIcons(unit, auras, auras.debuffFilter or auras.filter or 'HARMFUL', numDebuffs,true,  auras.visibleBuffs)
auras.visibleAuras = auras.visibleBuffs + auras.visibleDebuffs -- Would throw an error before PostUpdate if either were nil
Update code for .Buffs:
Code:
buffs.visibleBuffs = filterIcons(unit, buffs, buffs.filter or 'HELPFUL', numBuffs)
  Reply With Quote
07-23-10, 10:28 AM   #4
Mischback
A Cobalt Mageweaver
 
Mischback's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 221
Originally Posted by neverg View Post
Code:
i = Auras.visibleAuras
local i=i+i
Returns this error:

Interface\AddOns\oUF_lumen\oUF_lumen.lua:630: attempt to perform arithmetic on local 'i' (a nil value)
Without wanting to say anything against p3lim or Saiket, 'cause they made valid points, let me just point out, that your code makes no sense...

You set i to some value (and yes, it should be set and an arithmetic) and then you declare i as local.
I'm not quite sure, what Lua and WoW will make out of this, but you should try something like this:
Code:
local i = Auras.visibleAuras
i=i+i
I'm can't imagine what this is about, but from the pure source-code-view it should work. Of course, local i = Auras.visibleAuras * 2 will provide the exact same result.
  Reply With Quote
07-23-10, 02:28 PM   #5
Sojik
A Wyrmkin Dreamwalker
 
Sojik's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 53
Like p3lim said visibleAuras is just the maximum visible - something you set - not the amount visible. What are you looking to do, needing to know how many visible auras you have?
  Reply With Quote
07-23-10, 03:53 PM   #6
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 154
Originally Posted by Sojik View Post
Like p3lim said visibleAuras is just the maximum visible - something you set - not the amount visible. What are you looking to do, needing to know how many visible auras you have?
You and p3lim were thinking of .numBuffs and .numDebuffs. .visibleAuras/Buffs/Debuffs changes to reflect the actual number of aura buttons shown.
  Reply With Quote
07-23-10, 04:42 PM   #7
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 264
Originally Posted by Saiket View Post
You and p3lim were thinking of .numBuffs and .numDebuffs. .visibleAuras/Buffs/Debuffs changes to reflect the actual number of aura buttons shown.
That's what I got from the oUF code too, since .visibleAuras (...) it's a sum of .visibleBuffs and .visibleDebuffs.

This is what I have to create my Auras (and it's working):

Code:
-- Auras
        local createAuras = function(self)
        
                local Auras = CreateFrame("Frame", nil, self)
                self.Auras = Auras
                Auras:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", -2, 100)
                Auras.initialAnchor = "TOPLEFT"
                Auras["growth-y"] = "TOP"
                Auras.size = 24
                Auras:SetHeight(24)
                Auras:SetWidth(24)
                Auras.num = 7
                Auras.spacing = 2
                
                Auras.PostCreateIcon = myPostCreateAura
                Auras.PostUpdateIcon = myPostUpdateAura
        end
And then I have a Custom PostUpdateIcon function (I have another one only for the normal Buffs/Debuffs and this one for the .Auras).

When I return Auras.visibleDebuffs to a local variable and try to access it it says gives the error I've displayed above.

When I get back home, I'll put my latest revision code in googlecode so I can show it here.

It should be simple, I just don't get it why It doesn't work.

I want to know how many auras I've up so I can do a cycle to go through all the auras that are active.
__________________
My oUF Layout: oUF Lumen
  Reply With Quote
07-23-10, 04:48 PM   #8
Mischback
A Cobalt Mageweaver
 
Mischback's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 221
If you're using a PostUpdateIcon(), Auras is simply not visible inside of the function. Auras is not global, as far as I can tell.

Protoype is icons:PostUpdateIcon(unit, icon, index, offset), so perhaps you can go with self.Auras.visibleAuras ?
  Reply With Quote
07-23-10, 04:53 PM   #9
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 154
Oh, I didn't notice you were using .PostUpdateIcon. That fires every time a single aura gets shown, before the total visible count is even known.

If you want to update the element once per aura refilter, you should use plain .PostUpdate.
  Reply With Quote
07-23-10, 05:04 PM   #10
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 264
Ok. Going to try both of that when I get home by sunday. Thanks a lot. I'll report my findings!

PS - This WoWInterface people rocks! Thx! ^^

EDIT - Mischback, the code I've put here with local i = i + i it's wrong yes it makes no sense, that is not actually what I had in my code was just to illustrate the type of error I was having. I was getting an error from trying to set a local i = Auras.visibleAuras, then I was trying to print it to the Default Chat Frame to see what I was getting out of it, but was getting into the error I've linked in the start.

Once I get back to this I will report what I found. The idea behind this would be to have an easy way to know how many auras I had up at currently.
__________________
My oUF Layout: oUF Lumen

Last edited by neverg : 07-24-10 at 03:35 AM.
  Reply With Quote
07-25-10, 06:52 PM   #11
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 264
I achieved what I wanted in a different way, so forget about this. :]
__________________
My oUF Layout: oUF Lumen
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » .visibleAuras

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