SavedVariables saving
Hey guys,
I'm having issues with Saved Variables. I'm writing a config menu for my Addon with the help of Ace3. I really have no issues with Ace3 currently and I'm pretty happy about but i think I'm misunderstanding saved variables somehow. I have a few of these functions (4 in total) Lua Code:
The db defined is like this: Lua Code:
gempDB is in my Toc file like this Code:
## SavedVariables: gempDB And they are even different from the options that show up in the ingame menu. Changing ingame options again doesn't change anything in the saved vars file... At the beginning some options didn't even show up in the saved vars file. Only after copy pasting them in, deleting it, restarting the game they showed up at some point. This is my saved vars file currently so it looks like Ace3 is doing something atleast. Lua Code:
Could someone give me a short explanation how saved variables exactly work and how I should work with them while developing an addon. Like when are they saved to file? Does reloading break saved vars or something? What are the defaults? etc... |
Saved variables are written to file at the end of a session - so at reload or logout. (Just an FYI, if your client crashes then saved variables will not be written.)
(Another FYI...) For a simple addon with simple saved variables, AceDB is overkill and it's TONS easier to just use the built in system. AceDB was written to handle profiles. Some authors still prefer to create their own profile system rather than use AceDB, though this isn't because there's anything wrong with it - just that it's not necessary to use unless you want to. All that said, AceDB does not save any data if it is unchanged from the default values. Give this a look over: https://wow.gamepedia.com/Saving_var..._game_sessions |
Thanks but I've really got something more complicated on my hands. I will have to handle multiple pages of settings. I was writing my own options but realized quickly that it's a lot of effort.
|
You aren't required to use AceDB to use AceConfig. Just use it if you want to or feel you need its features.
(Most of my addons use AceConfig, none of my addons use AceDB.) |
Ok yeah true. But I have little experience with AceConfig and the tutorials are pretty straightforward with AceDB.
AceDB doesn't seem to be the problem even, probably just me being stupid. Edit: So after removing AceDB, Settings/Vars save fine, I'm not sure where I went wrong with AceDB. I'd actually like to use AceDB because profiles could be very useful for my addon. If anyone has any input, I'm thankful. Here is the relevant code: https://github.com/gempir/gempUI/blo.../config.lua#L3 I've added a Menu for setting profiles which looks nice but changing profile and reloading just resets to Default again. It seems AceDB can't write into saved vars for some reason. I also have another question: When do i load saved vars? I currently have a callback function that fire when they are loaded and then executes whatever you pass it. But how do I scale that efficently. I have stuff like actionbars which require a length or so given, so should I wait even initalizing those bars until the saved vars are loaded? |
Quote:
|
Quote:
Should I just delay the creation of all frames, objects etc. until I have loaded the saved vars (in OnInitialize) ? This is more of a general question and has little to do with Ace3 |
Generally you would create everything immediately and then set it up according to user settings when those become available.
|
Quote:
and then I do SetPoint with the coords the user specified in the saved vars. |
All times are GMT -6. The time now is 06:26 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI