Anticipation tracking on oUF frame
Hello there!
I am trying to track my Anticipation stacks (Rogue Lvl 90 Talent where you can store up additional 5 combo points) on my oUF layout. This is the code inside my function library Lua Code:
... and these are called on my oUF player frame: Lua Code:
My problem is now, it doesn't throw errors, the event call works (chat prints out correct Anticipation stacks when I get one/loose one) - but it doesn't show my frames. :( |
I'm not a proffessional but i think because "anticipation" is a local variable the layout can't access it.
Try: Lua Code:
|
But these are both in the same file. The layout itself doesn't use the variables. Hmmm.
|
Afaik, oUF's event handler is unit-aware, so if you spawn this on the target frame, only the target unit will work.
|
I am spawning it on the player frame, because I don't need the target ("anymore") for CPs in WoD.
As I said, the events fire, the only issue is, the frame I created doesn't show .. the text itself outputs normally, as it should, in my chat. |
Code:
anticipation[i]:SetPoint('LEFT', anticipation[i-1], 'RIGHT', 2, 0) |
Quote:
|
What you're doing seems like a really strange way to go about adding a custom element to your frame. Why aren't you just creating the objects right away, as I assume you're already creating your health bar etc. right away? Even if you pick an event your frame will receive, and register it correctly, there's just no reason to delay creating an element -- just create it. I'd also recommend making a proper element, rather than just registering some events directly on your frame. The CPoints element can easily be adapted to handle Anticipation instead -- make a copy, rename, and edit.
Oh, and there's no reason to waste memory creating a separate frame for the backdrop; since you're only using a backdrop texture, with no border, you should just use a texture: Code:
local bg = bar:CreateTexture(nil, "BACKGROUND") |
Phanx, I deleted the chat messages, because after I saw that the events are working I removed the unneccessary code. So, it's the actual code w/o print messages. Also, I only wanted to post the relevant code.
First, thanks for the tip with the background texture.. haven't thought of that. I haven't tried it with a modified CPoints method, because instead of a variable/function/whatever it is on the target, I track my buffs, because Anticipation is just a buff with stacks on my buff bar. (I am not thaaaat good with Lua, tho' :( ) Guess I'll try that out. |
Yeah, so just replace the part that queries combo points with a UnitBuff query, and the part that registers combo point events with a UNIT_AURA registration, in addition to renaming the element itself.
Also, please stop wasting resources looking up the buff name with GetSpellInfo every time UNIT_AURA fires -- look it up once and store it in a variable: Code:
local ANTICIPATION = GetSpellInfo(115189) Code:
local _, _, _, stacks = UnitBuff("player", ANTICIPATION) |
Shame on me, thank you! :)
I'll try out using the CPoints function as base. |
So, after I got from work .. I tried it again how Phanx it suggested. It works. I am quite happy with the result, thanks for the help!
Just working on styling it a bit now. :) |
All times are GMT -6. The time now is 01:27 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI