ID:264742
 
Code:
client
proc
Load()
if(fexists("Savefiles/[ckey].sav"))
var/savefile/F = new("Savefiles/[ckey].sav")
F["mob"] >> mob


Problem description: For some reason everytime I press the load button it brings me to the map regardless of whether or not I have a savefile. It's supposed to do nothing if you don't have a save to load.

client
proc
Load()
if(fexists("Savefiles/[ckey].sav"))
var/savefile/F = new("Savefiles/[ckey].sav")
F["mob"] >> mob
else
return
Wheres the load button code, because the problem isn't in what you posted
In response to Falacy
I use this verb below as the command for my Load button in my start screen pane, it's the only thing that uses the Load proc.

client
proc
Load()
if(fexists("Savefiles/[ckey].sav"))
var/savefile/F = new("Savefiles/[ckey].sav")
F["mob"] >> mob

client
verb
LoadChar()
set hidden = 1
Load()
winset(usr,"mainChild","left=mapPane")
In response to Mr.Ninjutsu
bump
In response to Mr.Ninjutsu
Code:
client
proc
Load()
if(fexists("Savefiles/[ckey].sav"))
var/savefile/F = new("Savefiles/[ckey].sav")
F["mob"] >> mob

client
verb
LoadChar()
set hidden = 1
Load()
winset(usr,"mainChild","left=mapPane")


Problem description:For some reason everytime I press the load button it brings me to the map regardless of whether or not I have a savefile. It's supposed to do nothing if you don't have a save to load.

In response to Mr.Ninjutsu
Your code is back to front.. see how you have your winset there. so even regardless of what your doing it will launch.

client
verb
LoadChar()
set hidden = 1
if(fexists("Savefiles/[ckey].sav"))
Load()
winset(usr,"mainChild","left=mapPane")
else
return

client
proc
Load()
var/savefile/F = new("Savefiles/[ckey].sav")
F["mob"] >> mob


that should fix you up
In response to Midgetbuster
Thank you, sorry about making two topics on the same subject.
In response to Mr.Ninjutsu
Or you could have just tossed the winset() in with the Load() proc...

client/proc/load()
if(fexists("whatever"))
//blah
winset(src,"child_element","left=map_element")
In response to Spunky_Girl
I make my load proc return 1 if successful. Then just do
if(src.Load()) winset(stuff)
else make new char