This system uses actual skin buttons to navigate(rather than pop up windows). All the verbs correctly correspond to the buttons an do execute the verb, besides I see no way of posting those.
Code:
world
mob = /mob/Guest
mob/Guest
icon = 'guest.dmi'
var/tmp/LS1,LS2,LS3,Sel
Login()
savable = 0
loadlist()
..()
proc
loadlist()
Sel=null
winset(src,"select1","text=Free Slot") //sets the character load button to say Free Slot
winset(src,"select2","text=Free Slot")
winset(src,"select3","text=Free Slot")
var/I = 1
for(var/C in flist("Players/[src.ckey]/")) //assigns the character names to each button
winset(src,"select[I]","text=[C]")
if(I == 1) LS1 = C
if(I == 2) LS2 = C
if(I == 3) LS3 = C
I++
verb
newbutton() //called when the player clicks a button to create a new character
if(LS3) //a max of 3 characters
return
var/tmp/N = winget(usr,"namein","text") //retrieves the name of the new character
if(!N)
return
winset(src,"window1","is-visible=false") //closes the login window
var/tmp/mob/M
M = new/mob/PC() //creates a new mob for the player
M.name = N
M.loc = locate(10,10,1)
M.icon = 'player.dmi'
M.savable = 1
world << "[N] has logged in for the first time."
src.client.mob = M //transfers the player to the new mob
del(usr)
return
loadbutton() //called when the player clicks the Load button on the login window
if(!Sel) //ignores the click if no character is selected
return
winset(src,"window1","is-visible=false")
if(Sel==1)
src.client.loadcharacter(LS1) //calls the loadcharacter proc with the currently selected character
if(Sel==2)
src.client.loadcharacter(LS2)
if(Sel==3)
src.client.loadcharacter(LS3)
select1() //called when the player selects the first character slot
if(!LS1)
return
Sel=1
select2() //second
if(!LS2)
return
Sel=2
select3() //third
if(!LS3)
return
Sel=3
client/proc
loadcharacter(A) //proc that loads the character
var/savefile/S = new ("Players/[src.ckey]/[A]")
S["mob"] >> src.mob
S["x"] >> src.mob.x
S["y"] >> src.mob.y
S["z"] >> src.mob.z
world << "[src.mob.name] has logged in."
autosave() //Saves the character
if(!src.mob.savable)
return
var/savefile/S = new ("Players/[src.ckey]/[src.mob.name]")
S["mob"] << src.mob
S["x"] << src.mob.x
S["y"] << src.mob.y
S["z"] << src.mob.z
src << "Character Autosaved..."
spawn(600) src.autosave()
Problem description:
Loading a character completely resets the character(no items and default health), as well as not setting the location(black screen).
The original /mob/Guest doesn't disappear ether. It's as if the file I'm loading did not save correctly or I'm not even calling the correct file. =/
And in the problem of Saving Try That