ID:1755155
 
(See the best response by Kaiochao.)
Code:
    Write(var/savefile/F,var/list/neversave=null)
//make sure neversave has been initialized as a list with contents
if(neversave!=null&&istype(neversave,/list)&&neversave.len>=1)
//define i for storing initial variables
var/i
//run through neversave one time
for(var/v in neversave)
//if the variable is not savable (tmp/const/global/static) just remove it,
//as it will never save anyway.
if(!issaved(src.vars[v]))
neversave.Remove(v)
else
//get the initial value of the variable.
i = initial(src.vars[v])
//now, check if the variable would normally save.
if(i!=src.vars[v])
//if it has been changed since runtime, store the current value in neversave.
neversave[v] = src.vars[v]
//and set the variable to default so it won't save.
src.vars[v] = i
else
//remove the variable as it won't save because it's the default value.
neversave.Remove(v)
//call the default behavior.
. = ..(F)
//go back through everything and set it to whatever it should be.
for(var/v in neversave)
src.vars[v] = neversave[v]
//return whatever default would have returned.
return.
else
//fall back to normal behavior if neversave is not set up.
return ..(F)

//set up the new load behavior.
Read(var/savefile/F,var/list/neversave=null)
//check if neversave has been initialized as a list with contents
if(neversave!=null&&istype(neversave,/list)&&neversave.len>=1)
//run through neversave once
for(var/v in neversave)
//if the variable shouldn't be saved (tmp/const/global/static)
if(!issaved(src.vars[v]))
//remove the variable
neversave.Remove(v)
else
//store the current value.
neversave[v] = src.vars[v]
//call the default behavior.
. = ..(F)
//run back through the list
for(var/v in neversave)
//reset the values that may have been overwritten
src.vars[v] = neversave[v]
//return the default return.
return .
else
//fall back to normal behavior if neversave is not set up.
return ..(F)


Problem description:
The problem always occurs when the ..() is called which I am aware that it calls the default command for the command currently running in this code. I'm using the libary from Ter13 CleanSave and I've copied his code but the problem always occurs when the default is shown.

This is when the code is called:
mob/proc/LoadFile(var/mob/A)
var/savefile/F = "Save Files/[ckey].sav"
if(fexists(F))
Read(F)

src << "<b><font color = blue>Your savefile has been loaded. Welcome back [src.name]</font></b>"

mob/proc/SaveFile(var/mob/A)
var/savefile/F = new("Save Files/[ckey].sav")
if(fexists(F))
fdel(F)

Write(F)

src << "<b><font color = green>Your SaveFile has been Updated!</font></b>"


and this is the error that comes up:
runtime error: bad file proc name: Read (/datum/Read) source file: Saving and Loading.dm,85 usr: DevDuelist (/mob) src: DevDuelist (/mob) call stack: DevDuelist (/mob): Read("Save Files/devduelist.sav", /list (/list)) DevDuelist (/mob): Read("Save Files/devduelist.sav", /list (/list)) DevDuelist (/mob): LoadFile(DevDuelist (/mob)) DevDuelist (/mob): Login()

I have tried tampering but I either get this error or cannot append to list error. This has actually really stressed me out and I've been trying to figure it out all day.
Best response
Your LoadFile needs to make a save file before calling Read. Like, F = new (F).
That error comes up with the list error (Cannot append to list).

Anyway, after careful think, i decided to just write the savefile in that command,I have no idea what I am doing as I have never had to do this with other games I've made (On previous accounts).

mob/proc/LoadFile(var/mob/A)
var/savefile/F = new("Save Files/[ckey].sav")
if(fexists(F))
F["mob"] >> A

src << "<b><font color = blue>Your savefile has been loaded. Welcome back [src.name]</font></b>"

mob/proc/SaveFile(var/mob/A)
var/savefile/F = new("Save Files/[ckey].sav")
if(fexists(F))
fdel(F)

F["mob"] << A

src << "<b><font color = green>Your SaveFile has been Updated!</font></b>"