WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   .visibleAuras (https://www.wowinterface.com/forums/showthread.php?t=34124)

neverg 07-23-10 07:58 AM

.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!

p3lim 07-23-10 09:30 AM

.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.

Saiket 07-23-10 10:20 AM

Quote:

Originally Posted by neverg (Post 199676)
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)

Mischback 07-23-10 10:28 AM

Quote:

Originally Posted by neverg (Post 199676)
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.

Sojik 07-23-10 02:28 PM

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?

Saiket 07-23-10 03:53 PM

Quote:

Originally Posted by Sojik (Post 199771)
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.

neverg 07-23-10 04:42 PM

Quote:

Originally Posted by Saiket (Post 199800)
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.

Mischback 07-23-10 04:48 PM

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 ?

Saiket 07-23-10 04:53 PM

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.

neverg 07-23-10 05:04 PM

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.

neverg 07-25-10 06:52 PM

I achieved what I wanted in a different way, so forget about this. :]


All times are GMT -6. The time now is 03:58 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI