Event Help Needed
Hello. I was trying to come up with a way to disable some of the features in my little add-on whenever the user is in Cyrodiil.
In my add-on, I register the events IF they are selected, otherwise they don't register. So basically, my RegisterEvents() function has if statements in it. The event "EVENT_ADDON_LOADED" triggers an Initialize() function, which in turn runs this RegisterEvents() function. This event is then unregistered later on.
As far as I can tell, whenever the UI is reloaded, game basically "cleans" itself, and runs these initialize functions and such all over again. However, if the map has changed (you see a loading screen that is not caused by reloadUI so to speak), this is not the case. So I was trying to find a way to make this happen.
I know I can put a check in the functions, but that means less efficiency; less performance as it checks whether or not you are in Cyrodiil everytime. That is why I was trying to put this check in the RegisterEvents() function. However it only checks when the add-on is loaded or UI is reloaded and leaves map changes / loading screens alone.
Is it wise to register events with "EVENT_PLAYER_ACTIVATED"? I am asking this as it may be of help to me. Other suggestions are also welcome. Aim is to keep the actual function codes short and/or efficient, and avoiding registering any event if it is not desired.
|