View Single Post
08/20/15, 03:35 PM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,001
What kind of example do you want to see for this?
I'm not able to actually write an addon for it :-)

Here is an example tutorial abou the SavedVariables:
http://wiki.esoui.com/Circonians_Sav...ables_Tutorial

Maybe it helps you to understand the addons and how they save the data to the harddisk.

If you just take a look at the SavedVariables folder (one folder above your "Addons" folder) on your local harddrive, you'll find the stored lua files for the different addons.
The path should be something like:
Code:
C:\Users\<your windows user name>\Documents\Elder Scrolls Online\live(eu)
The structure of the SavedVariables lua files look like this:
Code:
Addon_SavedVariables_Name =
{
    ["Default"] =
    {
        ["@AccountName"] =
        {
            ["CharacterName1"] =
            {
                ["variableName"] =
                {
                    ["value1"] = 1,
                    ["value2"] = true,
                    ["value3"] = {
                    	"1" = 1,
                        "2" = true,
                        "3" = "Hello"
                    },
                },
            },
            ["CharacterName2"] =
            {
                ["variableName"] =
                {
                    ["value1"] = 12,
                    ["value2"] = false,
                },
            }
            ["$AccountWide"] =
            {
                ["variableName"] =
                {
                    ["value1"] = -1,
                    ["value2"] = "Hello World",
                },
            }
        }
    }
}
The "Addon_SavedVariables_Name" can be any string as a description which addon' saved variables this table contains. It's sepcified inside the according addon as you can see in the tutorial above.

The "default" table entry is the default branch to follow.

@AccountName is a placeholder for the @account ingame where these settings are stored for.
Below the @AccountName there can be different "CharacterNames" if you store the settings differently for each of your characters, or a variable "$AccountWide" which will contain the settings for ALL your characters.
Settings for all characters AND for each character can be combined, so there mustn't be just either each character or all characters.
Example: Positions of windows will be stored differently for each character, but the content will be stored the same for all characters.


The data saved will be stored as different types.
Either boolean, integer, String, array, mixture of all, etc like shown in the example structure above.



You'd need some tool where you specify the SavedVariables .lua filename to read from, parse the structure of this lua file and use the information gained to upload it to a database somewhere.

Same way for writing to the SavedVariables file.
But: If you write to the SavedVariables file and the game client is running at this moment, all written data to the SavedVariables will be overwritten by the current game values if the user logouts/closes the game/does an /reloadui ingame AFTER you wrote to the file.
  Reply With Quote