ID:154935
 
I am reall new to coding and I am having trouble making a saving/loading code. I have tried using libraries and they apparently don't like my game. Is there anyway possible for someone to help me?
client
proc
Save()
var/savefile/F = new("players/[src.key]")
F["mob"] << mob

Load()
if(fexists("[ckey].sav"))
var/savefile/F = new("players/[src.key]")
F["mob"] >> mob

mob
Write(var/savefile/F)
..()
F["x"] << x
F["y"] << y
F["z"] << z
Read(var/savefile/F)
..()
loc = locate(F["x"], F["y"], F["z"])

Should work
In response to SuperGameMaster
I wil try that
Thanks

One more thing

How could I make a universal self train code? So I can use it in multiple games?
In response to Ashs999
Self Train = for rips, also meaning if your trying to make a self train verb for a non-rip then ur game just purely sucks.
In response to SuperGameMaster
Is it okay that he says that the if statement isn't effective? That's what he says about the if(fexists) part...
In response to Kimmiehier
as long as it loads from the correct location, it should not be a problem.

I guess thats the issue here, if you copied SuperGameMaster's reply.
In response to Tafe
I was thinking a self train verb that was purely scratch and not really even called self train. I want a way to level up without punching a stupid bag or killing people.