Thread Tools Display Modes
12-14-20, 06:24 AM   #1
A Wyrmkin Dreamwalker
Join Date: Oct 2016
Posts: 57

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?
  Reply With Quote
12-14-20, 08:48 AM   #2
A Molten Giant
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 573
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.

Last edited by Kanegasi : 12-14-20 at 08:52 AM.
  Reply With Quote
12-16-20, 11:52 AM   #3
Fishing Trainer
Seerah's Avatar
WoWInterface Super Mod
Join Date: Oct 2006
Posts: 10,844
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
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
12-17-20, 09:06 AM   #4
A Wyrmkin Dreamwalker
Join Date: Oct 2016
Posts: 57
Thank you!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » PLAYER_LOGIN vs PLAYER_ENTERING_WORLD?

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