ID:267940
 
i don't know how to do Save files on games. I know you guys don't like writing out the whole code for people, but I don't understand it. so could u kinda, uh, help me out?
Check out a demo of it, theres tons of em.
mob
Write(savefile/F)
..()
F["last_dir"]<<src.dir
F["last_x"]<<src.x
F["last_y"]<<src.y
F["last_z"]<<src.z
Read(savefile/F)
..()
var
last_x
last_y
last_z
last_dir
F["last_dir"]>>last_dir
F["last_x"]>>last_x
F["last_y"]>>last_y
F["last_z"]>>last_z
src.dir=last_dir
src.loc=locate(last_x,last_y,last_z)
proc
Delete()
if(fexists("player/[copytext(src.ckey,1,2)]/[src.ckey].sav"))
switch(alert(src,"Are you sure you wish to delete your save file?","Delete Save File?","Yes","No"))
if("Yes")
fdel("player/[copytext(src.ckey,1,2)]/[src.ckey].sav")
else
return 0
else
src<<"<b>No data found.</b>"
Save()
var/savefile/F=new("player/[copytext(src.ckey,1,2)]/[src.ckey].sav")
F<<src
Load()
if(fexists("player/[copytext(src.ckey,1,2)]/[src.ckey].sav"))
var/savefile/F=new("player/[copytext(src.ckey,1,2)]/[src.ckey].sav")
F>>src
else
src<<"<b>No data found.</b>"


WHAM-O! That's a simple saving proc done in about 30 seconds. Of course, you can take these same basic concepts and elaborate on it and create something much more.
Dark Weasel wrote:
i don't know how to do Save files on games. I know you guys don't like writing out the whole code for people, but I don't understand it. so could u kinda, uh, help me out?

Here's a comprehensive write-up:
http://www.deadron.com/Games/ByondBasicSavefiles.html

And here's a library that will do it for you, or from which you can learn code concepts:
http://developer.byond.com/hub/Deadron/CharacterHandling