UnitBuff help
So finally making aura for my group frames after I found what seemed like a great example but I'm a bit stuck. The example I found uses (select(4,UnitBuff("player","AURANAME))) So I think I can use "group" but obviously it doesn't work. Do I have to repeat the event checkfor party and raid? I'm using ouf for the raid frames
Indicater script Lua Code:
SVN is currently down for some reason can't post to it, so here's pastebin config http://pastebin.com/d32JQuK8 group frame code http://pastebin.com/SJEzm9xn |
First of all, your event handler will never fire because it's on "indicatorframe" and you're registering UNIT_AURA events for everything except the frame with your actual event handler.
The frame you have SetScript('OnEvent') on is what you need to register the event for. Secondly, nothing past your first if statement in the event handler is going to be called. You're only watching one event, so there's no point in checking what event is being fired, and all of your else conditions are identical to the first condition, so if it's true it will never get to them. Also, checking "if indicator1 == nil" then attempting to HIDE indicator1 will result in an error if that frame doesn't actually exist. edit: Actually I just reread it and I guess you named the result of the UnitBuff function the same thing as your frames, which would half explain that part. |
Also:
All of those "indicatorframe" and "indicatorN" variables are globals, which is not so great, and "IndicatorFrame" is a pretty bad global object name too... especially since you're using the same globals for every unit's indicator frame. You're using CreateFrame wrong when you create the indicators -- you're passing nil and "OVERLAY" which would be fine if those were texture or fontstring creations, but not for a frame. You need to pass a frame type (eg. "Frame"), a name (should be nil here), and a parent (should be self here). You're also passing "party" to UnitBuff, but "party" is not a valid unit token, and you don't want to hardcode a unit here, because it looks like you're intending for these indicators to be added to multiple units' frames. Lua is case-sensitive, so "indicatorframe" and "indicatorFrame" are not the same thing -- you should be getting a nil value error from your SetScript line, since "indicatorFrame" is not defined as a frame or anything else. Change your whole indicator section to this: Code:
if cfg.indicators.enable then Code:
local indicatorPositions = { "TOPLEFT", "TOPRIGHT", "BOTTOMLEFT", "BOTTOMRIGHT" } |
ok so bugsack is dropping this error on me
Code:
2x oUF_Bob-1.1\modules\group-Group.lua:185: attempt to get length of global "indicatorPositions" (a nil value) not sure what to do about that as it's a bit beyond me >.> |
You can't access a local variable before it's declared.
So you need to move these.. Lua Code:
Lua Code:
|
I figured that but when I do that I get an ouf error. but not a lua error.
Code:
oUF: Error: Style [BobGroup] attempted to register event [UNIT_AURA] on unit [raid] with a handler that doesn't exist. Code:
10x oUF_Bob-1.1\modules\group-Group.lua:24: attempt to index global "indicators" (a nil value) |
Well, I don't know anything about oUF, but either you didn't put the "UpdateIndicators" function above the "Shared" function or it needs a global name, in which case you're going to want to rename it to something more unique like "BobsIndicatorUpdater" and fix 'self:RegisterEvent("UNIT_AURA", UpdateIndicators)' to reflect the new name.
|
Quote:
code |
Alright, get rid of the UpdateIndicators function, leave indicatorPositions and indicatorBackdrop above the Shared function, and change the "if cfg.indicators.enable then" block to this..
Lua Code:
|
1 Attachment(s)
looks like adding the self.indicators did it however they show at all times. Probably because they only have backdrops maybe? Anyways I'm heading to bed got a smallish accomplishment done so thats enough to satisfy me.
|
It looks like the frames aren't hidden by default.
After "local indicator = CreateFrame" add indicator:Hide() |
Quote:
|
All times are GMT -6. The time now is 10:29 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI