ob
proc
Save()
var/savefile/F = new("./savefiles/[src.ckey].sav")
F["usr"] << usr
Write(F)
world/mob = /mob/ChoosingCharacter
mob
proc
NewGame()
var/prompt_title = "Character Creation"
var/help_text = "What is your Character's name?"
var/default_value = "[src.ckey]"
var/char_name = input(src, help_text, prompt_title, default_value) as null|text
if (!char_name)
alert("You have not chosen a name, please go back and do so now.")
src.NewGame()
return
switch(alert("Please choose your gender.\nYour gender will determine what classes you can use later in the game.","Gender","Male","Female"))
if("Male")
name = char_name
icon = 'boy.dmi'
level = 1
hp = 50
maxhp = 50
mp = 25
maxmp = 25
strength = 15
defense = 15
magicattack = 10
magicdefense = 10
speed = 1
gold = 2000
exp = 0
maxexp = 200
modlevel = 0
focus = 0
weapon = 0
armor = 0
access = 0
style = "Young Boy"
style_level = 0
style_exp = 0
style_maxexp = 100
if("Female")
name = char_name
icon = 'girl.dmi'
level = 1
hp = 50
maxhp = 50
mp = 25
maxmp = 25
strength = 10
defense = 10
magicattack = 15
magicdefense = 15
speed = 1
gold = 2000
exp = 0
maxexp = 200
modlevel = 0
focus = 0
weapon = 0
armor = 0
access = 0
style = "Young Girl"
style_level = 0
style_exp = 0
style_maxexp = 100
usr.loc = locate(5,2,2)
usr.sight = 0
world<<"[src.name] has entered the stuggle for power."
mob
ChoosingCharacter
Login()
Load
Rules()
src.loc = locate(5,5,1)
switch(alert("Welcome to [world.name].\nWhat would you like to do?","[world.name]","Load Character","New Character","Exit"))
if("Load Character")
if(fexists("./savefiles/[src.ckey].sav"))
var/savefile/S = new("./savefiles/[src.ckey].sav")
S["usr"] >> src
world << "[src.name] has entered the struggle for power."
src.UserLocate()
else
alert("No previous character found!")
goto Load
if("New Character")
if(fexists("./savefiles/[src.ckey].sav"))
switch(alert("You already have an exsisting!\nIf you choose to create a new character, your previous character will be deleted.","Continue?","Yes","No"))
if("Yes")
src.NewGame()
else
goto Load
else
src.NewGame()
if("Exit")
Logout()
mob
proc
UserLocate()
if(hometown == "Shirre")
src.loc = locate(5,2,2)
if(hometown == "Abbey")
src.loc = locate(5,2,3)
Problem description: After taking a look at FlameSage's lib, I decided to add a bit of it into my login. For some reason though, the load works, the save works, and the new character works, but once you load your character, the initial "Load/Create/Exit" window comes up again... Any idea why its looping?
Firstly, No Put Usr In Proc, Ungh. Refer to The Usr Lecture.
Secondly, Goto is bad. You don't need to use goto here. Instead you can use while() loops, like while(!src.name)
After you fix that, repost the code if it still does not work.