Jump to content

Recommended Posts

I'd like to implement something in which data can be stored and accessed from multiple maps, and also persist through workshop updates. I know about OnSave and OnLoad -- as far as I'm aware, those are tied to specific maps. If I store the data within the mod folder, then the data will be wiped if I ever update the mod. I don't think you're able to create files or folders outside the mod folder, so the user would have to do it manually, but would the mod have the ability to read and write to that file say if it was in the documents folder? If the user manually wrote in the data, then could the mod read it? 

I did a search and @simplex was trying to get this functionality added to the API in this thread, but it was pretty much ignored. Any updates on this or methods devised to circumvent the workshop erase?

In my ModifyOwnership mod I use TheSim:SetPersistentString and TheSim:GetPersistentString to save some data under configuration folder (i.e. Documents/Klei/DoNotStarveTogether)

TheSim:SetPersistentString('test_moddata.txt', "some test data", false, nil)

foo = ""
TheSim:GetPersistentString('test_moddata.txt', function(load_success, str)
    if load_success == true then
        foo = str
    end
end)

Reading it could get quite more complicated if the data is to be checked.

32 minutes ago, Muche said:

In my ModifyOwnership mod I use TheSim:SetPersistentString and TheSim:GetPersistentString to save some data under configuration folder (i.e. Documents/Klei/DoNotStarveTogether)

Isn't that what this (probably not DST compatible) module does?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...