ID:2415846
 
(See the best response by Kozuma3.)
This is my current setup for saving
Code:

mob/proc/SaveProc()
var/FileName="Players/[ckey(src.key)].sav"
if(fexists(FileName))
fdel(FileName)
var/savefile/F=new(FileName)
F["Level"]<<src.Level
F["Exp"]<<src.Exp
F["Nexp"]<<src.Nexp
F["HP"]<<src.HP
F["MaxHP"]<<src.MaxHP
F["Chakra"]<<src.Chakra
F["MaxChakra"]<<src.MaxChakra
F["Tai"]<<src.Tai
F["Nin"]<<src.Nin
F["Gen"]<<src.Gen
F["CC"]<<src.CC
F["SP"]<<src.SP
F["AP"]<<src.AP
F["Clan"]<<src.clan
F["PrimaryElement"]<<src.PrimaryElement
F["housenka"]<<src.housenka
F << src.name
F << src.skin
F << src.overlays
F["LastX"]<<src.x
F["LastY"]<<src.y
F["LastZ"]<<src.z
src<<"Character saved"


Problem description: Trying to save a bunch of variables at once, but dont know how

Also, loading is the same setup
Best response
F << src

F >> src

You would then use tmp vars for variables you wouldn't want to save.
Seems to work.. except now my login doesnt work properly
    Login()
if(src.LoadProc())
world<<"[src] has returned"
usr.Heal()
LoadElements()
LoadClan()
LoadIcon()


else
src.loc=locate(50,49,1)
world<<"[src] has logged In"
RegProc()


It always goes to else, even if a save file exists.
Its really weird, because it seems to load all variables as well as tossing me into character creation(RegProc).. hmm

My Save and LoadProc is this:

mob/proc/SaveProc()
var/FileName="Players/[ckey(src.key)].sav"
if(fexists(FileName)) fdel(FileName)
var/savefile/F=new(FileName)
F["WOW"] << src
F["LastX"]<<src.x
F["LastY"]<<src.y
F["LastZ"]<<src.z
src<<"Character saved"


mob/proc/LoadProc()
var/FileName="Players/[ckey(src.key)].sav"
if(fexists(FileName))
var/savefile/F=new(FileName)
F["WOW"] >> src
src.loc=locate(F["LastX"],F["LastY"],F["LastZ"])
src<<"Character Loaded..."
return 1


I assume it doesnt reach return 1, but why?