Arcita Posted March 2, 2016 Share Posted March 2, 2016 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? Link to comment https://forums.kleientertainment.com/forums/topic/65038-is-it-possible-for-mod-data-to-persist-across-maps-and-workshop-updates/ Share on other sites More sharing options...
Muche Posted March 2, 2016 Share Posted March 2, 2016 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. Link to comment https://forums.kleientertainment.com/forums/topic/65038-is-it-possible-for-mod-data-to-persist-across-maps-and-workshop-updates/#findComment-729179 Share on other sites More sharing options...
Mobbstar Posted March 2, 2016 Share Posted March 2, 2016 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? Link to comment https://forums.kleientertainment.com/forums/topic/65038-is-it-possible-for-mod-data-to-persist-across-maps-and-workshop-updates/#findComment-729185 Share on other sites More sharing options...
Muche Posted March 2, 2016 Share Posted March 2, 2016 Indeed it is. Link to comment https://forums.kleientertainment.com/forums/topic/65038-is-it-possible-for-mod-data-to-persist-across-maps-and-workshop-updates/#findComment-729194 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now