In need of help with loading my other characters savedVars and saving them
So i'm developing my addon Autobanker and i was thinking that it would be nice to have a
dropdown menu where i can select each character and change their settings without having to log in to each character and set them through the settings menu. My problem, or dilemma i should say is that i want to be able to do something like Code:
Would it work to use a accountwide savedVars and change the different characters settings in that table? |
Before trying to invent the wheel new you may look at this library first:
https://www.esoui.com/downloads/info...SavedVars.html And this is how SavedVariables work in ESO standard, without a library[ The savedvars are bothing else then a global table with the name you specify in your addon's txt file. You can access this table directly and change the entries in there. ZO_SavedVars is only a helper function to assign a "pointer variable" (like myAddonSettings) to this global variable. Example You have specified your savedvariables object to be named like this in your addon.txt (manifest) file: Code:
##SavedVariables: MyAddon_SV I assume you are using server dependent SavedVariables. -> If not, just strip the first [GetWorldName()] bracket! Lua Code:
mySavedVariablesOfCharacterId will have additional contents which you have specified using ZO_SavedVars:Newxxx(). e.g. if you have specified ZO_SavedVars:NewCharacterIdSettings() to use a subtable "settings" you'll have this entry within mySavedVariablesOfCharacterId as well: mySavedVariablesOfCharacterId["settings"]. [CharacterId] will be the uniqueId of your character. You can get a list of them like this: Lua Code:
If you are using AccountWide SavedvAriables the CharacterId will be a fixed string "$AccountWide". Additional information about SavedVars: https://wiki.esoui.com/Circonians_Sa...ables_Tutorial https://wiki.esoui.com/AddOn_Quick_Questions https://wiki.esoui.com/Addon_manifest_(.txt)_format https://www.esoui.com/forums/showthr...SavedVariables |
Thank you so much! This cleared up lots for me. So if I understood you right, after I grab the table for the character i want to modify. If I change it’s data it’s going to be saved just as usual? It should because it’s stored in the savedVars variable right? :)
That library seemed pretty nice! I think I know how to move forward now! I really appreciate the help |
Found another good forum thread about different ways to save the SavedVars:
https://www.esoui.com/forums/showthr...=SavedVariable Back to your question Yes, after getting the SavedVars table of any character you can modify the contents just as modifying other table contents too. Changing it will not be stored on the harddrive though until you do a reloadui or logout, just as normal SavedVariables as well (if you are not using the prioritized but randomized SV saving method for small data which was newly added with Murkmire to support saving of real important changes without reloadui.) |
Right, yes its only in memory before the reloadui or logout/login. But i should be able to edit all the characters i want one after eachother and not having to reloadui in between everyone?
|
Quote:
Lua Code:
|
All times are GMT -6. The time now is 06:10 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI