ID:147841
 
ok... this might be a stupid question but I'm not very far with my skills in BYOND coding so...

I'm having problem with my character creation code, here is the part of coding I'm having problems with:

                switch(input("What hair style do you want?", "Customization", text) in list ("Short1", "Male Ponytail"))


if("Short1")
new_mob.hair = "Short1"
var/hairred = input("How much red do you want to put into your hair? (255 is the brightest and 0 is the darkest.)") as num
var/hairblue = input("How much blue do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)")as num
var/hairgreen = input("How much green do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)") as num
var/hairover = 'maleshort.dmi'
hairover += rgb(hairred,hairgreen,hairblue)
new_mob.rhair = hairred
new_mob.ghair = hairgreen
new_mob.bhair = hairblue
new_mob.overlays += hairover
src.client.mob = new_mob

if("Male Ponytail")
new_mob.hair = "Male Ponytail"
var/hairred = input("How much red do you want to put into your hair? (255 is the brightest and 0 is the darkest.)") as num
var/hairblue = input("How much blue do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)")as num
var/hairgreen = input("How much green do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)") as num
var/hairover = 'mponytail.dmi'
hairover += rgb(hairred,hairgreen,hairblue)
new_mob.rhair = hairred
new_mob.ghair = hairgreen
new_mob.bhair = hairblue
new_mob.overlays += hairover
src.client.mob = new_mob

switch(input("What shirt style do you want?", "Customization", text) in list ("Normal"))
if ("Normal")
new_mob.shirt = "Normal"
var/shirtred = input("How much red do you want to put into your shirt? (255 is the brightest and 0 is the darkest.)") as num
var/shirtblue = input("How much blue do you want to put into your shirt?) (255 is the brightest and 0 is the darkest.)")as num
var/shirtgreen = input("How much green do you want to put into your shirt?) (255 is the brightest and 0 is the darkest.)") as num
var/shirtover = icon('clothes.dmi',"maleshirt")
shirtover += rgb(shirtred,shirtgreen,shirtblue)
new_mob.rhair = shirtred
new_mob.ghair = shirtgreen
new_mob.bhair = shirtblue
new_mob.overlays += shirtover
src.client.mob = new_mob


If I take the src.client.mob = new_mob from shirt, it never asks to make the shirt colors... but if I take them from hair, character won't log in properly.
Just put it at the end, after all the Switches and Ifs!

~Ease~
In response to Ease
ok... runtime error still...
runtime error: type mismatch
proc name: CreateNewCharacter (/mob/other/creating_character/proc/CreateNewCharacter)
usr: Blueseed15 (/mob/other/creating_character)
src: Blueseed15 (/mob/other/creating_character)
call stack:
Blueseed15 (/mob/other/creating_character): CreateNewCharacter()
Blueseed15 (/mob/other/creating_character): CreateCharacter()
Blueseed15 (/mob/other/creating_character): Login()
In response to Blueseed15
I still need help... I'll put the full char creation code I have at the moment up, not like there is anything worth stealing...
mob/other/creating_character
Login()
spawn()
src.CreateCharacter()

proc
CreateCharacter()
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", "WoE") in menu

if (result == newCharacterChoice)
src.CreateNewCharacter()
if (result == DeleteCharacterChoice)
src.DeleteCharacter()
src.CreateCharacter()
else
var/success = src.client.LoadMob(result)

if (success)
del(src)
else
alert("Try again")
src.CreateCharacter()

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

DeleteCharacter()
var/firstletter=copytext(src.ckey, 1, 2)
var/savefile/F = new("players/[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 Selection") in menu

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

mob/other/creating_character/proc
CreateNewCharacter()
var/prompt_title = "Character Creation"
var/help_text = "What is your character's name? Use RP suitable names, no numbers, or symbols. Also use capital letters where needed."
var/default_value = ""
var/char_name = input(src, help_text, prompt_title, default_value) as null|text

if (!char_name)
src.CreateCharacter()
return

var/ckey_name = ckey(char_name)
var/list/characters = CharacterList()
if (characters.Find(ckey_name))
alert("There is a player that has chosen that name already. Please choose another well thought of name.")
src.CreateNewCharacter()
return


help_text = "What sex and color is your character?"
var/list/races = list("White Male","Black Male","White Female","Black Female")
var/char_race = input(src, help_text, prompt_title, default_value) in races
var/mob/new_mob
switch(char_race)
if("White Male")
new_mob = new /mob/player/student/boy
new_mob.y1 = rand(1,8)
new_mob.x = rand(11,11)
if(new_mob.y1 == 1)
new_mob.y = 7
if(new_mob.y1 == 2)
new_mob.y = 17
if(new_mob.y1 == 3)
new_mob.y = 27
if(new_mob.y1 == 4)
new_mob.y = 37
if(new_mob.y1 == 5)
new_mob.y = 47
if(new_mob.y1 == 6)
new_mob.y = 57
if(new_mob.y1 == 7)
new_mob.y = 67
if(new_mob.y1 == 8)
new_mob.y = 77
new_mob.z = 1
new_mob.name = char_name
new_mob.Alignment = "Not Selected"
new_mob.Exp = 0
new_mob.LevelExp. = 20
new_mob.MaxHP = 20
new_mob.MaxMP = 20
new_mob.GM = 0
new_mob.Level = 1
new_mob.Strength = 5
new_mob.Defense = 5
new_mob.Speed = 5
new_mob.Dex = 5
new_mob.MagicDef = 5
new_mob.Magic = 5
new_mob.Money = 0
new_mob.JapMoney = 0
new_mob.MP = 20
new_mob.HP = 20

switch(input("What hair style do you want?", "Customization", text) in list ("Short1", "Male Ponytail"))


if("Short1")
new_mob.hair = "Short1"
var/hairred = input("How much red do you want to put into your hair? (255 is the brightest and 0 is the darkest.)") as num
var/hairblue = input("How much blue do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)")as num
var/hairgreen = input("How much green do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)") as num
var/hairover = 'maleshort.dmi'
hairover += rgb(hairred,hairgreen,hairblue)
new_mob.rhair = hairred
new_mob.ghair = hairgreen
new_mob.bhair = hairblue
new_mob.overlays += hairover
src.client.mob = new_mob

if("Male Ponytail")
new_mob.hair = "Male Ponytail"
var/hairred = input("How much red do you want to put into your hair? (255 is the brightest and 0 is the darkest.)") as num
var/hairblue = input("How much blue do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)")as num
var/hairgreen = input("How much green do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)") as num
var/hairover = 'mponytail.dmi'
hairover += rgb(hairred,hairgreen,hairblue)
new_mob.rhair = hairred
new_mob.ghair = hairgreen
new_mob.bhair = hairblue
new_mob.overlays += hairover
src.client.mob = new_mob

switch(input("What shirt style do you want?", "Customization", text) in list ("Normal"))
if ("Normal")
new_mob.shirt = "Normal"
var/shirtred = input("How much red do you want to put into your shirt? (255 is the brightest and 0 is the darkest.)") as num
var/shirtblue = input("How much blue do you want to put into your shirt?) (255 is the brightest and 0 is the darkest.)")as num
var/shirtgreen = input("How much green do you want to put into your shirt?) (255 is the brightest and 0 is the darkest.)") as num
var/shirtover = icon('clothes.dmi',"maleshirt")
shirtover += rgb(shirtred,shirtgreen,shirtblue)
new_mob.rhair = shirtred
new_mob.ghair = shirtgreen
new_mob.bhair = shirtblue
src.client.mob = new_mob


if("Black Male")
new_mob = new /mob/player/student/bboy
new_mob.y1 = rand(1,8)
new_mob.x = rand(11,11)
if(new_mob.y1 == 1)
new_mob.y = 7
if(new_mob.y1 == 2)
new_mob.y = 17
if(new_mob.y1 == 3)
new_mob.y = 27
if(new_mob.y1 == 4)
new_mob.y = 37
if(new_mob.y1 == 5)
new_mob.y = 47
if(new_mob.y1 == 6)
new_mob.y = 57
if(new_mob.y1 == 7)
new_mob.y = 67
if(new_mob.y1 == 8)
new_mob.y = 77
new_mob.z = 1
new_mob.name = char_name
new_mob.Alignment = "Not Selected"
new_mob.Exp = 0
new_mob.LevelExp. = 20
new_mob.MaxHP = 20
new_mob.MaxMP = 20
new_mob.GM = 0
new_mob.Level = 1
new_mob.Strength = 5
new_mob.Defense = 5
new_mob.Speed = 5
new_mob.Dex = 5
new_mob.MagicDef = 5
new_mob.Magic = 5
new_mob.Money = 0
new_mob.JapMoney = 0
new_mob.MP = 20
new_mob.HP = 20

switch(input("What hair style do you want?", "Customization", text) in list ("Short1", "Male Ponytail"))


if("Short1")
new_mob.hair = "Short1"
var/hairred = input("How much red do you want to put into your hair? (255 is the brightest and 0 is the darkest.)") as num
var/hairblue = input("How much blue do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)")as num
var/hairgreen = input("How much green do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)") as num
var/hairover = 'maleshort.dmi'
hairover += rgb(hairred,hairgreen,hairblue)
new_mob.rhair = hairred
new_mob.ghair = hairgreen
new_mob.bhair = hairblue
new_mob.overlays += hairover
src.client.mob = new_mob

if("Male Ponytail")
new_mob.hair = "Male Ponytail"
var/hairred = input("How much red do you want to put into your hair? (255 is the brightest and 0 is the darkest.)") as num
var/hairblue = input("How much blue do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)")as num
var/hairgreen = input("How much green do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)") as num
var/hairover = 'mponytail.dmi'
hairover += rgb(hairred,hairgreen,hairblue)
new_mob.rhair = hairred
new_mob.ghair = hairgreen
new_mob.bhair = hairblue
new_mob.overlays += hairover
src.client.mob = new_mob

if("White Female")
new_mob = new /mob/player/student/girl
new_mob.y1 = rand(1,8)
new_mob.x = rand(11,11)
if(new_mob.y1 == 1)
new_mob.y = 7
if(new_mob.y1 == 2)
new_mob.y = 17
if(new_mob.y1 == 3)
new_mob.y = 27
if(new_mob.y1 == 4)
new_mob.y = 37
if(new_mob.y1 == 5)
new_mob.y = 47
if(new_mob.y1 == 6)
new_mob.y = 57
if(new_mob.y1 == 7)
new_mob.y = 67
if(new_mob.y1 == 8)
new_mob.y = 77
new_mob.z = 1
new_mob.name = char_name
new_mob.Alignment = "Not Selected"
new_mob.Exp = 0
new_mob.LevelExp. = 20
new_mob.MaxHP = 20
new_mob.MaxMP = 20
new_mob.GM = 0
new_mob.Level = 1
new_mob.Strength = 5
new_mob.Defense = 5
new_mob.Speed = 5
new_mob.Dex = 5
new_mob.MagicDef = 5
new_mob.Magic = 5
new_mob.Money = 0
new_mob.JapMoney = 0
new_mob.MP = 20
new_mob.HP = 20

switch(input("What hair style do you want?", "Customization", text) in list ("Female Long", "Pigtails"))


if("Female Long")
new_mob.hair = "Female Long"
var/hairred = input("How much red do you want to put into your hair? (255 is the brightest and 0 is the darkest.)") as num
var/hairblue = input("How much blue do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)")as num
var/hairgreen = input("How much green do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)") as num
var/hairover = 'flong.dmi'
hairover += rgb(hairred,hairgreen,hairblue)
new_mob.rhair = hairred
new_mob.ghair = hairgreen
new_mob.bhair = hairblue
new_mob.overlays += hairover
src.client.mob = new_mob

if("Pigtails")
new_mob.hair = "Pigtails"
var/hairred = input("How much red do you want to put into your hair? (255 is the brightest and 0 is the darkest.)") as num
var/hairblue = input("How much blue do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)")as num
var/hairgreen = input("How much green do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)") as num
var/hairover = 'fpigtails.dmi'
hairover += rgb(hairred,hairgreen,hairblue)
new_mob.rhair = hairred
new_mob.ghair = hairgreen
new_mob.bhair = hairblue
new_mob.overlays += hairover
src.client.mob = new_mob

if("Black Female")
new_mob = new /mob/player/student/bgirl
new_mob.y1 = rand(1,8)
new_mob.x = rand(11,11)
if(new_mob.y1 == 1)
new_mob.y = 7
if(new_mob.y1 == 2)
new_mob.y = 17
if(new_mob.y1 == 3)
new_mob.y = 27
if(new_mob.y1 == 4)
new_mob.y = 37
if(new_mob.y1 == 5)
new_mob.y = 47
if(new_mob.y1 == 6)
new_mob.y = 57
if(new_mob.y1 == 7)
new_mob.y = 67
if(new_mob.y1 == 8)
new_mob.y = 77
new_mob.z = 1
new_mob.name = char_name
new_mob.Alignment = "Not Selected"
new_mob.Exp = 0
new_mob.LevelExp. = 20
new_mob.MaxHP = 20
new_mob.MaxMP = 20
new_mob.GM = 0
new_mob.Level = 1
new_mob.Strength = 5
new_mob.Defense = 5
new_mob.Speed = 5
new_mob.Dex = 5
new_mob.MagicDef = 5
new_mob.Magic = 5
new_mob.Money = 0
new_mob.JapMoney = 0
new_mob.MP = 20
new_mob.HP = 20

switch(input("What hair style do you want?", "Customization", text) in list ("Female Long", "Pigtails"))


if("Female Long")
new_mob.hair = "Female Long"
var/hairred = input("How much red do you want to put into your hair? (255 is the brightest and 0 is the darkest.)") as num
var/hairblue = input("How much blue do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)")as num
var/hairgreen = input("How much green do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)") as num
var/hairover = 'flong.dmi'
hairover += rgb(hairred,hairgreen,hairblue)
new_mob.rhair = hairred
new_mob.ghair = hairgreen
new_mob.bhair = hairblue
new_mob.overlays += hairover
src.client.mob = new_mob

if("Pigtails")
new_mob.hair = "Pigtails"
var/hairred = input("How much red do you want to put into your hair? (255 is the brightest and 0 is the darkest.)") as num
var/hairblue = input("How much blue do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)")as num
var/hairgreen = input("How much green do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)") as num
var/hairover = 'fpigtails.dmi'
hairover += rgb(hairred,hairgreen,hairblue)
new_mob.rhair = hairred
new_mob.ghair = hairgreen
new_mob.bhair = hairblue
new_mob.overlays += hairover
src.client.mob = new_mob

new_mob.oicon = new_mob.icon
new_mob.name = char_name
src.client.mob = new_mob
var/turf/first_location = locate(11,7,1)
new_mob.loc = first_location
del(src)


mob/player
student
boy
icon = 'tallbases.dmi'
icon_state= "malebase"

mob/player
student
girl
icon = 'tallbases.dmi'
icon_state= "femalebase"
mob/player
student
bboy
icon = 'tallbases.dmi'
icon_state= "bmalebase"
mob/player
student
bgirl
icon = 'tallbases.dmi'
icon_state= "bfemalebase"

mob/Logout()
world << "[src.name] has left this world."
del(src)
In response to Blueseed15
Blueseed15 wrote:
mob/player
student
boy
icon = 'tallbases.dmi'
icon_state= "malebase"

mob/player
student
girl
icon = 'tallbases.dmi'
icon_state= "femalebase"
mob/player
student
bboy
icon = 'tallbases.dmi'
icon_state= "bmalebase"
mob/player
student
bgirl
icon = 'tallbases.dmi'
icon_state= "bfemalebase"

1 problem might be this try changing the to mob/other/creating_character
In response to WTS_Leader
then how would I give different base icons to the different character types?



EDIT for someone to see a fraction of the code:

                switch(input("What hair style do you want?", "Customization", text) in list ("Short1", "Male Ponytail"))


if("Short1")
new_mob.hair = "Short1"
var/hairred = input("How much red do you want to put into your hair? (255 is the brightest and 0 is the darkest.)") as num
var/hairblue = input("How much blue do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)")as num
var/hairgreen = input("How much green do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)") as num
var/hairover = 'maleshort.dmi'
hairover += rgb(hairred,hairgreen,hairblue)
new_mob.rhair = hairred
new_mob.ghair = hairgreen
new_mob.bhair = hairblue
new_mob.overlays += hairover

if("Male Ponytail")
new_mob.hair = "Male Ponytail"
var/hairred = input("How much red do you want to put into your hair? (255 is the brightest and 0 is the darkest.)") as num
var/hairblue = input("How much blue do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)")as num
var/hairgreen = input("How much green do you want to put into your hair?) (255 is the brightest and 0 is the darkest.)") as num
var/hairover = 'mponytail.dmi'
hairover += rgb(hairred,hairgreen,hairblue)
new_mob.rhair = hairred
new_mob.ghair = hairgreen
new_mob.bhair = hairblue
new_mob.overlays += hairover

switch(input("What shirt style do you want?", "Customization", text) in list ("Normal"))
if ("Normal")
new_mob.shirt = "Normal"
var/shirtred = input("How much red do you want to put into your shirt? (255 is the brightest and 0 is the darkest.)") as num
var/shirtblue = input("How much blue do you want to put into your shirt?) (255 is the brightest and 0 is the darkest.)")as num
var/shirtgreen = input("How much green do you want to put into your shirt?) (255 is the brightest and 0 is the darkest.)") as num
var/shirtover = icon('clothes.dmi',"maleshirt")
shirtover += rgb(shirtred,shirtgreen,shirtblue)
new_mob.rshirt = shirtred
new_mob.gshirt = shirtgreen
new_mob.bshirt = shirtblue
src.client.mob = new_mob
In response to Blueseed15
found the problem, thanks for trying to help