ID:157666
 
Could someone code an example of a script that checks if the user has a savefile, if he does it loads it, and if he doesn't it creates and saves a new one. Only save and load an example variable like x or something.

Normally I wouldn't ask somebody else to code something for me, but I give up on savefiles.
I think using the fexist procedure will solve your problems.
In response to Ulterior Motives
Sorry for the long reply. I know of fexist, but thats not my problem. My problem is the placing of a save/load script, may someone please show an example of one that manipulates an example variable (like x or something).
In response to Railon
Read chapter 12 of the byond guide that should clear it up.
client/New()
var/player_sav = "players/[ckey].sav"
if(fexists(player_sav)) //if player savefile exists
var/savefile/F = new(player_sav) //open it
F >> usr //create saved mob
return ..() //creates a new mob if necessary

mob/Logout()
var/player_sav = "players/[ckey].sav"
var/savefile/F = new(player_sav)
F << src //Save the mobs savable vars.
del src //delete the mob at the end of their logout.

Is that what you are talking about ?