Thread Tools Display Modes
10-26-14, 04:44 PM   #1
gwyd
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Aug 2012
Posts: 10
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!
  Reply With Quote
11-08-14, 10:58 AM   #2
Pyrates
A Cliff Giant
 
Pyrates's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 77
Seems to fire ok for me in a short test, any specific circumstances?
__________________
" ... and the Vogon will do things to you that you wish you'd never been born, or, if you're a clearer minded thinker, that the Vogon had never been born."
  Reply With Quote
11-08-14, 02:32 PM   #3
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
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?
  Reply With Quote
11-09-14, 09:06 AM   #4
gwyd
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Aug 2012
Posts: 10
Originally Posted by p3lim View Post
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.
  Reply With Quote
11-09-14, 09:15 AM   #5
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by gwyd View Post
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.
  Reply With Quote
11-09-14, 09:17 PM   #6
gwyd
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Aug 2012
Posts: 10
Ah, that makes sense. Thanks for the explanation.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » UNIT_SPELLCAST_SENT not firing

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