Thread Tools Display Modes
06/25/20, 10:12 AM   #1
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
HowTo: SavedVariables - Find the folder, backup, copy

What are SavedVariables?
The SavedVariables are files, stored in the "SavedVariables" folder on your disk, where the AaddOns save data to.
Even some base game settings by the provider Zenimax Online will be stored in SavedVariable files.

In this folder there will be created .lua files for the addon names, like
Code:
<AddOnsFolderName>.lua
e.g. AdvancedFilters.lua (AddOn folder/txt file in folder live/AddOns is "AdvancedFilters"), or pChat.lua (AddOn folder/txt file in folder live/AddOns is "pChat").

These files will be constantly updated as you are logged in to the game! Manipulating them while you are logged in will not affect the ingame data as it will be kept in internal data tables of the game untio you logout!
The updates will happen as you reload the User Interface (/reloadui chat command, or via the "Addon Manager") ingame, change zones
so that a loading screen appears, at logout and even sometimes in between, if there are only really small amounts of data changes done.
If your client crashes without a proper logout/close of the game the SV files might get corrupted or at least contain data of an older time.

This makes backup of your SV files important, especially before bigger patches like new DLCs! You are able to go back to the last working version quite easily, and the files are not that big in terms of filespace used. So you are able to keep multiple versions e.g.


How do you find the SavedVariables folder?
Open your ESO folder.
If using a PC, the typical default install path is: C:\Users\< username >\Documents\Elder Scrolls Online\live\
Or you can use the windows variable by pasting it into windows explorer's address bar: %userprofile%\documents
If using a Macintosh, the typical default install path is: ~/Documents/Elder Scrolls Online/live/
In the 'live' folder there will be a subfolder "SavedVariables".
This folder will be created after your first login to the ESO game so you need to login and get ingame at least once!
Here is a description how to find the live/AddOns folder. The SavedVariables folder is 1 folder above the /AddOns folder, within the /live folder:
https://www.esoui.com/forums/showthread.php?t=8858


Show the path if you are ingame
Press the "Take screenshot" keybind and you'll see the complete path of the screenshot taken at the top right corner of your screen.
The path shown ends on "Screenshots".
Just open this path outside of the game in the file explorer and navigate 1 folder up to the "live" folder.
In the live folder there will be located the "SavedVariables" folder.


Backup of SavedVariables
You are able to backup the whole folder "SavedVariables", or single addon files in this folder, if you are logged out of the game!
Do not copy or manipulate them as you are logegd in! You will copy old data/change the files but the ingaem data will overwrite them again!

Simply copy the whole folder, or selected files, and paste them somewhere else, e.g. create a folder "C:\ESO_SV_BACKUP" and for each backup create a new subfolder with the date e.g. ("2021-06-06") and copy them there.
This should be done e.g. before a new chapter or DLC arrives with a patch, in order to be sure you got working settings of your addons,
and are able to restore the settings from these old files.
I even recommand taking at least a weekly backup of the files.


Restore of SavedVariables
You need to be logged out before you restore the SV files!
Just copy the backuped SV lua files back into the folder live/SavedVariables.
Rename your existing files or backup them before if you want to keep them!
After login the data will be read from these files again.


Manual changes to SavedVariables
You are able to manually change your SavedVariable files, e.g. change a setting of an addon.
But this will only take effect if you are logged out of the game as you change the files!
If you are logged in, the next user interface reload will overwrite the file on your disk from internal game memory again.
So you changes done will be overwritten with old data again!

Here is an example how a SV file could look like, for the addon "Harvens Custom Map Pins"
Lua Code:
  1. HarvensCustomMapPins_SavedVariables =
  2. {
  3.     ["Default"] =
  4.     {
  5.         ["@AccountName"] =
  6.         {
  7.             ["My Character Name 1"] =
  8.             {
  9.                 ["version"] = 1,
  10.                 ["exported"] = true,
  11.                 ["pinLevel"] = 30,
  12.                 ["predefined"] =
  13.                 {
  14.                 },
  15.                 ["showAdvanced"] = false,
  16.                 ["x"] = 0,
  17.                 ["pins"] =
  18.                 {
  19.                 },
  20.                 ["relPoint"] = 128,
  21.                 ["pins_backup_1"] =
  22.                 {
  23.                 },
  24.                 ["legendPos"] =
  25.                 {
  26.                     ["x"] = -38,
  27.                     ["y"] = 20,
  28.                     ["relPoint"] = 3,
  29.                     ["point"] = 9,
  30.                 },
  31.                 ["y"] = 0,
  32.                 ["pinSize"] = 40,
  33.                 ["point"] = 128,
  34.             }, --closing character
  35.       } -- closing @account
  36.    } --closing Default
  37. } -- closing SV table HarvensCustomMapPins_SavedVariables

The first line without the "..." string qutoation marks is the name of SavedVariables table, defined in the txt file of the addon, behind the
Code:
## SavedVariables: HarvensCustomMapPins_SavedVariables
tag.
In this example it is: HarvensCustomMapPins_SavedVariables

lua tables always open with a { and close with a }. So there are always must be pairs of them for open and close.
Tables can contain tables in them (sub-tables) so { { } } is possible as you can see in the sample above.
The table got a key and a value, where the key normally is a string within quotation marks, and the value can be a number, a string, a boolean true/false value or even anotheer table:
Lua Code:
  1. ["key1"] = 1,
  2. ["key2"] = "hello world",
  3. ["key3"] = false,
  4. ["key4"] = {
  5.  ["subTableKey1"] = 99,
  6. },
Each line between the opening and closing { } of a table normally closes with a , so that the table knows there is the end and anoter entry is following.

The ["Default"] line in the example is created automatically if an addon uses the standard SavedVariables method that teh game developer ZOs provides (ZO_SavedVars:New*).
It could also be named differently, like e.g. "Settings" or even the server name "NA megaserver"/"EU megaserver") to distinguish the settings server dependently.

The ["My Character Name 1"] could also be a number like ["89012723464237432"] sometimes! Within the subtable of this tbale you'll find an entry ["$lastCharacterName"] = "My character Name 1" then to be able to find out which char name got wchih unique number. The unique number is the 89012723464237432 in that case and it is unique per megaserver! As the number will not change if you rename your character, the savedvariables will still work using the number instead of the name! In teh past the unqiue number did not exist so older addons do not support it (yet).

All other ["text here"] entries is data of the addon itsself and should not be touched or altered, except you know what you do and what it will do to the addon!


Copy SV from 1 PC to another, or from 1 @account to another
So if you want to copy the contents of this SV file to another computer and make it work with your own @accountName and characterName you just need to
I recommand using the Notepad++ editor to edit the lua file. It helps with the opening and closing { }.
You are bale to download it here: https://notepad-plus-plus.org/downloads/
After installation/or after download and extraction of the "standalone non-install version": You need to open Notepad++ and click on the menu strip on "Plugins" -> "Plugin management". In the now shown plugin manager popup search for "lua" and install the "LuaScript" plugin so that .lua files and their scripts are properly supported!

1) Logout, as described above!
2) Find the SV file you want to copy
3) Make sure you are logged out at the destionation pc!
4) Copy the SV lua file from the source to the destination pc's SavedVariables folder (backup same filenames there before!)
5) Edit the dstination SV lua file and if a servername is given in the SV files change the ["EU Megeserver"] to the server you'd like to use the data on. Possible values are: "NA Megaserver", "EU Megaserver" or "PTS" for the Public Test Server.
6) Change the ["@AccountName"] to ["@YourAccountName"] (the one you login and play with, and where these settings should work
7) Change the ["My Character Name 1"] to the character name of the char you'd like to use the settings on.
8) If no ["My Character Name 1"] is given but a unique number ["832423420474723"] or similar is given, you need to find out which unique number your desired character got. You can spy in other addon's SV files if you find it, or you can use the following script ingame in the chat editbox to print out the unique character ID of your currently logged in Character. Simply copy the text here and paste it into your chat editbox, then press the return key.

Attention:
After login your currently edited file will be read and overwrtitten again if it was false somehow! So backup the chnaged file BEFORE starting the ESO client so you are able to copy it into the SV folder again AFTER logging out again, to return to the editing properly at your last state!!!

Code:
/script d("Char name/ID: "..tostring(GetUnitName("player")).."/"..tostring(GetCurrentCharacterId())
If you want to get a list of all character names of the currently logged in account, you can use this script:
Code:
/script for i=1,GetNumCharacters() do local n,_,_,_,_,_,c=GetCharacterInfo(i) d(string.format("Char name/ID: %s/%s",n,tostring(c))) end
After getting the unique character Id of your character name you can use this in the SV file. Remember to copy over your last changed state of the SV file into the SV folder again to go on editing the correct file.

If there are no ["My Character Name 1"] nor any ["82424234238428343"] unique character IDs the addon most probably ONLY saves it's settings account wide, and does not support the character depending settings.
9) In the end save the SV file, backup it so it won't get destroyed after 1st login if you did something wrong.

If you do not want to copy the files from 1 PC to another, but only want to copy the data of 1 @account to another, you do about the same. But you simply edit the SV lua file at the PC where you want to add the @account, search for the table structure shown above in the example, and you copy "all" lines starting at the ["@accountName"] = {
including it's closing }!
-> I've marked the closing } with the comment "-- closing @account" above in the example!

Paste it below the closing } of the source @account so that the whole entries are doubled.
Change the new pasted @accountName to your accountname, e.g. @AccountName2.

Be sure to check that the closing } of the old account (in the exampal above this is @AccountName) got a , behind its closing }!

It should look like this in the end
Lua Code:
  1. HarvensCustomMapPins_SavedVariables =
  2. {
  3.     ["Default"] =
  4.     {
  5.         ["@AccountName"] =
  6.         {
  7.         }, -- closing @account -> Check the , after }!!!
  8.  
  9.         ["@AccountName2"] =
  10.         {
  11.         }, -- closing @account 2
  12.     } --closing Default
  13. } -- closing SV table HarvensCustomMapPins_SavedVariables
Maybe check the characternames below the table ["@AccountName2"] match to this account.
Save the file and it should work.


Resetting SavedVariables
Attention: LOGOUT! before doing this or the game will rebuild the reset file contents on next reloadui/zone change again from internal data!

If you reset the SavedVariables they will be gone and all settings and collected data of the addon will be lost!
So backup the SV file of the addon you want to reset before doing this!


Check the addons' settings menu ingame first if there exist options to delete, or reset, or partially clear the SavedVariables before you have to reconfigure all again!

Resetting the SavedVariables does only need you to delete the complete addon's SavedVariables file in the folder live/SavedVariables/<addonFolderNameTotallyTheSameLikeIn /live/AddOns here>.lua
e.g. if the addon's "folder name" you want to reset is "FCOItemSaver" the file of the SV will be live/SavedVariables/FCOItemSaver.lua
Delete this file while logged out, and the next time you login the file will be rebuild from the addon, using the addon's default settings.
You need to reconfigure ALL at the addon's settings menu afterwards (or if there is no settings menu, use the existing slash commands -> See that addon's description). Or if there are no settings and the addon only collects data you need to recollect the data (e.g. login with all characters to collect all known/unknown recipes, research items, etc. / or collect the GuildHistory data for LibHistoire again).

If you are using Minion (the addon manaegr tool) you can simply check the instaleld addons tab, scroll to your addon you want to reset the SVs for, and right click it, choose "Delete SavedVariables".



Loading time of ESO & SavedVariables
SavedVariables are read & saved on each login, reload UI and zone change where a loading screen occurs (wayshrine ports between zones e.g.).
Each SV file can increase in size and thus increase the loading time.
Especially addons that collects many data accross your toons or which save guid store data like LibHistoire, TTC, MasterMerchant, but even other libraries like LibDebugLogger and so on (having multiple MB of data in the end) can increaase the loading time by seconds, depening on your PC's hardware (SSD vs. HDD, internet connection for upload/download, CPU, etc.).

So disable not needed addons if you want to speed up the loading screens of ESO.
Use an addon like "Addon Selector" to save your addon profiles (e.g. overland, quest, craft, PvP, PvE, Dungeon, trial, RPG, ...) and switch between them with a few clicks.
Remember that addons cannot collect data if they are disabled so if you want to see what items your toon1 got as you login on toon2, you must have the addon enabled on both toons. It will always only show the state of data that was collected as the addon was active!).

Last edited by Baertram : 12/01/22 at 03:06 AM.
  Reply With Quote
12/25/23, 05:05 PM   #2
vsrs_au
Join Date: Dec 2022
Posts: 15
[ I thought this would be a useful addendum to Baertram's SavedVariables post, but if I posted this in the wrong location, my apologies and feel free to move it. ]

Hopefully someone will find this useful? I'm working on an addon, and part of the addon is to convert information in the SavedVariables file for the addon to .CSV format, so it can be imported into a spreadsheet and then analysed/graphed/whatever. For the conversion, I wrote a LUA script, and the first thing it needs to do is to find the user's documents (aka 'personal') directory in Windows, so this is what this thread post describes, how to get this directory without making any assumptions about where it actually is on each user's PC.

There are 2 ways to do this (that I know of, anyway):
  1. Use an environment variable. The following LUA code will determine the directory location using the 'USERNAME' environment variable:
    Code:
    dirDocuments = 'C:\\Users\\' .. os.getenv('USERNAME') .. '\\Documents'
    This isn't perfect, though, because on some systems (it occurred on mine), the user may have been renamed, and dirDocuments will be set to a path including the user's old name, not the new. Fortunately, there's another option (see next bullet point).
  2. Get the documents directory from the Windows registry. This is more complicated, involving (a) writing a batch file to run a registry query command, then (b) running the batch file in LUA and retrieving its output. The batch file would be:
    Code:
    @echo off
    for /f "tokens=3*" %%p in ('REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Personal') do ( echo %%p %%q )
    Then, to run the batch file in LUA we use:
    Code:
    local openPop = assert(io.popen('C:\\Windows\\System32\\cmd.exe /c "D:\\_script\\findDoc.bat"', 'r'))
    local dirDocuments = openPop:read('*all')
    openPop:close()
    This example is taken from my PC, so the batch file path will change of course. This produces a similar result to the first option, but finds the correct documents directory even if the user name was changed at some point. The batch file need not already exist, because the LUA code could create it dynamically, first by getting the TEMP directory using os.getenv('TEMP'), then by writing the abovementioned batch file contents to a .bat file in that directory.

Having retrieved the user's documents directory in Windows, we can then read any SavedVariables file using code similar to:
Code:
local openPop = assert(io.popen('C:\\Windows\\System32\\cmd.exe /c "D:\\_script\\findDoc.bat"', 'r'))
local dirDocuments = openPop:read('*all')
openPop:close()

dofile(dirDocuments .. '/Elder Scrolls Online/live/SavedVariables/MyAddon.lua')

.....

<<process the file contents as you wish>>

Last edited by vsrs_au : 01/01/24 at 08:30 PM.
  Reply With Quote

ESOUI » AddOns » AddOn Help/Support » HowTo: SavedVariables - Find the folder, backup, copy

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