Save file problem in Developer Help
|
|
This is my first forray into savefiles. I need to save and load world globals. Also a quick question. Can lists be saved?
This code here does not seem to work correctly and I am not positive how to make a savefile correctly.
var global currentcycle = 0 gametime = 0 timeinterval = 10 nextperiod lastperiod cycleperiod = 120 world area = /area/outside turf = /turf/grass view = 5 New() ..() var/savefile/worldsave = new("globals.sav") worldsave["cycle"] >> currentcycle worldsave["time"] >> gametime worldsave["nperiod"] >> nextperiod worldsave["lperiod"] >> lastperiod Del() world << "Saving global variables..." var/savefile/worldsave = new("globals.sav") worldsave["cycle"] << currentcycle worldsave["time"] << gametime worldsave["nperiod"] << nextperiod worldsave["lperiod"] << lastperiod world << "Global Variables have been saved."
|
|
var/list/bah
world/New()
..()
var/savefile/F = new("bah.sav")
F["bah"] >> bah
if(isnull(bah))
bah = new /list
world/Del()
var/savefile/F = new("bah.sav")
F["bah"] << bah
..()
That should work post if it doesn't :)
Also one thing I believe what you put should have worked.. Did you get errors and are you sure they aren't saving and loading?