I've started playing around with a new layout and I've gotten most things working, however there is a small arrow that I am using to indicate power on the power bar. I've included an image since it is a little hard to explain

It works most of the time but others I need to do a /rl to have it pick up the proper color. Also if I am on a druid and I shapeshift to a different form it doesn't update. I'm sure I'm just missing some thing but I'm not sure how to go about making it update. Any help would be appreciated.

How did you created the arror? (is it a texture, what is its parent frame and what events are registered to the frame?)

You have 2 options: creating an element as an oUF module and registering the proper events so it updates correctly, or just do it directly in the layout. This is what I currently use for threat, maybe it helps you a bit

Basically...register the event to your arrow frame and then call UnitPowerType player and set the color of the arrow.

I recommend registering PLAYER_LOGIN aswell. By that time the function will be working and you should be able to set the color correctly.

Sth like this should work...

lua Code:

--set color

lib.setArrowColor =function(self)

local _, pType = UnitPowerType("player")

local pcolor = oUF.colors.power[pType]or{.3,.45,.65}

self.arrow:SetVertexColor(unpack(pcolor))

end

--hook events

self:RegisterEvent("PLAYER_LOGIN", lib.setArrowColor)

self:RegisterEvent("PLAYER_ENTERING_WORLD", lib.setArrowColor)

self:RegisterEvent("UNIT_DISPLAYPOWER", lib.setArrowColor)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Btw I found a neat trick for threat coloring (I guess I'm the last one to find out about forceUpdate O_O).
It is awesome because if color is set via self.Health.colorHealth = true then if you don't have aggro the color will stay and the color is updated as soon as any of the events if fired.

Thanks Zork. My way didn't work. Well it works, until you enter combat and try to perform an action. How would I implement your solution. Would I just call it from within the arrow code or would I have to add it in some where else? I'm going to try and play around with it see if I can figure it out. I do appreciate any help you can offer though. I think I'm in way over my head here.

I either need to start drinking or stop I'm not sure which. I've got the postupdate working. Seems to be doing the job. I've uploaded a short vid to youtube since it is pretty hard to describe exactly what is going on.

If you watch it in 1080p you can see what is going on. The lower resolutions suck.

in Zork's (and in mine) example you register an event and assign an event handler (that's setArrowColor in Zork's code) to it. You'll just pick the player frame for this. The handler has to be known before you assign it, meaning if you are using one file for all, setArrowColor has to be defined before your style function. If you are using different files, then the file that contains the declaration of setArrowColor has to be loaded before the file with your style function. By style function I mean the function set in oUF:RegisterStyle("style name", style_function). If you use the UnitSpecific table, you could register the event there, else it goes into the style function like this:

Only using UNIT_DISPLAYPOWER would be better as it is the only one you need (maybe apart from PLAYER_ENTERING_WORLD but you'd rather test this) and it fires a whole lot less that UNIT_POWER. Why does registering the events to the frame not work? Any errors? Could you post your code?

Well I finally figured out what I was doing wrong. I was trying to put the registerevent lines into the creation code for the arrow rather than in the layout code. If that makes sense. Anyhow it is working. Final code looks like this:

Big thanks to both of you for helping. I get my head so twisted up some times I think I over complicate things. This code seems much faster for the updates.

New question now, can I use the same sort of RegisterEvent in a tag? It seems now that if my power bar is at full (say in cat form full energy) and I switch to caster form (full mana) it still shows 100 (energy) rather than 6.0k (mana).

Yes and thank you. I was frustrated and lost my focus. Things just didn't want to line up yesterday. When I went back to it after a couple hours I saw the errors I had made and it finally clicked. I really appreciate your help and patience Zork. Thank you.

I have made the combobar as a simple frame with 5 text strings, that stay at .2 alpha when not up, then go at alpha 1 when the combo builds up.

The fact is that i want to register the shapeshift events for make them disappear completely when the druid isn't in cat form.

Same would be good for eclipse bar, displaying it only when in moonkin form.

Is it possible or it's something that i canot achieve? thanks.

No, I didn't want to suggest an altering of oUF's core! At least not on parts, that are working perfectly.
On the other hand, the cpoints-module doesn't include a PostUpdate (hint at haste!), so you'll have to put some effort into it!

Go and style your CPoints in your layout as you want them to be. Don't include any conditions to them, though.

The oUF-module DOES include the possibility to override the original update-function, and this would be the way to go!

You can merely use, what you already got and put it into a function inside of your layout

lua Code:

localfunction CPointsOverride(self, event, unit)

if(unit =='pet')thenreturnend

local cp =nil

if(UnitHasVehicleUI'player')then

cp = GetComboPoints('vehicle', 'target')

else

cp = GetComboPoints('player', 'target')

end

local cpoints = self.CPoints

if(cp)then

cpoints:Show()

for i=1, MAX_COMBO_POINTS do

if(i <= cp)then

cpoints[i]:SetAlpha(1)

else

cpoints[i]:SetAlpha(0.2)

end

end

else

cpoints:Hide()

end

end

This way, you're getting your CPoints shown everytime, when CPoints are on the target, regardless of your class. If there is at least one combo point, the whole element is shown and updated as you want it with the alpha settings.

Note: You don't have to include those cpoints:Show() / :Hide() stuff, it would be my approach.
If you want your CPoints always visible if you're in cat-form or on an rogue, just show them all the time (rogue) or if you're in cat (drood).

Create a frame and register the "UPDATE_SHAPESHIFT_FORM"-event and apply a script to this event

Thanks a lot. That was the thing i was searching for. Gonna give it a try this night.

Anyway, since eclipse bar is already handled in this way by default and, in fact, it could be useful to keep track of combo points even if not in cat form (i'm thinking about feral PvP, dunno if it's really useful) i think i'll fiollow your approach.

It's simple, easily understandable for the ones who likes to edit lua, and works well.