ID:142198
 
Code:
mob
proc
CharacterSave()
var/savefile/F=new("[src.ckey]")
F["M"]<<src.money
//etc
client.Export(F)
CharacterLoad()
var/savefile/F=new("[src.ckey]")
client.Import(F)
//check stuff, etc


Problem description: This isn't saving the save file on the client's pc. I've been looking over and over at the DM Guide and I think I used Import and Export right. o.o
Any help is appreciated.
Ruben7 wrote:
Code:
> mob
> proc
> CharacterSave()
> var/savefile/F=new("[src.ckey]")
> F["M"]<<src.money
> //etc
> client.Export(F)
> CharacterLoad()
> var/savefile/F=new("[src.ckey]")
> client.Import(F)
> //check stuff, etc
>


The first problem I'd like to point out is that client-side savefiles (the ones you use Export()/Import() for) don't have user-defined filenames, so you would instead write your save proc as such:
mob/proc/CharacterSave()
var/savefile/F = new
// save stuff
client.Export(F)


The next problem is that Import() rather returns the client-side file that you use as a parameter to the savefile/New() proc:
mob/proc/CharacterLoad()
var/client_savefile = client.Import()
if(client_savefile)
var/savefile/F = new(client_savefile)
// load stuff


In the future, when you have problems with the specifics of procs like this, turn to the DM Reference before asking for help here (press F1 in DreamMaker). Sometimes it will save you the hassle of a forum post, and the answer will be much faster (can take days, if at all, to be answered here).
In response to Kuraudo
Thank you.