View Single Post
09-16-05, 01:14 PM   #4
Iriel
Super Moderator
WoWInterface Super Mod
Featured
Join Date: Jun 2005
Posts: 578
During normal startup I believe this is what happens

1) FrameXML code is executed
2) For each enabled addon:
2.1) Addon code is executed (as directed by .toc)
2.2) SavedVariables/AddonName.lua is executed
2.2) ADDON_LOADED is fired (arg1 = addon name)
3) After all of that, the common SavedVariables.lua is executed
3) VARIABLES_LOADED is fired
4) PLAYER_ENTERING_WORLD etc..

So, when going in the first time (or the first time after replacing RegisterForSave with ## SavedVariables) the data does still get loaded. As soon as you log out it gets saved in the right place. Users shouldn't be trying to split the file(s) themselves.

Now, I didn't quite think ahead enough when I updated all my addons, and I changed VARIABLES_LOADED to ADDON_LOADED in a few places and that meant you had to log in, and out again, and back in before things worked.. In hindsight I probably should have left some VARIABLES_LOADED code in for initial transition, BUT, the direction to log in, and log back out once, per ACCOUNT, when transitioning to 1.7 simplifies things so maybe i'm just being too pefectionistic there. As it is I didn't go back and change it 8-)

EDIT: Now, for YOUR purposes, you CANNOT reliably get away with what you're trying to do.. Now we're in 1.7 land addons wont expect their data to be missing at ADDON_LOADED, they expect it to be there.. Having said that, you shouldn't really ever provide a SavedVariables.lua file, that's kind of rude, maybe you should create a simple addon and make it a dependency of all of the parts of your compilation, and have it contain the saved variables you want to distribute... If users override it, then they get their own, if they dont, they get yours, AND they load right.

Hopefully that answers your question?

Last edited by Iriel : 09-16-05 at 01:17 PM.
  Reply With Quote