Thread Tools Display Modes
09-16-05, 01:05 PM   #1
Killariel
A Deviate Faerie Dragon
Join Date: Jul 2005
Posts: 10
Updating Compilations

So I am in the process of udating my compilation and a big part of it was the savedvariables.lua file. Has anyone tried uploading a compiled lua post 1.7 patch yet? I think it would be a huge problem for most UI users to modify the savedvariable files for each addon individually. It is my hope that I can compile them all in pre-patch fashion and the client will divide them up at startup.

If this is not possible, how are some of you other compilation providers dealing with this?


Thanks


Killariel
  Reply With Quote
09-16-05, 01:08 PM   #2
Cairenn
Credendo Vides
 
Cairenn's Avatar
Premium Member
WoWInterface Admin
Join Date: Mar 2004
Posts: 7,134
I've dropped a note to Iriel, asking him to pop over and try to help out when he gets the opportunity.
__________________
“Do what you feel in your heart to be right — for you’ll be criticized anyway.” ~ Eleanor Roosevelt
~~~~~~~~~~~~~~~~~~~
Co-Founder & Admin: MMOUI
FaceBook Profile, Page, Group
Avatar Image by RaffaeleMarinetti
  Reply With Quote
09-16-05, 01:10 PM   #3
Kaelten
Jack's raging bile duct
 
Kaelten's Avatar
Featured
Join Date: May 2005
Posts: 782
on load if a old time saved variables file is present it will divide them up.

However, why, if you don't mind me asking, are you distrubting a savedvariables file?
__________________
WowAce.com & CurseForge.com Adminstrator
Developer of Ace3, OneBag3, and many other addons and libraries
Project lead and Mac developer for the Curse Client

Anyone that needs what they want
And doesn't want what they need
I want nothing to do with
  Reply With Quote
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
09-16-05, 01:17 PM   #5
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
An easy way to test this is the following:

Install a mod, and have it startup as normal. Make it somethign simple, but ensure it has a SavedVariable. Then grab the lua from that add-on specific modvariables.lua file, and toss those in a SavedVariables.lua file.

I _suspect_ (but can't test at work) that the game is loading the add-on specific variables and then the SavedVariables.lua file. We have the ADDON_LOADED firing multiple times before the VARIABLES_LOADED fires, so it makes sense to me that the global SavedVariables.lua file would load after all the add-on specific variables.

It would then save out the new variables you replace in the SavedVariables.lua.

This is likely only a solution for right now-- and I can't be sure it will work in future patches. With them segmenting the SavedVariables out so much, they may soon deprecate that file (if not disable it completely).

Sorry I don't have a ton more detail (my lack of WoW at work saddens us both)
  Reply With Quote
09-16-05, 01:18 PM   #6
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
Originally Posted by Kaelten
on load if a old time saved variables file is present it will divide them up.

However, why, if you don't mind me asking, are you distrubting a savedvariables file?
He's distributing a pre-set compilation.
  Reply With Quote
09-16-05, 01:24 PM   #7
Kaelten
Jack's raging bile duct
 
Kaelten's Avatar
Featured
Join Date: May 2005
Posts: 782
as in preset options?

hmm it may be prefereable to attempt to write a script that executes once on load of a new version and sets all those options.

You can actually put the code from the SV file into a function.

i.e.

Code:
 function LoadDefaults() 

loothog_settings = {
	 x = "5",
	 y = "15", 
}

message("All Default Settings have been loaded");
end
something like that could take care of it for you and prevent you from having to distrubte the actual sv files.

You can instruct the users to delete the mod once they've ran it to save on memory


just a thought. and cheesy example.
__________________
WowAce.com & CurseForge.com Adminstrator
Developer of Ace3, OneBag3, and many other addons and libraries
Project lead and Mac developer for the Curse Client

Anyone that needs what they want
And doesn't want what they need
I want nothing to do with
  Reply With Quote
09-16-05, 01:40 PM   #8
Iriel
Super Moderator
WoWInterface Super Mod
Featured
Join Date: Jun 2005
Posts: 578
Originally Posted by Kaelten
as in preset options?

hmm it may be prefereable to attempt to write a script that executes once on load of a new version and sets all those options.

You can actually put the code from the SV file into a function.
The 'cleanest' solution I can think of, which is possibly semi-nasty 8-) is to create your own addon, i'll call it XYZInit, with the following:

1) A saved variable of its own called ''XYZInit_Applied"
1) A frame which registers for ADDON_LOADED and VARIABLES_LOADED
2) A lua file containing code that does the following..

1) Initialize a big table, more or less derived from your saved variables, something like:

Code:
local compilationInit = {
  ["FirstAddon"] = {
    ["FirstAddonVariable"] = 123,
    ["FirstAddonOtherVariable"] = "Hello",
  }
}
(Essentially those sub-tables are the data from your saved variables file(s), in table form)

Now in your event handler you need something like:

Code:
if (event == "ADDON_LOADED") then
  if (arg1 = "XYZInit") then
    if (not XYZInit_Applied) then
      XYZInit_Applied = {};
    end
    return;
  end
  -- Skip those that are already initialized
  if (XYZInit_Applied[arg1]) then
    return; 
  end
  -- Skip those which are not in the compilation
  local data = compilationInit[arg1];
  if (not data) then
    return;
  end
  -- Apply variables before addon gets to see them
  for k,v in pairs(data) do
    setglobal(k, v);
  end
  XYZInit_Applied[arg1] = 1;
  return;
end

if (event == "VARIABLES_LOADED") then
  -- Loading is done, clear the array so it can be cleaned up
  compilationInit = {};
end
Finally, and this is very important, you need to make XYZInit an optional dependency of all of the addons for whihc it has defaults.. That ensures it gets loaded first, and thus gets ADDON_LOADED before the addon does, giving it time to put the saved variables into place.
  Reply With Quote
09-16-05, 01:44 PM   #9
Kaelten
Jack's raging bile duct
 
Kaelten's Avatar
Featured
Join Date: May 2005
Posts: 782
well if they are used to getting their options overwritten wouldn't it be easier to just set the whole tables at once.

of course thats ease versus finesse.
__________________
WowAce.com & CurseForge.com Adminstrator
Developer of Ace3, OneBag3, and many other addons and libraries
Project lead and Mac developer for the Curse Client

Anyone that needs what they want
And doesn't want what they need
I want nothing to do with
  Reply With Quote
09-17-05, 10:18 AM   #10
Killariel
A Deviate Faerie Dragon
Join Date: Jul 2005
Posts: 10
Yes I was sending my saved variables so that the user could obtain the same look/feel for what I'm running. In the past I simply had them do a find/replace to change their name and server in the lua file.

I would definitely prefer to run a script that loads the settings independently, however I know nothing about modding, haven't really delved into lua, and know just enough about code in general to be dangerous. How difficult of an endeavor would it be to write this script? Also, would it be possible to write the script so that it only writes variables for the addons I provide and doesn't over-write their other variables?
  Reply With Quote
09-17-05, 03:47 PM   #11
Kaelten
Jack's raging bile duct
 
Kaelten's Avatar
Featured
Join Date: May 2005
Posts: 782
it would be possible and all in all fairly smiple.

The hard part is going to be compiling the parts of the ui you want to offer presettings for.
__________________
WowAce.com & CurseForge.com Adminstrator
Developer of Ace3, OneBag3, and many other addons and libraries
Project lead and Mac developer for the Curse Client

Anyone that needs what they want
And doesn't want what they need
I want nothing to do with
  Reply With Quote
09-17-05, 04:35 PM   #12
Atrophical
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Sep 2005
Posts: 33
I'm also looking for this sort of feature. Can you do it or show us how, Kaelten?! I would love you so much.

If there's any way we could limit it to something like JUST the DiscordActionBars and DiscordUnitFrames preset variables (the things that actually took a bit of time setting up), that'd be incredibly helpful.
  Reply With Quote
09-17-05, 05:07 PM   #13
Kaelten
Jack's raging bile duct
 
Kaelten's Avatar
Featured
Join Date: May 2005
Posts: 782
I could help

I'll be honest, I barely remember how to code anymore with the exception of within ACe, lol, but I think I can do some small examples of what can be done.

Yes it can be done on a per char basis.

Now question, will you guys mind if I set it up to be an ace adodn, as I can do alot more jazz on this type of addon in shorter time if I use it.
__________________
WowAce.com & CurseForge.com Adminstrator
Developer of Ace3, OneBag3, and many other addons and libraries
Project lead and Mac developer for the Curse Client

Anyone that needs what they want
And doesn't want what they need
I want nothing to do with
  Reply With Quote
09-17-05, 05:22 PM   #14
Atrophical
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Sep 2005
Posts: 33
SCORE.

By all means, go for it. My compilation has Ace in it, as it is!

<33<#<#<3#<3
  Reply With Quote
09-17-05, 05:24 PM   #15
Devla
A Cobalt Mageweaver
 
Devla's Avatar
AddOn Compiler - Click to view compilations
Join Date: Mar 2005
Posts: 206
Sounds interesting

Why not just go through each mod's code and change the default options? Most mods have default settings that can be changed this way.

I think if time is going to be spent on a 'mod management' style addon, it should include some sort of on-demand class/character loading features. When I get inspired I plan on working on this concept.

GL with the SV/Settings idea though
__________________
RETIRED Author
  Reply With Quote
09-17-05, 05:24 PM   #16
Kaelten
Jack's raging bile duct
 
Kaelten's Avatar
Featured
Join Date: May 2005
Posts: 782
cool. I'll see what I can throw togather tonight I'm dealing with class work but after that I might throw togather a KC_DefaultSetter or something.
__________________
WowAce.com & CurseForge.com Adminstrator
Developer of Ace3, OneBag3, and many other addons and libraries
Project lead and Mac developer for the Curse Client

Anyone that needs what they want
And doesn't want what they need
I want nothing to do with
  Reply With Quote
09-17-05, 05:41 PM   #17
Atrophical
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Sep 2005
Posts: 33
Sounds awesome. I can't wait.
  Reply With Quote
09-18-05, 12:45 PM   #18
Killariel
A Deviate Faerie Dragon
Join Date: Jul 2005
Posts: 10
Much appreciated!!!!
  Reply With Quote
09-19-05, 07:07 PM   #19
Killariel
A Deviate Faerie Dragon
Join Date: Jul 2005
Posts: 10
Just checking in - any progress on this? Is there any thing I can do to help? If I wanted to compile code for the individual addons where would I start?


Thanks,


Killariel
  Reply With Quote
09-19-05, 07:11 PM   #20
Kaelten
Jack's raging bile duct
 
Kaelten's Avatar
Featured
Join Date: May 2005
Posts: 782
well I'm trying to decided on exact setup. Basically your going to need to have a file with a big table declaration in it that mirrors what you'd normally be passing out in the sv file you where distroing.
__________________
WowAce.com & CurseForge.com Adminstrator
Developer of Ace3, OneBag3, and many other addons and libraries
Project lead and Mac developer for the Curse Client

Anyone that needs what they want
And doesn't want what they need
I want nothing to do with
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Updating Compilations

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