ID:148614
 
I need some help with this save file part. It's supposed to give me a list of characters in my directory of a savefile but it just keeps starting out in the CreateNewCharacter() proc. (I'm really big on comments, so just ignore them)
/* <Begin client definition> */
client/proc //defines procs for all clients
SaveMob() //saving mobs
var/savefile/F = new("players.sav") //make a new or move to this savefile
var/char_ckey = ckey(mob.name) //the var, char_ckey is the ckey name of the mob
F["[ckey]/[char_ckey]"] << mob //puts the mob data to this subdirectory
LoadMob(char_ckey) //loading mobs
var/savefile/F = new("players.sav") //make a new or move to this savefile
F["[ckey]/[char_ckey]"] >> mob //turns this subdirectory data into a mob
CreateNewCharacter() //make a new mob
var/savefile/F = new("players.sav") //make a new or move to this savefile
var/char_ckey = input("What is your name?","Create a new character",usr.client.key) as text
F["[ckey]/[char_ckey]"] << char_ckey
usr.loc = locate(1,1,1)
/* <End client definition> */

/* <Begin mob definition> */
mob //accesses all mob objects
verb //define verbs for all mobs
say(msg as text) //define a 'say' verb which takes in an arg called [msg] in text format
world << "<B>[usr]:</B>([msg])" //puts [msg] to the world
var // defines vars for all mobs
tmp //makes these vars temorary
turn
tamer //a type of mob
icon = 'tamer.dmi' //set its icon to the file "tamer.dmi"
var //defines vars for this mob type
health //HP var
Login() //the log-in proc
var/savefile/F = new() //make a new or move to this savefile
F.cd = "/[ckey]" //move the directory of savefile F here
var/list/characters = F.dir //the list of characters is everything in the current directory
var/NewChar = "<Create new character>" //the choice to make a new character
var/list/menu = new() //the menu is a list
menu += characters //add the characters list to the menu
menu += NewChar //add the new character choice to the menu
var/result = input("Choose your character","Characters") in menu //the result var is the choice of the menu
if(result == NewChar) //if the result is the new character choice
usr.client.CreateNewCharacter() //call the client's CreateNewCharater proc
..() //call the superclass
else //if the result is the new character choice
usr.client.LoadMob() //call the client's LoadMob proc
..()
/* <End mob definition> */
PS. if you find a comment that is wrong pleas tell me.
Is this too much to read?
You supply a file name when you initially save your character, but later on in the Login you only have
var/savefile/F = new()
Change that to
var/savefile/F = new("players.sav")
And you should be set to go.
In response to tenkuu
okay, i did that. now it won't show up on the screen if i load it. if i make a new one it comes but not if i load.

P.S. I added a bit to the procs:
client/proc
SaveMob()
var/savefile/F = new("players.sav")
var/char_ckey = ckey(mob.name)
usr.locx = usr.loc.x
usr.locy = usr.loc.y
usr.locz = usr.loc.z
F["[ckey]/[char_ckey]"] << mob
LoadMob(char_ckey)
var/savefile/F = new("players.sav")
F["[ckey]/[char_ckey]"] >> mob
usr.loc = locate(usr.locx,usr.locy,usr.locz)

P.S. P.S. whenever i try to run it, it says "one of the files is newer than executable. compile now?" every time, even though i compile it manually using ctrl+k.
In response to Delita12345
I'm not sure what you mean by "it" in this case, but I'll just assume you're referring to your player. I also don't see where you're calling the procs for save and load either. Using usr in a proc is not a good idea. src.mob or just mob will always be the person you save and load for. Replace the usr's with mob. Another note related to this: Login() for the loaded player type will be called whenever you load your player, so you can place the relocation code in that Login().