var/keybase/G_KB
world/New()
..()
G_KB = new()
if(isfile("KeyBase.sav"))
var/savefile/F = new("KeyBase.sav")
F >> G_KB
world/Del()
var/savefile/F = new("KeyBase.sav")
F << G_KB
return ..()
As you can see I do my saving in world's New and Del procs. G_KB is the datum I am saving/loading. It is defined as a global variable. Now what the datum's code looks like.
keybase
var
list/keys
New()
keys = new/list()
return ..()
Ok so what I want is I add datum/Key objects too the keys list. When I write the datum, shouldn't it write the list of key objects automatically? Under the Write() proc.
There is a KeyBase.sav file after I exit the world and re-enter(aka reboot()). But the keys list appears to be blank after I reload the G_KB on world/New(). So why?
Also furthor problems take place in my own debugging. Cause my savefile editor. Freezes up when ever I load it. So I can't look at what the savefile has loaded on it. (Like a blind man handling swords)
Thanks for any help. Credit will be given to the person that helps me. (You will be listed on the credits section). That is if you want to be.
The load process will create a new datum automatically, so you should not be initializing G_KB before the load. Instead, initialize it only if 1) the file isn't found, or 2) the file was empty.
The real source of your problem, though, is that isfile() is the wrong proc to be using here. All isfile() does is check to see if the argument is a file or if it's something else. In this case it's always false, because you're sending a string. If you sent isfile(file("KeyBase.sav")), that would be true, but it would tell you nothing about whether the file exists. The proc you need to be using here is fexists().
Lummox JR