client/proc/SaveMob()
var/firstletter=copytext(src.ckey, 1, 2)
var/savefile/F = new("players/[firstletter]/[src.ckey].sav")
var/char_ckey = cKey(src.mob.name)
F["/[ckey]/[char_ckey]"]<<src.mob
client/proc/LoadMob(char_ckey)
var/firstletter=copytext(src.ckey, 1, 2)
var/savefile/F = new("players/[firstletter]/[src.ckey].sav")
F["/[ckey]/[char_ckey]"]>>src.mob
client/Del()
if (istype(src.mob, /mob/))
return ..()
src.SaveMob()
return ..()
mob
Login()
usr.loc=locate(5,2,10)
usr.move = 0
usr.sight = 0
spawn()
src.ChooseCharacter()
world<<"<font color=red><b>[usr] has entered the struggle for power.</font>"
proc
ChooseCharacter()
var/list/characters = src.CharacterList()
var/newCharacterChoice = "New Character"
var/DeleteCharacterChoice = "Delete Character"
var/list/menu = new()
menu += characters
menu += newCharacterChoice
menu += DeleteCharacterChoice
var/result = input("Character Creation", "Dragonball Z: Eternal Power") in menu // Line 40
if (result == newCharacterChoice)
CreateNewCharacter()
if (result == DeleteCharacterChoice)
src.ChooseCharacter()
else
var/success = src.client.LoadMob(result)
if (success)
del(src)
else
alert("Nope.")
src.ChooseCharacter()
CharacterList()
var/firstletter=copytext(src.ckey, 1, 2)
var/savefile/F = new("players/[firstletter]/[src.ckey].sav")
F.cd = "/[ckey]"
var/list/characters = F.dir
return characters
mob/proc/CreateNewCharacter()
var/prompt_title = "Character Creation"
var/help_text = "What is your name? "
var/default_value = "Your name!"
var/char_name = input(src, help_text, prompt_title, default_value) as null|text
if (!char_name)
src.ChooseCharacter()
return
var/ckey_name = ckey(char_name)
var/list/characters = CharacterList()
if (characters.Find(ckey_name))
alert("Nope. Choose another name.")
src.CreateNewCharacter()
return
help_text = "What is your gender?"
var/list/gender = list("Male", "Female")
default_value = "Male"
var/char_gender = input(src, help_text, prompt_title, default_value) in gender
var/mob/new_mob
switch(char_gender)
if("Male")
new_mob = new /mob/characters/male()
new_mob.hp = 50
new_mob.mp = 25
new_mob.strength = 15
new_mob.defense = 15
new_mob.magicattack = 10
new_mob.magicdefense = 10
new_mob.speed = 1
new_mob.gold = 2000
new_mob.exp = 200
new_mob.maxexp = 0
new_mob.modlevel = 0
new_mob.title = ""
new_mob.focus = 0
new_mob.weapon = 0
new_mob.armor = 0
new_mob.access = 0
new_mob.style = 0
if("Female")
new_mob = new /mob/characters/female()
new_mob.hp = 50
new_mob.mp = 25
new_mob.strength = 10
new_mob.defense = 10
new_mob.magicattack = 15
new_mob.magicdefense = 15
new_mob.speed = 1
new_mob.gold = 2000
new_mob.exp = 200
new_mob.maxexp = 0
new_mob.modlevel = 0
new_mob.title = ""
new_mob.focus = 0
new_mob.weapon = 0
new_mob.armor = 0
new_mob.access = 0
new_mob.style = 0
switch(input("Do you want a title?","Character Creation",text) in list ("Yes","No"))
if("Yes")
var/amount = input("What do you want your title to be, no HTML.") as text|null
new_mob.title = amount
if("No")
..()
mob
Login()
..()
if (!istype(src, /mob/))
Rules()
Write(savefile/F)
..()
F["last_x"] << x
F["last_y"] << y
F["last_z"] << z
Read(savefile/F)
..()
var/last_x
var/last_y
var/last_z
F["last_x"] >> last_x
F["last_y"] >> last_y
F["last_z"] >> last_z
loc = locate(last_x,last_y,last_z)
mob/Logout()
world<<"<font color=red><b>[usr] has left the area.</font>"
Here is my error:
runtime error: bad client
proc name: ChooseCharacter (/mob/proc/ChooseCharacter)
usr: Plagu3r (/mob)
src: Plagu3r (/mob)
call stack:
Plagu3r (/mob): ChooseCharacter()
Plagu3r (/mob): ChooseCharacter()
Plagu3r (/mob): Login()
Just letting you know, I am a very inexperienced coder and have no clue what to do. If anyone could kindly explain to me what I am doing wrong, I would be very grateful. Thanks.
A bad client is usually caused when you do input or alert improperly. It goes to usr by default, so if there is no usr in a function where you use it that is a problem.