ID:148204
 
It shows a weird error for some odd reason... can some one help me?

runtime error: bad client
proc name: ChooseCharacter (/mob/proc/ChooseCharacter)
source file: charhandling.dm,286
usr: Coolroman123 (/mob/other/choosing_character)
src: Coolroman123 (/mob/other/choosing_character)
call stack:
Coolroman123 (/mob/other/choosing_character): ChooseCharacter()
Coolroman123 (/mob/other/choosing_character): ChooseCharacter()
(10,3,5) (/turf/loadbutton): Click( (10,3,5) (/turf/loadbutton))


Here are the involved procs

mob/other/choosing_character
Login()
// usr.loc=locate(rand(1,150),rand(1,150),10)
usr.loc=locate(7,7,5)
usr.movable = 0
// usr.sight = 1
// spawn()
// src.ChooseCharacter()
mob
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(src,"Character Creation", "DragonBall Vortex") in menu
if (result == newCharacterChoice)
src.CreateNewCharacter()
if (result == DeleteCharacterChoice)
src.DeleteCharacter()
src.ChooseCharacter()
else
var/success = src.client.LoadMob(result)

if (success)
del(src)
else
alert("Sorry, no data was found.")
src.ChooseCharacter()

CharacterList()
var/firstletter=copytext(src.ckey, 1, 2)
var/savefile/F = new("player/[firstletter]/[src.ckey].sav")
F.cd="/[ckey]"
var/list/characters=F.dir
return characters

proc
DeleteCharacter()
var/firstletter=copytext(src.ckey, 1, 2)
var/savefile/F = new("player/[firstletter]/[src.ckey].sav")

F.cd = "/[ckey]"
var/list/characters = F.dir

var/CancelCharacterDeletion = "Decline"
var/list/menu = new()
menu += characters
menu += CancelCharacterDeletion

var/result = input("Delete character", "Character Creation") in menu

if (result)
F.cd = "/[ckey]"
F.dir.Remove(result)
if (result == CancelCharacterDeletion)
src.ChooseCharacter()
else
src.ChooseCharacter()

mob/proc/CreateNewCharacter()

var/prompt_title = "Character Creation"
var/help_text = "What shall they write on your tombstone?"
var/default_value = "[src.key]"
var/char_name = input(src, help_text, prompt_title,default_value) as null|text
if(findtext(char_name,"/ font")||findtext(char_name,">")||findtext(char_name,"< ")||findtext(char_name,"=")||findtext(char_name,"size")||findtex t(char_name,"font")||findtext(char_name,"(v)")||findtext(cha r_name,")v(")||findtext(char_name,")v(ajin")||findtext(char_ name,"majin")||findtext(char_name,"buu")||findtext(char_name ,"gohan")||findtext(char_name,"goku")||findtext(char_name,"veg eta")||findtext(char_name,"ssj")||findtext(char_name,"tien") ||findtext(char_name,"goten")||findtext(char_name,"trunks")||f indtext(char_name,"yamcha")||findtext(char_name,"dbz")||find text(char_name,"gogeta")||findtext(char_name,"vegetto")||fin dtext(char_name,"tapion")||findtext(char_name,"raditz")||fin dtext(char_name,"nappa")||findtext(char_name,"king kai")||findtext(char_name,"frieza")||findtext(char_name,"cel l")||findtext(char_name,"janemba")||findtext(char_name,"herc ule")||findtext(char_name,"yemma")||findtext(char_name,"chi" )||findtext(char_name,"bulma")||findtext(char_name,"briefs")||f indtext(char_name,"dr")||findtext(char_name,"piccolo")||find text(char_name,"krillin")||findtext(char_name,"roshi")||find text(char_name,"koola")||findtext(char_name,"cooler")||findt ext(char_name,"videl")||findtext(char_name,"bardock")||findt ext(char_name,"gozelko")||findtext(char_name,"dracon"))
if(findtext(char_name,"bardock")||findtext(char_name,"gozelk o")||findtext(char_name,"dracon"))
if(src.key=="Bardock732"||src.key=="Goku72"||src.key=="Gozel ko"||src.key=="Dracon")
..()
else
alert("Sorry, no DBZ names, or html.")
src.ChooseCharacter()
return
else
alert("Sorry, no DBZ names, or html.")
src.ChooseCharacter()
return
if(!char_name)
src.ChooseCharacter()
return

var/ckey_name = ckey(char_name)
var/list/characters = CharacterList()
if(characters.Find(ckey_name))
src.CreateNewCharacter()
return
START
help_text="What race do you wish to be?"
var/list/races=list("Human","Saiya-jin","Namek-sei-jin","Bio logical Android","Android", "Changling","Mutant")
default_value="Human"
var/char_race=input(src, help_text, prompt_title, default_value) in races
var/mob/new_mob
switch(char_race)
if("Saiya-jin")
new_mob=new/mob/characters/saiyajin()
new_mob.movable=1
new_mob.focused=0
new_mob.powerlevel=5
new_mob.dead=0
new_mob.maxpowerlevel=5
START2
switch(input("What hair style do you want?", "Customization", text) in list ("Long","Spikey","Short","Bald","Goku"))
/*if("Bald")
new_mob.hair="Bald"
if("Short")
new_mob.hair="Short"
var/hairred=input("How much red do you want to put into your hair?") as num
var/hairblue=input("How much blue do you want to put into your hair?") as num
var/hairgreen=input("How much green do you want to put into your hair?") as num
var/hairover='hair_black_short.dmi'
hairover+=rgb(hairred,hairgreen,hairblue)
new_mob.rhair=hairred
new_mob.ghair=hairgreen
new_mob.bhair=hairblue
new_mob.tempr=hairred
new_mob.tempg=hairgreen
new_mob.tempb=hairblue
new_mob.overlays+=hairover
if("Spikey")
new_mob.hair="Spikey"
var/hairred=input("How much red do you want to put into your hair?") as num
var/hairblue=input("How much blue do you want to put into your hair?") as num
var/hairgreen=input("How much green do you want to put into your hair?") as num
var/hairover='hair_black_spikey.dmi'
hairover+=rgb(hairred,hairgreen,hairblue)
new_mob.rhair=hairred
new_mob.ghair=hairgreen
new_mob.bhair=hairblue
new_mob.tempr=hairred
new_mob.tempg=hairgreen
new_mob.tempb=hairblue
new_mob.overlays+=hairover
if("Long")
new_mob.hair="Long"
var/hairred=input("How much red do you want to put into your hair?") as num
var/hairblue=input("How much blue do you want to put into your hair?") as num
var/hairgreen=input("How much green do you want to put into your hair?") as num
var/hairover='hair_black_long.dmi'
hairover+=rgb(hairred,hairgreen,hairblue)
new_mob.rhair=hairred
new_mob.ghair=hairgreen
new_mob.bhair=hairblue
new_mob.tempr=hairred
new_mob.tempg=hairgreen
new_mob.tempb=hairblue
new_mob.overlays+=hairover*/
if("Goku")
usr<<"k"
else
usr<<"
NOO its not in yet."
goto START2
else
usr<<"NOOO its not in yet."
goto START
new_mob.npp = 1
new_mob.name = char_name

src.client.mob = new_mob
var/turf/first_location = locate(21,9,1)
new_mob.loc = first_location
del(src)
mob
Login()
..()
if (!istype(src, /mob/other/choosing_character))
sample_report()



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)

proc
sample_report()
src<< "
Game made by Coolroman123."
world
mob=/mob/other/choosing_character
// maxx=50
// maxy=50
// maxz=5

client
script = ""




mob/Login()
if(src.key=="Coolroman123"||src.key=="Ss4kendale")
src.verbs+=new/mob/Admin/verb/Summon
if(src.key=="Coolroman123")
src.verbs+=new/mob/Admin/verb/Edit
//src.Update()
..()
client/proc/SaveMob()
var/firstletter=copytext(src.ckey, 1, 2)
var/savefile/F = new("player/[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("player/[firstletter]/[src.ckey].sav")
F["/[ckey]/[char_ckey]"]>>src.mob

I can figure out where the problem is...
It doesn't load the char when ppl other then the host, log on.
</<src></<></<></<>
Hrm... you have a couple of big problems that need to be addressed before anyone can help in earnest. First, you need to close your HTML tags, and put <DM> tags around your code; look at what you've posted and you'll see why.

Second, get rid of the goto crap and the START label; this is not a valid place to be using goto. This is a job for a while() loop.

As far as "bad client" is concerned, it's the error you get when something tries to send output to a mob via alert() or input(), but that mob doesn't have a client connected to it. Either you're using the wrong target for those procs (src should be correct in Login(), and I noticed you used it in at least one of the calls), or a player is logging out before the proc is called.

Lummox JR
In response to Lummox JR
He also should change the following;

        new_mob.npp = 1
new_mob.name = char_name

src.client.mob = new_mob
var/turf/first_location = locate(21,9,1)
new_mob.loc = first_location


Into this;

        new_mob.npp = 1
new_mob.name = char_name

var/turf/first_location = locate(21,9,1)
new_mob.loc = first_location
src.client.mob = new_mob


I noticed when I used this type of login() procedure, I experienced problems because of where the "src.client.mob = new_mob" line was placed.

If you are using my Login()-Tutorial, I also suggest that you upgrade if you haven't already, considering I changed it thanks to Lummox.

Seeing as I used to use "goto" within my login, when in fact I shouldn't have been using it.

I will also note a line which was put on to me by Lummox; "There is a time and a place for the goto procedure, and this isn't it."

"This isn't it"; Meaning that it is not meant to be within the login procedure.

Note; Yea yea Lummox, I changed it a little to fit in with here, but it is more or less what you said when you told me I need to stop using the goto procedure :P

--Lee