ID:143278
 
If I choose new game everything works just fine if I load game, it loads my last game but then asks me the login options again creating an infinite loop. Kinda baffled why one option is doing that and the other not.
mob
Login()


switch(input("Please Select An Option") in list("New Game","Load Game"))
if("New Game")
src.ChooseCharacter()
if("Load Game")
usr.LoadCharacter()


mob
proc
SaveChar()
var/savefile/F = new("players/[src.ckey].sav")
F["name"] << name
F["X"] << src.x
F["Y"] << src.y
F["Z"] << src.z
F["Mob"] << usr.client.mob
verb
Save()
set category = "Action"
usr.SaveChar()
usr << "Your character has been saved."
mob
proc
LoadCharacter()
var/savefile/F = new("players/[src.ckey].sav")
var/X
var/Y
var/Z
var/mob/newmob = new()
F["name"] >> name
F["X"] >> X
F["Y"] >> Y
F["Z"] >> Z
F["Mob"] >> newmob
newmob.loc = locate(X,Y,Z)
newmob.client = src.client
rain()
Recovery()


Problem description:

There isnt a choosecharacter proc listed here, that could be the reason why, if that one is in fact looping, or else you have left something out.
Why are you making a new mob in your loading proc? Since you're making the client change to the new mob's client, you're making it keep calling Login(). You don't need a new mob.

had to mess with starting mob since login was being called with the creation of the saved mob was all.

world/mob=/mob/loggingin




mob/loggingin/
Login()


switch(input("Please Select An Option") in list("New Game","Load Game"))
if("New Game")
src.ChooseCharacter()
if("Load Game")
usr.LoadCharacter()
In response to Kichimichi
(There isnt a choosecharacter proc listed here, that could be the reason why, if that one is in fact looping, or else you have left something out.)

It was a long proc I left it out to save space on the forum, I knew it worked independantly anyway so.

mike
In response to Kichimichi
(Why are you making a new mob in your loading proc? Since you're making the client change to the new mob's client, you're making it keep calling Login(). You don't need a new mob.)

I'm basically using the code supplied in a load demo, and while I'm sure there may be a better way to do what I wanted this worked mostly and now works just fine,(routed around the load screen as I didn't want to deal with .bmp's and whatnot atm and a couple other features had to be tweaked for my project)

mike
In response to Kichimichi
There IS an Edit button, you know. Right next to the Reply button. And there's a Quote button, right under anyone else's post.
In response to Kaiochao2536
Kaiochao2536 wrote:
There IS an Edit button, you know. Right next to the Reply button. And there's a Quote button, right under anyone else's post.

OOOOOOOkay, meester so sowway, me dum yu superior.