ID:145436
 
Code:
mob
Login()
..()
if("Save/[src.ckey].sav")
switch(input("Do you want to carry on with your save?") in list("Yes","No"))
if("Yes")
src.Load()
..()
else
//Blah.
else
//Blah.


Problem description: It goes on forever unless you don't enter it (Don't have a savefile) or start your save over again. I figured its to do with unnoticable logging out ("RedlineM203 has logged out", then "Redline has logged in") but then it goes it circles with the loaded savefile. Can someone redirect it?

That if statement will always be true for as far as I know... Use fexists("Save/[src.key].sav") (file exists)
Because everyone MOB that logs in (including: /mob/, /mob/player/, anything /mob.) it would apply this Login() to every kind of mob.

What you need to do is..
world/mob=/mob/loggingin
mob/loggingin/Login()
//Do your "Login stuff here."

//Now, when creating a new game, we need to transfer to a new mob so we can actually get out of that login loop.
var/mob/player/M=new //creates a new mob/player.
M.name=input("What is your name son?")
src.client.mob = M //switches the clients's mob to the new player character.

Do you understand? Now the main PLAYER will login to loggingin mob and load their character (/mob/player).
In response to Flame Sage
Alright... I don't fully understand (Otherwise I feel too lazy to edit all that code I made)

So heres the Load.

mob
proc
Load()
set category = "Load n' Save"
var/savefile/F = new("Save/[src.ckey].sav")
src.Read(F)
src.Va = src.vars
F["var"] >> src.Va
usr << "[src.ckey] loaded."
return
Save()
set category = "Load n' Save"
var/savefile/F = new("Save/[src.ckey].sav")
src.Write(F)
F["var"] << src.vars
usr << "[src.ckey] saved!"


...ing proc.
No call ..() twice. Ungh.

Lummox JR
In response to Lummox JR
Well, I tried it with and without, no difference really.