mob/player
Login()
if(fexists("Players/[src.key].sav"))
var/savefile/F = file("Players/[src.key].sav")
F["WinTotal"] >> src.WinTotal
else
var/savefile/F = new("Players/[src.key].sav")
F["WinTotal"]<< src.WinTotal
bad save file?
ID:158029
Nov 15 2009, 3:26 am
|
|
mob/player bad save file? |
As Leur said, you still want to use new() even if the file does not exist. The reasoning behind this is that you are creating a savefile object. Regardless of whether the file actually existed on disk or not, you are creating a savefile object.
savefile's new() is going to handle determining whether the file you want actually exists on disk or not. If it does not, it will create an empty file on disk and the savefile will be linked to that. If it does exist, the file that exists will be used. You can use fexists() ahead of time to take special action depending on whether or not the file was already there, but you still do var/savefile/mySaveFile = new(filename) either way. |
Sorry if I'm wrong I'm just so tired right now. the solution is to change it from file() to new() since we are trying to bring that save into a variable for loading as we did for saving it. *if I have any sense left that is*