WoWInterface

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

gwyd 10-26-14 04:44 PM

UNIT_SPELLCAST_SENT not firing
 
For some reason, I'm not seeing UNIT_SPELLCAST_SENT firing for me (or more likely I'm not bound to it somehow).

I tried building a new frame from the console in game and registering on that (shamelessly stolen from a post by haste a few years ago) and that does catch the event as expected:

Lua Code:
  1. f = CreateFrame'Frame' f:RegisterEvent("UNIT_SPELLCAST_SENT") f:SetScript("OnEvent", function(...) print(...) end)

You can see the code here: Github, but the general idea is that it's calling oUF:RegisterEvent and passing a callback function. I'm doing this with other events successfully.

Any thoughts or areas to look at would be greatly appreciated. Thanks!

Pyrates 11-08-14 10:58 AM

Seems to fire ok for me in a short test, any specific circumstances?

p3lim 11-08-14 02:32 PM

Have you tried checking before your "caster" check?
Have you tried forcing the event to be unitless (just for the sake of testing) by setting the 3rd argument of frame:RegisterEvent() to true?

gwyd 11-09-14 09:06 AM

Quote:

Originally Posted by p3lim (Post 299892)
Have you tried forcing the event to be unitless (just for the sake of testing) by setting the 3rd argument of frame:RegisterEvent() to true?

This fixes it. Any thoughts on why the event isn't firing on the unit in this case? Also, thanks for the help. :)

p3lim 11-09-14 09:15 AM

Quote:

Originally Posted by gwyd (Post 299951)
This fixes it. Any thoughts on why the event isn't firing on the unit in this case? Also, thanks for the help. :)

When you register a UNIT_* event on a frame in oUF, it ties the unit the event fires for to the unit associated with the frame.
So, if you register say UNIT_HEALTH on your player frame, the function will only fire if the event fired for the player unit.
The 3rd argument to frame:RegisterEvent() is to override this check, which is why the argument is called "unitless"

See this source for more details:
https://github.com/haste/oUF/blob/ma...s.lua#L53-L100

In the past, oUF's event handler checked everything itself, but somewhere during Cata or Mists we got a new method called RegisterUnitEvent to do this work for us, and is what oUF uses today.

gwyd 11-09-14 09:17 PM

Ah, that makes sense. Thanks for the explanation.


All times are GMT -6. The time now is 10:29 AM.

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