Thread Tools Display Modes
Prev Previous Post   Next Post Next
Unread 04-04-13, 07:18 PM   #20
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,240
Originally Posted by Rainrider View Post
I asume the Blizzard event dispatcher is C coded, but they set an OnUpdate script for the stock frames instead of registering UNIT_HEALTH_FREQUENT. Why would they do that? The only reason I could think of would be that UNIT_HEALTH_FREQUENT does not work like other events and simply sets an OnUpdate script on the frame it gets registered to.
It doesn't, as you can set your own OnUpdate script without preventing UNIT_HEALTH_FREQUENT from working. The only difference between UNIT_HEALTH and UNIT_HEALTH_FREQUENT is that the former only fires every 0.2 seconds, while the latter fires more often (I'm not sure exactly how often). There's just a bug in Blizzard's code right now that prevents UNIT_HEALTH from firing for boss units. It's not because the event itself is mysteriously "different" from other events; it's just a coincidence that the two events are so closely related. It could just as easily be UNIT_POWER that was bugged, or UNIT_NAME_UPDATE, or UNIT_AURA, or anything else.

As for Blizzard's code using OnUpdate scripts instead of UNIT_HEALTH_FREQUENT, there are two equally likely reasons for that:

1) They actually want to use UNIT_HEALTH, but the UI coders know it's bugged, and are using an OnUpdate script as a temporary workaround until the C coders fix the bug.

2) The code was written before UNIT_HEALTH_FREQUENT existed, and the UI coders have just not bothered updating it. You can see lots of examples of this throughout the Blizzard UI code.

Originally Posted by Rainrider View Post
OnUpdate is also a kind of event handler reacting to the event of refreshing the screen, isn't it?
You could think of it that way, but that's not really accurate. In layman's terms, redrawing the screen is an "event", but in WoW API terms, it's not, as that term is reserved for the specific meaning as relates to RegisterEvent etc.
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
 

Go BackWoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Boss frames not working anymore

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