Thread Tools Display Modes
04/20/14, 02:48 PM   #1
Reaper79
Join Date: Apr 2014
Posts: 4
Check for EVENT registered ?

Hi,

is there a simple way to check, if an EVENT is already registered ? Or doesn't it matter if i register an EVENT multiple times ?

can't be so good or ?
  Reply With Quote
04/20/14, 03:52 PM   #2
BadVolt
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 74
Originally Posted by Reaper79 View Post
Hi,

is there a simple way to check, if an EVENT is already registered ? Or doesn't it matter if i register an EVENT multiple times ?

can't be so good or ?
You can register as many Events as you want.. same too, for sure. Multiply fuinctions too, but I doubt you really need it.
  Reply With Quote
04/20/14, 04:39 PM   #3
Reaper79
Join Date: Apr 2014
Posts: 4
Hm, let me try to explain...

i just want to unregister an event if it's already registered.

i could do:
Lua Code:
  1. bEventRegistered = EVENT_MANAGER:RegisterForEvent(iID, EVENT, fFunction)
  2.  
  3. if bEventRegistered then EVENT_MANAGER:UnregisterForEvent(iID, EVENT)

is there no "nice" version of this ?

don't want to use many globals across my files..

Last edited by Reaper79 : 04/20/14 at 04:43 PM.
  Reply With Quote
04/20/14, 04:59 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
You will not get an error if you try to unregister an event that is not registered.
  Reply With Quote
04/20/14, 05:49 PM   #5
Reaper79
Join Date: Apr 2014
Posts: 4
What's about the performance or something ? Does the Client (Game) checks if an Event is already registered, so it doesn't register it again ? I know, stupid questions, but i want to know *g*

i mean, there must be a good reason why you can unregister the events.
  Reply With Quote
04/20/14, 05:59 PM   #6
ins
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 76
In the old days of early wow you could replace the FrameXML Folder with your own, thereby destroying the BASE UI if you wanted to get rid of stuff.

Then this feature was removed, but instead you could Hook functions. There are Pre- and Post- hook options, which should let you do some fun stuff before/after the Default UI runs its course. Unfortunately without a more recent dump of the ESOUI and no information from Zenimax this might be somewhat tricky.

When it comes to events you can REGISTER and UNREGISTER those you make yourself. For other addons or UI you can probably destroy their functions if you want to "Intercept" what they get, and then you can Perhaps unregister whatever they were waiting on, if that is what you want to do.


Maybe you can explain what you want to do/why, Scenario, etc..?
  Reply With Quote
04/20/14, 09:35 PM   #7
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
You can unregister events for when you don't need to listen for them anymore.
  Reply With Quote
04/21/14, 12:19 AM   #8
BadVolt
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 74
Originally Posted by Reaper79 View Post
Hm, let me try to explain...
Lua Code:
  1. bEventRegistered = EVENT_MANAGER:RegisterForEvent(iID, EVENT, fFunction)
  2.  
  3. if bEventRegistered then EVENT_MANAGER:UnregisterForEvent(iID, EVENT)
I think it will always return true
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Check for EVENT registered ?


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