ID:139148
 
Code:
mob/proc
Save()
src.AFKUndo()
src.verbstosave+=src.verbs
var/savefile/F = new("Saves/[src.key].sav")
..()
F["Verbs"]<<src.verbstosave
F["last_x"]<<src.x
F["last_y"]<<src.y
F["last_z"]<<src.z
F["PokeList"]<<src.PokeList
Write(F)
..()
src<<"Game saved!"
Load()
if(fexists("Saves/[src.key].sav"))
var/savefile/F=new("Saves/[src.key].sav")
Read(F)
..()
F["Verbs"]>>src.verbstosave
F["last_x"]>>src.x
F["last_y"]>>src.y
F["last_z"]>>src.z
F["PokeList"]>>src.PokeList
src.verbs+=src.verbstosave
src.loc=locate(src.x,src.y,src.z)
world<<"<font color=#de7979><u>[src]</u> has logged in!"
return
else
src<<"<u>You don't have a save file here!</u>"

mob/var/PokeList=list()
mob/var/verbstosave=list()


Problem description:
Saving works perfectly well, but when I catch a Pokemon and add it to the PokeList, it corrupts the save file.
It confuses me, because I have the same thing for Badges, but the badges don't corrupt the saves, they work perfectly well, and they're not even defined in the Save().
My thoughts are it's trying to save the list with mobs in it, and after trying with Raimo on a fix, I'm resulting to posting it for a bigger audience perspective.

We tried adding
F["mob"]<<src
and
F["mob"]<<usr
and even
var/mob/Player/M
F["mob"]<<M

but nothing seems to be working properly.

Thoughts?

Calling Write() directly will result in the savefile being corrupted. An example of how to save and load properly can be found at [link]
In response to Garthor
I appreciate your response, however, the game uses a title screen, so I'd need to call these procs when saving and obviously on command for load, not just when the client logs in.

Would you be able to suggest a method that I'd be able to call upon? Or should I just make the Procs the verbs for saving or how do you suggest I approach it?

EDIT: Nevermind, I figured out what I could do, and it appears to work, so for now I will leave it. :)

If anyone else is interested in the end code:

mob/proc
Save()
var/savefile/F=new("Saves/[src.key].sav")
Write(F)
Load()
var/savefile/F=new("Saves/[src.key].sav")
Read(F)

mob/Write(var/savefile/F)
..()
F["mob"] << usr
F["x"] << x
F["y"] << y
F["z"] << z
F["Verbs"]<<src.verbs

mob/Read(var/savefile/F)
if(fexists("Saves/[src.key].sav"))
F["mob"]>>usr
usr.verbs+=F["Verbs"]
usr.loc=locate(F["x"],F["y"],F["z"])
if(istype(usr,/mob/Player/))//I found without this it announces any Pokemon owned by the Player as online.
world<<"<font color=#de7979><u>[usr]</u> has logged in!"
return
else
src<<"<u>You don't have a save file here!</u>"
..())


Also: I know from what you're saying, I shouldn't be declaring Write() or Read() [at least, that's what I'm understanding from your posts] but it works so I'm happy. :)
In response to Mikeee
You're still calling Write() and Read() directly.

Garthor wrote another method that uses procs you can call whenever here: [link]