View Single Post
02/20/23, 03:46 AM   #11
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 245
Originally Posted by Baertram View Post
EVENT_MANAGER:UnregisterForEvent(BS.Name, _G.EVENT_ADD_ON_LOADED)

Should always be done unless you need to read other addons' EVENT_ADD_ON_LOADED too!
This event fires for each of your addons and libraries and as your's is found you can stop it by unregistering in 99%.

EVENT_PLAYER_ACTVATED fires after login the first time, as chat is ready.
You should register it at your EVENT_ADD_ON_LOADED and either keep it registered, because it also fires at a reloadUI, zone change with a loading screem (port into dungeon e.g., or port to someone in another zone ...).
Or you unregister it and it will only fire once after login then.
Depends on your usecase and needs.

Register, unregister, re-register is not needed each time an event fires! If you want events to be triggered each time it fires just keep it registered then. But Make sure the events are not registered before your EVENT_ADD_ON_LOADED was fired, as else you might run into issues where your event's callback function is executed but your code was not ready yet as it will be initialized at your EVENT_ADD_ON_LOADED first.
Yes thank you.. event are about the one thing I do sorta understand. my only question was if it was still needed in anyway to un-register things like combat_stat etc etc onload incase of something carrying over from before a reloadui or similar to avoid bugs. I read someplace in a 2014 dev post it was no longer nessisary and im just looking for confirmation on that.

I think my addon is basically complete now except id like still to get an oroboros logo rotating onscreen possibly with a label as a sort of hourglass for one of my functions. Once i get that its everything and more id ever hoped for

Last edited by sinnereso : 02/20/23 at 03:49 AM.
  Reply With Quote