How SHOULD settings be saved between characters, accounts, etc? - ESOUI
Thread Tools Display Modes
01/04/21, 06:52 PM   #1
DewiMorgan's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 11
How SHOULD settings be saved between characters, accounts, etc?

Extensions save data using arbitrary methods, either not telling the user which they're using (global per ESO account? Global per windows account? Per character?), or requiring users to learn a whole new system of cross-character saving and settings-transfer or profile-definition and maintenance for each addon.

I've seen no perfect solutions to the problem, but I suspect that's because it's not perfectly-solvable. I can't imagine what a perfect solution would even look like.

Are there at least any widely-used settings-management addons, so I can at least use a system that my users might already be familiar?
  Reply With Quote
01/04/21, 07:07 PM   #2
Sharlikran's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 362
For all of my mods I save the settings to the saved vars. I usually don't like per character settings because then you have to change it for each character then what if you don't like it that way. I don't really know what you're getting at by a system and inform users and all of that stuff.

If you would like to have some settings for a mod that you're making and you feel that your intended purpose means that the user only changes the setting once, then use account-wide or just save the settings to the file directly without declaring the zos function first.
Admin for TES5Edit, occasional LOOT masterlist contributor, and Wrye Bash contributor. I also maintain special Fallout 3 and Fallout NV versions of Wrye Flash.

Last edited by Sharlikran : 01/05/21 at 04:15 PM.
  Reply With Quote
01/05/21, 01:13 AM   #3
Scootworks's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2014
Posts: 312
I use account-wide on most of the addons. It depends what your addon is doing. Have a look at LibSavedVars, there is also a possibility to add a LAM setting for easily switch from account to character sv
EU Server - SŁĄuGhTerHĜuSe
  Reply With Quote
01/05/21, 03:57 AM   #4
Super Moderator
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,053
Yep, as Scootworks and Sharlikran said. AccountWide are preferred.
I'd either use LibSavedVars for new projects I guess.
So far I always had used my own SV structures.
AccountWide generel settings to store which way of SV saving should be used, stored with a special version (shouldn't change at all in the SV) in a special subtable e.g. "BaseSettings".
If BaseSettings.Accountwide enabled: AccountWide settings for the addon data stored in the "Defaults" subtable (or server dependent, see below) with a version that might increase due to SV changes needed.
If BaseSettings.character enabled: CharacterID (Do not use the name anymore as it's not rename safe!) addon settings stored in the "Defaults" subtable (or server dependent, see below) with a version that might increase due to SV changes needed.

Sometime you need to mix those.

Addon use-case depending SVs
"Depending on the addon" it makes sense to "only" save character dependent -> e.g. addons which are class dependent, or junk addons (1 character shouldn't junk special items as he/she collects them for crafting or whatever).
Or "only" account dependent.
This also depends on if users play with ESO+ or not imo as they often won't use the bank and cannot use the CraftBag, so the "mule" characters store the items, and Inventory Insight e.g. shows what item is where.

In the end each user plays differently, so their SV needs are differently.
That's why I try to always provide both/all possible ways of saving SV, where it makes sense (at least for new addons).

Server dependent:
For new addons I'd also always add the "GetWorldName()" (or similar) to save the addons server dependent (EU Megaserver, NA Megaserver, PTS) as users meanwhile tend to play on both (EU and NA) servers. One can add this as last parameter to ZO_SavedVars:NewCharacterIdSettings, or as 2nd last to ZO_SavedVars:NewAccountWide e.g. so that a subtable with the server name is created in the global SV table.

Multiple account support
They even often got more than 1 account.
Within FCOItemSaver I therefor even added the "AllAccountsTheSame" switch to the accountwide SavedVars (it uses the last parameter of ZO_SavedVars:NewAccountWide, which if not filled uses GetDisplayName(), and else it uses your String as constant) so that all accounts used store the settings server dependent but all the same for no matter what @account your are using).

Some addons even need a combination of character and account wide settings (or at least the benefit from them), e.g. save some looted items etc. as character settings but save general settings account wide how the addon looks/feels and what it does with those looted items.

Not using ZO_SavedVars wrapper
You could even not use ZO_SavedVars wrapper and save the SV date directly to the global table which you have added to your manifest file's ## SavedVariables <globalTable>.This will strip the precreated sub tables in the SV. e.g. just use GetDisplayName() and GetCurrentCharacterId() yourself to build a SV structure of your needs.

In the end, imo, it really depends on the usecase and features of your addon!
But LibSavedVars should handle the most standard cases.

Last edited by Baertram : 01/05/21 at 04:06 AM.
  Reply With Quote
02/24/21, 02:27 PM   #5
AddOn Author - Click to view addons
Join Date: Mar 2016
Posts: 19
I play with multiple accounts across both servers, so I personally despise addons that save settings per-character, per-account, or even per-server unless there's a compelling reason for that particular setting to differ across those contexts. I even have a private addon whose job is to override how other addons handle saved variables.

IMHO, settings should be as wide as possible, with narrowing of context only in the face of a compelling reason for doing so.
  Reply With Quote
02/24/21, 10:23 PM   #6
AddOn Author - Click to view addons
Join Date: Feb 2017
Posts: 60
For the curious, it is possible to completely skip the usage of the ZO_SavedVars objects and any predefined char/account/server-specific saved variable structure, making it easy to access all information in the files without having to work around any structuring ZOS may add otherwise. E.g. https://github.com/Wheel5/Testify/bl...dataLoader.lua
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » How SHOULD settings be saved between characters, accounts, etc?

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