From what I understand from my tests while reworking my addons is that the order seems to be something along these lines:
ADDON_LOADED - addon's saved variables loaded and ready for use
PLAYER_LOGIN
PLAYER_ENTERING_WORLD
VARIABLES_LOADED - fired whenever blizzard has finished with their saved variables so at any time between ADDON_LOADED and the game actually being ready for use.
Hmm, just looked back at my images and its interesting .. not noticed ADDON_LOADED firing after PLAYER_LOGIN. Unless, those are other addons that are set to load on demand once logged in .. hmm. But then again not every one of your files are testing for the addonloaded event so hard to say for sure. I'll rig up an event lister and see what order they come out at on a regular basis.
I've been reworking my watch frame addon with this loading order in mind and so far I have got this working exactly as expected using this. I have almost got the same functionality of my current version with alot less coding done as I am now not fighting with what blizzard wants to do but working with it. :
Code:
local function AddonLoaded(event,...)
CreateFrames();
end
local function PlayerLogin(event,...)
ShowFrames();
end
local function VariablesLoaded(event,...)
SizeFrames();
PositionFrames();
end
local function OnEvent(self,event,...)
if ( event == "ADDON_LOADED" and arg1 == addonName ) then
AddonLoaded(event,...);
elseif ( event == "PLAYER_LOGIN" ) then
PlayerLogin(event,...);
elseif ( event == "VARIABLES_LOADED" ) then
VariablesLoaded(event,...);
end
end
local XEvents = CreateFrame("Frame",UIParent);
XEvents:SetScript("OnEvent",OnEvent);
XEvents:RegisterEvent("ADDON_LOADED");
XEvents:RegisterEvent("PLAYER_LOGIN");
XEvents:RegisterEvent("VARIABLES_LOADED");