ID:139575
 
mob/player
Login()
..()
//Make their name their key(temporary)
src.name=src.key
//Set their icon(Testing purposes)
icon='./Icons/Base.dmi'
//Initiate all stats(Required)
Initiate()

mob
player
Initiate()
level=new(src,,,)
health=new /stats(src, "Health", 100, 0, 50, 25)
stamina=new /stats(src,"Stamina",100,0,50,20)
reiryoku=new /stats(src,"Reiryoku",100,0,50,1)
hakuda=new /stats(src,"Hakuda",50,0,50,1)
zanjutsu=new /stats(src,"Zanjutsu",50,0,50,1)

GetSave(mob/player/M)
var/file=M.ckey
var/first_letter=copytext(file,1,2)
return new /savefile("Saves/[first_letter]/[file]")

//Saves
mob/Save()
var/savefile/F=GetSave(src)
F<<src
src<<"Saved."

//Loads
mob/Load()
var/savefile/F=GetSave(src)
src<<F
src<<"Loaded."

mob/verb/Randomize_Reiryoku()
var/new_val=round(rand(100,500),1)
var/new_m_val=round(rand(500,1000),1)
usr.reiryoku.value=new_val
usr.reiryoku.max_value=new_m_val

//Read and Write for mobs
mob/Write(savefile/F)
..(F)
F.dir.Remove("icon","overlays","underlays","contents")
F["saved_x"]<<x
F["saved_y"]<<y
F["saved_z"]<<z


mob/Read(savefile/F)
..(F)
var
_x
_y
_z
F["saved_x"]>>_x
F["saved_y"]>>_y
F["saved_z"]>>_z
loc=locate(_x,_y,_z)


Well, I was going to blame this on the whole "Loading doesn't pass to New()" thing, but this is preventing the savefile from being created. I use the Randomize_Reiryoku verb to change things up(To see if it saves/loads), but when I noticed it wasn't loading, I went and looked, and found out that the savefile hadn't even been created. Can anyone tell me what is wrong?

Your code doesn't show where you save, do you actually call Save()?

mob/player/Logout()
Save()
..()
In response to Ripiz
I have an in-game verb.

mob/verb
save()
set name="Save"
usr.Save()
It seems odd to me that the savefile wouldn't be created. I will say, however, that "src << F" is wrong. What you should do instead is:

var/mob/M
F >> M


You might also want to decouple Load() from the mob, considering that loading the savefile will create a new mob and leave the old one unoccupied.
In response to Garthor
After doing some small revisions, it is now giving me a runtime error when I use Save.

runtime error: Cannot read null.name
proc name: Save (/mob/Save)
source file: Initiated Procs.dm,22
usr: Albro1 (/mob/player)
src: Albro1 (/mob/player)
call stack:
Albro1 (/mob/player): Save()
Albro1 (/mob/player): Save()


My revisions:
GetSave(client/M)
var/file=M.ckey
var/first_letter=copytext(file,1,2)
return new /savefile("Saves/[first_letter]/[file]")

//Saves
mob/Save()
var/savefile/F=GetSave(src.client)
world<<F.name
F<<src
if(fexists(GetSave(src.client)))
src<<"Saved."

//Loads
client/Load()
var/savefile/F=GetSave(src)
var/mob/player/M=new
F>>M
var/mob/current_mob=src.mob
src.mob=M
del(current_mob)
src<<"Loaded."


It doesn't know what the savefile's name is.
In response to Albro1
I finally got it fixed. I had to get creative with it. Also thanks to Maximus_Alex2003 for his help on some of it.

Stat datum revision:
stats
var
alias=""
value=0
max_value=0
experience=0
max_experience=0
boost=0
max_Boost=0
Boost=0
tmp/mob/owner
list/variables=list()
New(mob/M, name, val, exp=0, mexp=50, boostnum)
owner=M
alias=name
value = val
max_value = val
experience=exp
max_experience = mexp
boost=boostnum
variables=list("owner"=owner,"alias"=alias,"value"=value,"max_value"=max_value,"experience"=experience,\
"max_experience"=max_experience,"boost"=boost,"max_Boost"=max_Boost,"Boost"=Boost)
..()
proc/UpdateVars()
variables=list("owner"=owner,"alias"=alias,"value"=value,"max_value"=max_value,"experience"=experience,\
"max_experience"=max_experience,"boost"=boost,"max_Boost"=max_Boost,"Boost"=Boost)

proc/DistributeVars()
owner=variables["owner"]
alias=variables["alias"]
value=variables["value"]
max_value=variables["max_value"]
experience=variables["experience"]
max_experience=variables["max_experience"]
boost=variables["boost"]
Boost=variables["Boost"]
max_Boost=variables["max_Boost"]



Level datum revision was similar.


Save revision:
mob/var/loggedIn = FALSE


client/proc/deletePlayer()
if(fexists("saves/[copytext(ckey,1,2)]/[ckey].sav"))
fdel("saves/[copytext(ckey,1,2)]/[ckey].sav")
else return FALSE

client/proc/savePlayer()
if(mob.loggedIn)
var savefile/F = new("saves/[copytext(ckey,1,2)]/[ckey].sav")
F << mob
else return FALSE

client/proc/loadPlayer()
if(fexists("saves/[copytext(ckey,1,2)]/[ckey].sav"))
var savefile/F = new("saves/[copytext(ckey,1,2)]/[ckey].sav")
F >> mob
mob.loggedIn = TRUE
else return FALSE

mob/Write(savefile/saveFile)
..()
saveFile.dir.Remove("icon", "overlays", "underlays", "contents")
saveFile["saved_x"] << x
saveFile["saved_y"] << y
saveFile["saved_z"] << z
src.UpdateStats()
saveFile["level"]<<level.variables
saveFile["health"]<<health.variables
saveFile["stamina"]<<stamina.variables
saveFile["reiryoku"]<<reiryoku.variables
saveFile["hakuda"]<<hakuda.variables
saveFile["zanjutsu"]<<zanjutsu.variables


mob/Read(savefile/saveFile)
..()
var lastX
var lastY
var lastZ
saveFile["saved_x"] >> lastX
saveFile["saved_y"] >> lastY
saveFile["saved_z"] >> lastZ
saveFile["level"] >> level.variables
saveFile["health"] >> health.variables
saveFile["stamina"] >> stamina.variables
saveFile["reiryoku"] >> reiryoku.variables
saveFile["hakuda"] >> hakuda.variables
saveFile["zanjutsu"] >> zanjutsu.variables
src.DistributeStats()
src.loc = locate(lastX, lastY, lastZ)


Update and Distribute Stats:
mob
player
UpdateStats()
src.level.UpdateVars()
src.health.UpdateVars()
src.stamina.UpdateVars()
src.reiryoku.UpdateVars()
src.hakuda.UpdateVars()
src.zanjutsu.UpdateVars()
DistributeStats()
src.level.DistributeVars()
src.health.DistributeVars()
src.stamina.DistributeVars()
src.reiryoku.DistributeVars()
src.hakuda.DistributeVars()
src.zanjutsu.DistributeVars()
In response to Albro1
Is there a purpose to any of that, or did you just throw some random lists in there in the hope that by obfuscating your code enough you'll eventually trick it into working?
In response to Garthor
There is purpose. It was not saving the values, so I made that system to save the variables to a list, save that list, then load that list, and distribute the variables. Thanks for asking.
In response to Albro1
Then you went about things the wrong way. You did not need to do what you did, and if what you did is working then you could remove those lists entirely and it will still work.
In response to Garthor
I have already tried that. I would have never done what I did there if it had worked.