Disturbing SPELLS_CHANGED behavior - WoWInterface
Thread Tools Display Modes
09-04-08, 06:37 AM   #1
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 33
Disturbing SPELLS_CHANGED behavior

Yes, another question.

I am reading this about the SPELLS_CHANGED event and find it disturbing (in bold).

nil when the char learns stuff. Also when changing weapons and shapeshifting. In addition it seems to be called on regular intervals for no apparent reason.
Is this indeed the case? It would be nice to have a way to detect only in cases where the player learns a new spell. No biggie, I've worked around it as well.

Last edited by BDelacroix : 09-04-08 at 06:57 AM.
  Reply With Quote
09-04-08, 09:44 AM   #2
Fishing Trainer
Seerah's Avatar
WoWInterface Super Mod
Join Date: Oct 2006
Posts: 10,768
You could see how LearningAid does it: http://www.wowinterface.com/download...arningAid.html
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-04-08, 04:21 PM   #3
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 33
I've already have a work around but thanks. Maybe I'll look to see if its better.
  Reply With Quote
09-04-08, 07:09 PM   #4
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 9
Thanks for posting this, i've never given things a long enough time to know that this event was firing 'randomly' so I would have missed this; my func that fires on the event isn't particuarly bulky but still any extra cpu usage is bad when unneeded.
  Reply With Quote
09-05-08, 04:50 AM   #5
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 61
SPELLS_CHANGED is fired whenever UpdateSpells() is called, which is only used in the Spell Book frame. By my search of all files in FrameXML folder, the only frame that uses SPELLS_CHANGED is the spell book.

For the Spell Book, the SPELLS_CHANGED event causes the 12 buttons in the frame to update images and labels according to the current page. The buttons unregister the event when the spell book is closed. I believe SPELLS_CHANGED was tagged along with various other events and conditions so that the Spell Book will properly update if something occurred that would cause a glitch for the buttons if not updated.

Seeing this, it seems kind of wasteful on performance, but I know the spell book frame was not made for processing efficiency but easier coding. This is not an issue because the spell book should only be open to place spells in the action bar or inserted into macros.

Last edited by LBXZero : 09-05-08 at 04:58 AM.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Disturbing SPELLS_CHANGED behavior

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