WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   PLAYER_LOGIN vs PLAYER_ENTERING_WORLD? (https://www.wowinterface.com/forums/showthread.php?t=58459)

Krainz 12-14-20 06:24 AM

PLAYER_LOGIN vs PLAYER_ENTERING_WORLD?
 
I'm writing a code that changes the textures and positions of other frames created by other addons, and I'm learning how to handle events better

I've come upon the PLAYER_LOGIN and PLAYER_ENTERING_WORLD events. They seem to mean the same thing, but I'm sure they don't.

What event is the best one to handle when altering UI elements created by other addons? Login or Entering World? And are there any possible drawbacks of choosing one over the other?

Kanegasi 12-14-20 08:48 AM

PLAYER_LOGIN happens only once when the UI loads. As it states, it fires when the UI is mostly ready near the end of the loading screen when logging into a character and most data from functions are available. It also fires near the end of the loading screen after using /reload. This event has no payload.

PLAYER_ENTERING_WORLD happens right after, somewhere between the loading bar 100% and the moment the loading screen disappears. This event is for when any 3D world data for the current area is available, such as units, the map, and zone info. However, it also fires every time you load into anything, such as an instance or different continent. This event returns two booleans. The first is true if you're logging into a character, which is the initial world load. The second is true if loading from a /reload. A /reload means the character is already in the world and the world is loaded, the UI is the one reloading. If both are false, you entered an instance or a different continent.

The vast majority of add-ons and the UI start doing things on PLAYER_LOGIN. If you're doing things to the UI or other add-ons, your best bet is using PLAYER_ENTERING_WORLD and checking if either returns are true.

Seerah 12-16-20 11:52 AM

For future reference, in case you lose track of Kanegasi's explanation, the loading process and events are detailed here: https://wow.gamepedia.com/AddOn_load...during_loading

Krainz 12-17-20 09:06 AM

Thank you!


All times are GMT -6. The time now is 09:58 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI