ID:1624204
 
(See the best response by FKI.)
Can you only save global variables? If I have a list full of stuff in an area or turf, can I save it directly? Would I have to move all of its contents to a global list to save it? Basically I have a bunch of strings saved to lists in multiple /area/ and I want to save them to the world.
Best response
Yes, it can be done. In case you are wondering how you would go about saving something, here's a demonstration that scratches the surface:

var/global/list/helpers = list()

proc/save_helpers()
// There's no reason to save if the list is empty.
if(!global.helpers.len)
return

var/savefile/savefile = new("helpers.sav")

// Method 1: saving everything inside the savefile into the global helpers list.
savefile << global.helpers

// or Method 2: saving to a specific part inside the savefile (very similar to using an associative list).
// I personally prefer this way though, if anything. This way, one list isn't hogging a savefile.
savefile["helpers"] << global.helpers

proc/load_helpers()
// Can't load a non-existent savefile.
if(fexists("helpers.sav"))
var/savefile/saved_helpers = new("helpers.sav")

// Method 1:
saved_helpers >> global.helpers

// or Method 2:
if(saved_helpers["helpers"])
saved_helpers["helpers"] >> global.helpers


You can save strings in a very similar manner. What you want to focus on is how you're going to separate the information inside the savefile(s). Loading it wouldn't be much different than this.

I am no expert on savefiles, but I'm fairly sure you won't need any knowledge outside of my example to do what you want to do. You may want to take a look at some resources to get a better feel for how savefiles work though.