ID:264702
 
Code:
mob
Login()
switch(alert("Login","","New Character","Load Character"))
if("New Character")
usr.CreateChar()
if("Load Character")
usr.client.Load()
Logout()
del(src)
mob
proc
CreateChar()
switch(alert("Character Selection","","Goku"))
if("Goku")
icon = 'Goku.dmi'
density=1
loc=locate(1,1,1)


Problem description:

When i press new character it all goes fine but if i press load character the window keeps coming back while i already pressed it
Could it be that you dont have an load proc?
maybe you should make 1
In response to Gojan (#1)
Gojan wrote:
Could it be that you dont have an load proc?
maybe you should make 1

client
proc
Save()
var/savefile/F = new("Savefiles/[ckey].sav")
F["mob"] << mob
Load()
if(fexists("Savefiles/[ckey].sav"))
var/savefile/F = new("Savefiles/[ckey].sav")
F["mob"] >> mob
Del()
..()
Save()
mob
Write(var/savefile/F)
F["x"] << x
F["y"] << y
F["z"] << z
..()
Read(var/savefile/F)
loc=locate(F["x"], F["y"], F["z"])
..()
Design, design, design! Your system sucks because it hasn't been designed properly.

You should start off by making a /mob/character_handling mob or something like that. This type of mob is solely used to handle creation, loading and deletion of characters.

Once you have that, use a title screen, a browser window or a skin (I recommend a browser window) to query the player on what they'd like to do; consider alerts inefficient as you need to be able to present your game while presenting the player with a choice on what to do. A browser window can contain a little bit of information about the game and some ground rules as well as give players a choice on what to do, which can be very helpful.

Next, make it so that loading a character also takes place on mob level. If you want to load a client-side savefile, use a client proc that returns the savefile object but doesn't do anything else, and you'll be fine.

As for your code problem, nobody can help you so long as you don't post the Load() proc for your client, but I highly recommend taking another way than this since you're guaranteed to run into problems in the future.
In response to Darker Legends (#2)
Loading the mob is creating a new mob and changing your mob to it. This results in Login() being called again. The solution is to handle your login stuff in a separate, temporary mob type.