ID:142259
 
Code:
runtime error: bad client
proc name: ChooseCharacter (/mob/other/choosing_character/proc/ChooseCharacter)
usr: Rikishi (/mob/other/choosing_character)
src: Rikishi (/mob/other/choosing_character)
call stack:
Rikishi (/mob/other/choosing_character): ChooseCharacter()
Rikishi (/mob/other/choosing_character): ChooseCharacter()
Rikishi (/mob/other/choosing_character): Login()


Problem description:

Just trying to figure out what is causing this error.
mob/other/choosing_character
Login()
src.move = 0
src.sight = 1
spawn()
src.ChooseCharacter()
proc
ChooseCharacter()
var/list/characters = src.CharacterList()

var/newCharacterChoice = "New Fighter"
var/DeleteCharacterChoice = "Delete Fighter"
var/list/menu = new()
menu += characters
menu += newCharacterChoice
menu += DeleteCharacterChoice

var/result = input("Fighter Creation", "Dragonball Z: Last Saga") 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("If you see this tell a Gm.")
src.ChooseCharacter()


Problem 2
I believe this is where the error is calling.

It appears to be a problem with your ChooseCharacter() proc. If you could perhaps show it to us?
In response to SpikeNeedle
mob/other/choosing_character/proc/CreateNewCharacter()
var/prompt_title = "Fighter Creation"
var/help_text = "What is your figthers name?"
var/default_value = ""
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, dont be a faka...")
src.CreateNewCharacter()
return

help_text = "Select a race."
var/list/races = list("Saiyan", "Human")
default_value = "Human"
var/char_race = input(src, help_text, prompt_title, default_value) in races
var/mob/new_mob
switch(char_race)
if("Saiyan")
new_mob = new /mob/characters/saiyan
new_mob.icon = 'male.dmi'
new_mob.move = 1
new_mob.powerlevel = rand(100,250)
new_mob.maxpowerlevel = new_mob.powerlevel
new_mob.race = "Saiyan"
new_mob.zenni = rand(1,100)
new_mob.kills = 0
new_mob.death = 0
new_mob.pkills = 0
new_mob.pdeath = 0
new_mob.loc=locate(1,1,1)
new_mob.form = "Normal"
new_mob.wname = "<font color = #151B8D>Saiyan"

switch(input("Which hair would you like to have?","Hair Choice", text) in list ("Future Gohan", "Goku", "Teen Gohan", "Trunks", "Vegeta", "Bald"))
if("Future Gohan")
new_mob.hair = "Futre Gohan"
var/hairover = 'hair_future_gohan.dmi'
new_mob.overlays += hairover

if("Goku")
new_mob.hair = "Goku"
var/hairover = 'hair_goku.dmi'
new_mob.overlays += hairover

if("Teen Gohan")
new_mob.hair = "Teen Gohan"
var/hairover = 'hair_teengohan.dmi'
new_mob.overlays += hairover

if("Trunks")
new_mob.hair = "Trunks"
var/hairover = 'hair_trunks_long.dmi'
new_mob.overlays += hairover

if("Vegeta")
new_mob.hair = "Vegeta"
var/hairover = 'hair_vegeta.dmi'
new_mob.overlays += hairover

if ("Bald")
new_mob.hair = "Bald"

var/aurared = input("How much red into your aura?") as num
var/auragreen = input("How much green into your aura?") as num
var/aurablue = input("How much blue into your aura?") as num
new_mob.ared = aurared
new_mob.agreen = auragreen
new_mob.ablue = aurablue

if("Human")
new_mob = new /mob/characters/human
new_mob.icon = 'male.dmi'
new_mob.move = 1
new_mob.powerlevel = rand(100,150)
new_mob.maxpowerlevel = new_mob.powerlevel
new_mob.race = "Human"
new_mob.zenni = rand(1,100)
new_mob.loc=locate(1,1,1)
new_mob.kills = 0
new_mob.death = 0
new_mob.pkills = 0
new_mob.pdeath = 0
new_mob.form = "Normal"
new_mob.wname = "<font color = CC9900>Human"

switch(input("Which hair would you like to have?","Hair Choice", text) in list ("Future Gohan", "Goku", "Teen Gohan", "Trunks", "Vegeta", "Bald"))
if("Future Gohan")
new_mob.hair = "Futre Gohan"
var/hairover = 'hair_future_gohan.dmi'
new_mob.overlays += hairover

if("Goku")
new_mob.hair = "Goku"
var/hairover = 'hair_goku.dmi'
new_mob.overlays += hairover

if("Teen Gohan")
new_mob.hair = "Teen Gohan"
var/hairover = 'hair_teengohan.dmi'
new_mob.overlays += hairover

if("Trunks")
new_mob.hair = "Trunks"
var/hairover = 'hair_trunks_long.dmi'
new_mob.overlays += hairover

if("Vegeta")
new_mob.hair = "Vegeta"
var/hairover = 'hair_vegeta.dmi'
new_mob.overlays += hairover

if ("Bald")
new_mob.hair = "Bald"

var/aurared = input("How much red into your aura?") as num
var/auragreen = input("How much green into your aura?") as num
var/aurablue = input("How much blue into your aura?") as num
new_mob.ared = aurared
new_mob.agreen = auragreen
new_mob.ablue = aurablue

new_mob.name = char_name

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


hmmm.
If you turn on debug mode, it should also tell you more information, including the line number the error occurred at (not necessarily, but usually). So do that and post the new output. You should also post the relevant code if you want us to help solving the problem.

Basically, the error is self explanatory. The proc in question ( /mob/other/choosing_character/proc/ChooseCharacter ) is trying to use a client in some statement, but that client is 'bad' - which probably means is invalid - does not exist. My guess would be that the variable you're using to access the client is probably null.
In response to Rikishi
Oops, I was a little late. Still, read my previous post and reply with the additional info with the error given by turning on debug mode and recompiling (go to Dream Maker's Build->Preferences menu). Also edit your previous post to specify the line the error says is problematic (use CTRL-G in Dream Maker while on the relevant code file).
In response to Kaioken
Kaioken wrote:
If you turn on debug mode, it should also tell you more information, including the line number the error occurred at (not necessarily, but usually). So do that and post the new output. You should also post the relevant code if you want us to help solving the problem.

Basically, the error is self explanatory. The proc in question ( /mob/other/choosing_character/proc/ChooseCharacter ) is trying to use a client in some statement, but that client is 'bad' - which probably means is invalid - does not exist. My guess would be that the variable you're using to access the client is probably null.





turned it on, but doesnt show line number
In response to Kaioken
doesn't show the line.
In response to Rikishi
            var/result = input(src,"Fighter Creation", "Dragonball Z: Last Saga") in menu



thats the line i guess
In response to Rikishi
Don't use usr in procs.

input() and alert() uses usr by default.

Rikishi wrote:
>           var/result = input(src,"Fighter Creation", "Dragonball Z: Last Saga") in menu
>


Yes, use src. Do the same with alert().