ID:262163
 
mob
Write(savefile/F)
..()
F.cd = "/players/[ckey]/"
F["X"]<<x
F["Y"]<<y
F["Z"]<<z
Read(savefile/F)
..()
F.cd = "/players/[ckey]/"
var/X
var/Y
var/Z
F["X"]>>X
F["Y"]>>Y
F["Z"]>>Z
loc=locate(X,Y,Z)

mob
proc
Save()
var/savefile/F = new(ckey)
F.cd = "/players/[ckey]/"
Write(F)//saves your file
usr << "Saved...."
mob
Logout()
Save()


Once again I have been trying my hand at a save system these are what i always seem to get stuck on for some reason but this time I've managed to get quite far all i need to do is make it so that it saves to a new directory which i just cant get my head around. I would be much obliged if soone would be able to point out my errors and if my code is not very efficient point out what should be changed.
The directory is what you pass as an argument to the savefile's new function.
var/savefile/S=new("this folder/that folder/savefile.sav")

Of course, you can use variables to alter the name and directory.
mob
var/sub_dir=""
verb/change_directory(T as text)
sub_dir=T
verb/save()
var/savefile/S=new("saves/[sub_dir]/[ckey(key)].sav")