WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Differentiate fresh login and UI reload? (https://www.wowinterface.com/forums/showthread.php?t=58551)

Zax 01-17-21 05:39 AM

Differentiate fresh login and UI reload?
 
Hello,

I would like to apply a setting saved in saved variable file only on fresh log in, and not on interface reload.
I'm using PLAYER_LOGIN event to initialize my addons, but this event is also fired when interface is reloaded.
So, is there a way to differentiate a fresh login from an interface reload?

Rilgamon 01-17-21 05:48 AM

https://wow.gamepedia.com/PLAYER_ENTERING_WORLD
This event gives you this info
PLAYER_ENTERING_WORLD: isInitialLogin, isReloadingUi

Zax 01-17-21 06:03 AM

Great!
Thank you Rilgamon for your quick answer :)

Ketho 01-17-21 06:06 AM

The savedvariables become available on the respective ADDON_LOADED event, that is when addons usually initialize and setup them. ADDON_LOADED also fires on /reload

I don't see the specific use case for only applying a setting on a fresh login, since addons generally shouldn't really care whether some setting is applied on only login vs login and /reload

Zax 01-17-21 06:17 AM

Quote:

Originally Posted by Ketho (Post 338295)
The savedvariables become available on the respective ADDON_LOADED event

Yes. In my case, I just set a local variable to isInitialLogin when PLAYER_ENTERING_WORLD event is fired.
I then use this variable later, on PLAYER_LOGIN event.

Rilgamon 01-17-21 07:12 AM

https://wow.gamepedia.com/AddOn_load...during_loading
You might notice that the info is not available because of the order of events. (Some time ago I noticed the order changed, but never looked at it again. So not sure if the order is still the same)

Nimhfree 01-19-21 09:07 PM

The thing that I have noticed as different between the startup/ReloadUI in Retail/Classic, is in Retail normal startup there is SPELLS_CHANGED that fires between ADDON_LOADED and PLAYER_LOGIN. There is another that fires after QUEST_LOG_UPDATE which makes it interesting if you are looking for SPELLS_CHANGED to trigger logic.


All times are GMT -6. The time now is 08:49 PM.

vBulletin © 2021, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI