ID:1301584
 
(See the best response by Stephen001.)
Code:
world
mob=/mob/player
New()
..()
spawn()Rebooter()

proc
Rebooter()
sleep(54000)
world << "<b><font color = purple>World Rebooting in 30 minutes.!"
sleep(6000)
world << "<b><font color = purple>World Rebooting in 20 minutes."
sleep(6000)
world << "<b><font color = purple>World Rebooting in 10 minutes. Wrap it up!"
sleep(6000)
if(eventon)
world << "<b><font color = purple><font size=3>World Rebooting in 5 more minutes due to event. Stay put!"
sleep(3000)
if(eventon)
world << "<b><font color = purple><font size=3>World Rebooting in 5 more minutes due to event. LAST CALL!"
sleep(3000)
world << "<b><font color = purple><font size=3>World Rebooting in 30 seconds. Stay put!"
sleep(300)
for(var/mob/m in world)
if(m.client)
m.saveproc()
NameSave()
AllySave()
OrgSave()
sleep(30)
world.Reboot()

mob
proc
saveproc()
if(src.cansave)
if(src.contents.len>=1)
var/keys=src.key
var/savefile/save
save = new("playerswwa/[keys]/[src.name]")
save["mob"] << src
save["x"] << src.x
save["y"] << src.y
save["z"] << src.z

mob
proc
count_chars()
var/totalSaves=0
var/keys=src.key
var/list/saveFiles=flist("playerswwa/[keys]/")
for(var/v in saveFiles)
totalSaves++
return totalSaves
get_char_list()
var/keys=src.key
var/list/saveFiles=flist("playerswwa/[keys]/")
var/list/save_display=list()
for(var/v in saveFiles)
save_display+=v//ascii_string2text("[v]")
return save_display
load()
if(!src)
return
var/keys=src.key
var/list/saveFiles=src.get_char_list()
if(!src.count_chars())
return
var/choice=input("Welcome to (game name)! Who do you want to load?\n\n\
\n\nSavefiles Used:
[src.count_chars()]/3","Login")as null|anything in saveFiles

if(fexists("playerswwa/[keys]/[choice]"))
var/savefile/load
load = new ("playerswwa/[keys]/[choice]")
load["mob"] >> usr
load["x"] >> usr.x
load["y"] >> usr.y
load["z"] >> usr.z
//the rest of the load proc


Problem description:

Some players can't load their savefile from time to time as if it's corrupt. This problem occurs randomly so it's hard to duplicate so it's hard to find a solution. This is all the important save codes, is there a reason to why people randomly can't load their character?
By can't load, what do you mean? The number of count_chars() is less than they expect, or they see the character, try to load, and there's some kind of runtime error?
When the list of saves come up and they click on their character nothing happens.
Are there any runtime errors in the logs related to that?
BYOND Error:(Sfile.cpp,1138) failed to open file:
BYOND Error:(Sfile.cpp,1138) C:\Users\Chrishaun\Dropbox\BleachWWA\playerswwa\Oreo729\
proc name: load (/mob/proc/load)
source file: Login.dm,54
usr: Oreo729 (/mob/player)
src: Oreo729 (/mob/player)
call stack:
Oreo729 (/mob/player): load()
the load (8,2,1) (/turf/load): Click(the load (8,2,1) (/turf/load), "mapwindow.map", "icon-x=29;icon-y=10;left=1;scr...")

the error is this line:

load = new ("playerswwa/[keys]/[choice]")
The suggestion almost is that they are pressing cancel, as you allow null as a choice? Should you not be checking if choice is null and skipping the code?
If they press Cancel it returns
"If no default value is specified and null is allowed by the input type, that will be returned."

The would mean this fexists("playerswwa/[keys]/[choice]") becomes fexists("playerswwa/[keys]/") I think? So that exists, but it cannot be opened as a savefile?

You can verify this, by printing to world log befoe:

world.log << "Opening playerswwa/[keys]/[choice]"
This happened when I clicked Cancel:

Opening playerswwa/Critical172/
BYOND Error:(Sfile.cpp,1138) failed to open file:
BYOND Error:(Sfile.cpp,1138) C:\Users\Chrishaun\Dropbox\BleachWWA\playerswwa\Critical172\
proc name: load (/mob/proc/load)
source file: Login.dm,55
usr: Critical172 (/mob/player)
src: Critical172 (/mob/player)
call stack:
Critical172 (/mob/player): load()
the load (9,2,1) (/turf/load): Click(the load (9,2,1) (/turf/load), "mapwindow.map", "icon-x=13;icon-y=15;left=1;scr...")
Best response
Yup, that's your problem then. You need a null check:

        if(choice != null && fexists("playerswwa/[keys]/[choice]"))
var/savefile/load
load = new ("playerswwa/[keys]/[choice]")
load["mob"] >> usr
load["x"] >> usr.x
load["y"] >> usr.y
load["z"] >> usr.z
Hopefully this works, thanks
Didn't want to start a new topic, but somehow clones are randomly being made when people relog. It doesn't happen a lot, but when they log out then log back in there will be a copy of their character and will result in a rollback after reboots. How does that even happen and how do you fix that?
It is probably worth a new topic, I think.