ID:141560
 
Code: Load
mob/verb/Load()
set hidden = 1
if(usr.login)return 0
if(usr.creating)return 0
usr.creating=1
if(fexists("players/[usr.ckey]/[usr.ckey].sav"))
usr.creating=0
if(usr.login)return
var/savefile/F = new("players/[usr.ckey]/[usr.ckey].sav")
if(usr.creating)return
Read(F)
sleep(1)
usr.move=0
usr.Stuff()
else
usr<<"No savefile found on this server!"
usr.creating=0

Code: Save
mob/verb/Save()
set hidden=1
if(src.login)
src<<"Character Saved!"
var/savefile/F = new("players/[usr.ckey]/[usr.ckey].sav")
src.savefile1=1
Write(F)



Problem description:

Ok well...there isnt a problem with the programming its self as in if it will or wont work, however, it does tend to burp from time to time with causing 2 things to happen...1 can be that the players save is there, however it loads but all the Vars are changed to null (Not sure if this is 100 percent true, but it appears this way), and 2, that the Players save isnt even found :/ Also, know that this is the same Save/Load system that the game Naruto Izou used to use (I understood that it does have a bit of a buggy background, so if someone has fixed this before, it would be helpfull ><)

    if(usr.login)return 0 //If they're logging in they can't load? o.O


Here's a little thing to make it 1 less line of coding :o

var/savefile/F = new("players/[ckey].sav") //Don't need to repeat the use of ckey ;p
if(F) //if it found the savefile F
//... do whatever

No longer need to see if(fexists(/*...*/)) after you move the var/savefile/F to a different spot ^-^
In response to Mizukouken Ketsu
Ok, well I'll try that (also, the reason the ckey was repeated, was because I first ran it when it was like that, and if I changed it, I would have to Erase all of the saves ^^;)
In response to Matt3151
It'd probably be smarter to organize the folders into their IP addresses. As to help prevent those darned people who get banned but come back on another key ;p
In response to Mizukouken Ketsu
XD Blah, that isnt a problem, trust me, it just wants to burp at random times, on random people....gah, Im asking a few people that have been at it for alot more years then me, but they tend to be away so x.x;
In response to Matt3151
http://www.byond.com/developer/forum/?id=683432
http://www.byond.com/developer/forum/?id=676608

There's a couple Creations threads of savefile systems that you can take a look at and compare it with your own. They might be totally different from yours though; not sure.
In response to Mizukouken Ketsu
Ok =D Thanks Mizu, Im having Bighead look at it and help me so I think he will be able to help, Thanks tho!
In response to Mizukouken Ketsu
You definitely need to check if the file exists before opening it as a savefile, because if it doesn't then the file will simply be created, of course. Doing if(savefile) won't really do anything, since new() returns a /savefile object reference to that var, and an object ref is a true value.
In response to Kaioken
I was just thinking about that little issue actually. I wasn't sure if it created the savefile regardless...