08-06-14, 11:36 AM | #1 |
Saving variables for other addons
Im trying to save settings for other addons, so that i simply can run a script ingame.
Have tested a few ways without any luck. Any sugestion? Exampel i whant to add these settings to Bartender savedvariable: Lua Code:
|
|
08-06-14, 08:43 PM | #2 |
It might help if you stated what your overall goal is. Are you trying to distribute a premade UI? If so, most people do that by just distributing their WTF folder, and using Reflux to switch to all the right profiles. If you want to avoid making users deal with WTF folder stuff, you could just save your entire saved variable in your addon, and if it's the first time the user has logged in with your addon (check by using your own saved variable), overwrite the "real" variable(s) with yours. You should probably show them a prompt first, so they know to go back up their own saved variables first if they don't want to lose all their settings. You'll also have to reload the UI afterwards.
__________________
Retired author of too many addons. Message me if you're interested in taking over one of my addons. Don’t message me about addon bugs or programming questions. |
|
08-06-14, 10:13 PM | #3 | |
Like when they start up first time there will be a popup for adding the settings. Like the above settings. I have tryed different ways to add the settings above to Bartender4 savedvariables, but i have limited skills around lua so if some could help me with a example. |
||
08-06-14, 11:26 PM | #4 |
Just overwrite the entire variable with your own. For example, if the Bartender4 saved variable is called Bartender4DB (look in its TOC file) then you would just do:
Code:
Bartender4DB = { -- your table contents here, copied from your saved variables file } ReloadUI() If you need some examples, go look at some UI packs that already do this, such as Mayron UI.
__________________
Retired author of too many addons. Message me if you're interested in taking over one of my addons. Don’t message me about addon bugs or programming questions. |
|
08-06-14, 11:35 PM | #5 |
Another example, I do this to load cvars in my "random tools"-addon:
https://github.com/p3lim-wow/Inomena....lua#L175-L189 |
|
08-07-14, 01:25 AM | #6 |
Thanks for the help so far, both tips worked fine.
So i made a code like this: Lua Code:
And that works just fine. I also made one for Bartender. But bartender have default profile set to username. Is there a way i can make it switch to the profile i created (default)? I also did ran into another problem with Masque. Toc says it's MasqueDB and the savedvariable also confirms this, but using the same as above (with MasqueDB = { ) doesn't work. Any tip? Last edited by VikingP : 08-07-14 at 01:30 AM. |
|
08-07-14, 02:05 AM | #7 | |
Generally just saying something "doesn't work" is useless, as it gives us absolutely nothing to go on, but this technique probably won't be very helpful for Masque, as the structure of its saved variable depends on which addons the user has installed, which may not just be the ones in your UI pack. You're probably better off just calling the appropriate functions to simulate the user changing the global skin settings themselves.
__________________
Retired author of too many addons. Message me if you're interested in taking over one of my addons. Don’t message me about addon bugs or programming questions. |
||
08-07-14, 11:04 AM | #8 |
Thanks for the help. I got it all to work
|
|
WoWInterface » Developer Discussions » Lua/XML Help » Saving variables for other addons |
«
Previous Thread
|
Next Thread
»
|
Thread Tools | |
Display Modes | |
|
|