ID:144085
 
Code:
SavePlayer()
var/firstletter=copytext(src.ckey, 1, 2)
var/savefile/F = new("players/[firstletter]/[src.ckey].sav")
F["Name"]<<src.name
F["TFP"] << src.TotalFreezePoints
F["TUF"] << src.TotalUnFreezePoints
F["THS"] << src.TotalHideScore
F["TIT"] << src.Times_IT
F["NIT"] << src.non_IT_times
F["GW"] << src.GamesWon
F["TF"] << src.TimesFrozen
F["Music"] << src.music
F["MF"] << src.MostFreezes
F["MUF"] << src.MostUnFreezes
F["LS"] << src.LongestSurvival
return

//-----------------------------------------------------------------------------------------------------------------
LoadPlayer() //Load proc
var/firstletter=copytext(src.ckey, 1, 2)
if(fexists("players/[firstletter]/[src.ckey].sav"))
var/savefile/F = new("players/[firstletter]/[src.ckey].sav")
F["Name"] >> src.name
F["TFP"] >> src.TotalFreezePoints
F["TUF"] >> src.TotalUnFreezePoints
F["THS"] >> src.TotalHideScore
F["TIT"] >> src.Times_IT
F["NIT"] >> src.non_IT_times
F["GW"] >> src.GamesWon
F["TF"] >> src.TimesFrozen
F["Music"] >> src.music
F["MF"] >> src.MostFreezes
F["MUF"] >> src.MostUnFreezes
F["LS"] >> src.LongestSurvival
return


Problem description:
This works close to perfectly, it nearly always saves peoples scores, but sometimes without me deleting any files, it doesn't load certain peoples files...

I give credit to Dark Emrald for helping with this, but obviously it still needs work.

-KirbyAllStar
Nothing looks obviously wrong with what you shared. Your problem could be from where ever Loadplayer() or SavePlayer() is called from.

Any runtime errors, or just they go to load the player and it does absolutely nothing? When this happens, do they actually have save files and they're just not loading, or are they mysteriously disappearing? Did you try writing some kind of troubleshooting proc that will output the contents of the save files to see that they contain valid data?

Also, I'm not sure what kind of game you're running, but you know you can just save and load the mob directly instead of each individual variable, right? Theres only a couple exceptions like loc.
In response to Zagreus
Well I was saving the variables like that because there were certain ones that I didn't want to save, but now I'm switching those to tmp vars. Its a Freeze Tag game.

They do still have the files but sometimes the files will reset themselves for no reason...

Thanks for the help, I'm going to try writing the mob directly with some vars not included, also can you not include the icon because as of right now I have 640+ savefiles and if it includes the icon that could get big quick.

-KirbyAllStar
In response to KirbyAllStar
I don't believe saving a mob through F[whatever] << mob will actually save a copy of the icon file to the save file. It instead saves a file reference to the RSC. At least that's my understanding.
In response to Zagreus
Ok thats good, thanks for the help.

-KirbyAllStar