Thread Tools Display Modes
04/17/14, 03:58 PM   #1
Mitazaki
 
Mitazaki's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 23
Saving Data

I'm looking for a way to dump large amounts of data to a file

Im thinking of the following options but not sure what's possible :

1...Use a text box ingame that can have its contents copied and then pasted outside game.

2...Save in a very very large variable in \SavedVariables.

3...Some other lua method that can be used to save/dump data to a file.

4...Loop through the data and dynamically create new savedvariables eg ( savedvariables.data1 , savedvariables.data2 , savedvariables.data3 , savedvariables.data4 and so on for each field in the loop ) for \SavedVariables
  Reply With Quote
04/17/14, 06:11 PM   #2
Lodur
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 108
1) Does not work. It is blocked.

2) Might work - don't know the limits. Remember that it will all stay in the clients memory until the character logs out to actually write the save variables file.

3) There are none known.

4) Not much difference from #2.
  Reply With Quote
04/17/14, 07:03 PM   #3
Errc
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 30
Originally Posted by Mitazaki View Post
I'm looking for a way to dump large amounts of data to a file

Im thinking of the following options but not sure what's possible :

1...Use a text box ingame that can have its contents copied and then pasted outside game.

2...Save in a very very large variable in \SavedVariables.

3...Some other lua method that can be used to save/dump data to a file.

4...Loop through the data and dynamically create new savedvariables eg ( savedvariables.data1 , savedvariables.data2 , savedvariables.data3 , savedvariables.data4 and so on for each field in the loop ) for \SavedVariables
1) Does work, use an editbox. But it is very limited in size, ~1000 characters.

2) Saving to SV is the easiest way and the way you will want to do this likely.

3) Chatlog was disabled, I don't think it has made a comeback so none.

4) Same as number 2 but split from 1 var into many.
  Reply With Quote
04/18/14, 06:40 AM   #4
Mitazaki
 
Mitazaki's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 23
Can savedvariables be saved as table/array so that a dynamic number of variables can be created
like

Code:
savedvariables = ZO_SavedVars:NewAccountWide("SAVEDSTUFF", 1, nil, defaults)
savedvariables.data = {}

for loop x=1, blah blah then
 savedvariables.data[x] = data
end
  Reply With Quote
04/18/14, 09:19 AM   #5
Lodur
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 108
Originally Posted by Mitazaki View Post
Can savedvariables be saved as table/array so that a dynamic number of variables can be created
like

Code:
savedvariables = ZO_SavedVars:NewAccountWide("SAVEDSTUFF", 1, nil, defaults)
savedvariables.data = {}

for loop x=1, blah blah then
 savedvariables.data[x] = data
end
yes it will save complex data.
  Reply With Quote
04/18/14, 09:45 AM   #6
Stormknight
 
Stormknight's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 128
Originally Posted by Lodur View Post
yes it will save complex data.
Including multi-dimensional tables.

Code:
savedvariables.data = {}
For i = 1, 10 do
    Savedvariables.data[i] = {} -- new row
    For j = 1, 10 do
        Savedvariables.data[i][j] = some value
    End
End
Ignore the weird capitalisation, that's my tablet doing that....
  Reply With Quote
04/19/14, 09:43 PM   #7
ins
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 76
SavedVariable file can be over 3.9GB large.
Thats when the game crashed cause my SSD was full anyway.

  Reply With Quote
04/21/14, 06:47 AM   #8
Mitazaki
 
Mitazaki's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 23
Originally Posted by ins View Post
SavedVariable file can be over 3.9GB large.
Thats when the game crashed cause my SSD was full anyway.

lol that may be a little bit more than required. But how do you go about dynamically adding new vars to it.
  Reply With Quote
04/21/14, 06:52 AM   #9
ins
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 76
Couldn't you just use

For example:

insM2L.SV = ZO_SavedVars:NewAccountWide("insM2L_SV" , 100 , "NameSpace1" , insM2L.defaults, "Default Profile" )

And if you need more.

insM2L.SV2 = ZO_SavedVars:NewAccountWide("insM2L_SV" , 100 , "NameSpace2" , insM2L.defaults, "Default Profile" )

Etc?

Just replace "NameSpace1" etc with a Variable you change.

It could look like this in /SavedVariables/ then

Code:
insM2L_SV =
{
    ["Default Profile"] = 
    {
        ["@"] = 
        {
            ["$AccountWide"] = 
            {
                ["Namespace1"] = 
                {
                    ["debug"] = 0,
                    ["cusXP"] = [[<cY>+<cG><1><cW> XP <cY>[<cG><2><cW> remaining<cY>] [<cG><3><cW> Kills<cY>].]],
                    ["cusSkill"] = [[ <cW>You gained <cG><1><cW> XP in <cT><<4>><cW>. <cY>(<cG><3><cW> Repeats for levelup<cY>)]],
                    ["version"] = 100,
                },
                ["Namespace2"] = 
                {
                    ["debug"] = 0,
                    ["cusXP"] = [[<cY>+<cG><1><cW> XP <cY>[<cG><2><cW> remaining<cY>] [<cG><3><cW> Kills<cY>].]],
                    ["cusSkill"] = [[ <cW>You gained <cG><1><cW> XP in <cT><<4>><cW>. <cY>(<cG><3><cW> Repeats for levelup<cY>)]],
                    ["version"] = 100,
                },
Only have to figure out how to adress the various "insM2L.SV" , try with [x] or something ?
  Reply With Quote
04/21/14, 06:01 PM   #10
Mitazaki
 
Mitazaki's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 23
Oh that would be perfect, I mean if I used it in conjunction with a custom PHP parser to get all the deets out of it.

Only other thing is, how do you wipe a savedvariable file clean ? I have noticed old unsed variables hang around.

It's minor though, if it comes to it the user could manually delete if need be.

Thx again INS

Last edited by Mitazaki : 04/21/14 at 06:03 PM.
  Reply With Quote
04/21/14, 06:58 PM   #11
Joviex
 
Joviex's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 42
Originally Posted by Mitazaki View Post
Oh that would be perfect, I mean if I used it in conjunction with a custom PHP parser to get all the deets out of it.

Only other thing is, how do you wipe a savedvariable file clean ? I have noticed old unsed variables hang around.

It's minor though, if it comes to it the user could manually delete if need be.

Thx again INS


in LUA you simply set the entry to nil.


["VariableWithCrapIwantToRemove"] = nil


Defaults.DeleteMe = nil


On save, it will disappear.
  Reply With Quote
04/22/14, 09:00 AM   #12
Saucy
 
Saucy's Avatar
Join Date: Apr 2014
Posts: 20
I wipe my savedvariable file by:

- Disabling the addon it uses (+ /reloadui)
- Delete the file
- Re-enable the addon then running /reloadui again to make a new file.
  Reply With Quote
04/22/14, 09:22 AM   #13
ins
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 76
table.remove should work as well I think.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Saving Data


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