ID:150361
 
If

var/savefile/f = new("char_files/[mob.ckey]")

where mob.ckey is a save file previously created like this:

savefile << mob

shouldn't

f["name"] >> n

put the saved mob's name in a variable n?</<>
LexyBitch wrote:
If

var/savefile/f = new("char_files/[mob.ckey]")

where mob.ckey is a save file previously created like this:

savefile << mob

shouldn't

f["name"] >> n

put the saved mob's name in a variable n?

Yep, I think so. Don't work with savefiles in that manner very much. Normally I just write to the savefiles and read from them in the same order :
f << name
f << health

f >> name
f >> health

But it is much easier just to use the autosaving feature and use f >> mob.
LexyBitch wrote:
If

var/savefile/f = new("char_files/[mob.ckey]")

where mob.ckey is a save file previously created like this:

savefile << mob

shouldn't

f["name"] >> n

put the saved mob's name in a variable n?

No.

Auto-saved objects use a special format. You can't access the info without reading in the full object.

If you need that info without loading the full object, then you have two options: Save the object yourself (a pain) or, what I do, do an extra save of the info you need, like so:

char_files/[mob.ckey]
name
mob


In this case, the name of the mob was specifically stored for easy access. The entire mob is stored under mob.