Quantcast
Differentiate fresh login and UI reload? - WoWInterface
Thread Tools Display Modes
01-17-21, 05:39 AM   #1
Zax
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 117
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?
  Reply With Quote
01-17-21, 05:48 AM   #2
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 815
https://wow.gamepedia.com/PLAYER_ENTERING_WORLD
This event gives you this info
PLAYER_ENTERING_WORLD: isInitialLogin, isReloadingUi
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
01-17-21, 06:03 AM   #3
Zax
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 117
Great!
Thank you Rilgamon for your quick answer
  Reply With Quote
01-17-21, 06:06 AM   #4
Ketho
A Molten Giant
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 991
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
  Reply With Quote
01-17-21, 06:17 AM   #5
Zax
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 117
Originally Posted by Ketho View Post
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.
  Reply With Quote
01-17-21, 07:12 AM   #6
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 815
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)
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
01-19-21, 09:07 PM   #7
Nimhfree
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 266
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.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Differentiate fresh login and UI reload?

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