ID:1723846
 
(See the best response by FKI.)
Code:
mob
proc
new_char()
var/Classes = list ("Human" = list("White" = icon('BasesMaleWhite.dmi'),"Tan","Black"),"Drugan","Birdon","Moanky")
var/class = null
while(!class)
src.gender = lowertext(input("Please select your gender") in list ("Male","Female"))
class = input("What class do you want to be in?", "Class") in Classes
if(istype(Classes[class], /list))
src.skin = input("What skin tone do you want have", "Skin Tone") in Classes[class]
if("No" == alert("Are you sure you want to be a [src.gender] [src.skin] [class]?", "Confirmation", "No", "Yes"))
class = null
src << "Welcome to THE VOID!"
src.loc=locate(1,1,1)


Problem description:

I want the system to allow the player a full range of options for customization. The problem i run into however is that when you finish, the character's icon isn't there. I know its because it needs to be defined but i'm not sure where it should be defined and what i did(in the classes) doesnt seem to work. any tips?
Best response
I believe your problem is because you aren't setting the mob's icon to the selected skin. Try something like this:

var/list/classes = list(
Human = list(
White = 'BaseMaleWhite.dmi',
Tan = null,
Black = null,
)
)

mob
var/class
var/skin

proc/new_char()
var/class
while(!class)
// choose gender..
class = input(src, "Choose a class.", "Choose your class") as null|anything in classes
if(!class) return
if(istype(class, /list))
skin = input(src, "Choose a skin tone.", "Select a skin tone") as null|anything in classes[class]

// confirmation prompt..

update_appearance()

// finish creation stuff.

proc/update_appearance()
if(skin)
icon = skin
I used this, but it doesn't seem to work.

It never gives me an option to choose my skin
You have to call new_char() at some point during your login process.

Also, yeah, FKI's example is wrong. Will update post in a second... Hang on.
Class will never be a type of list. It will always be a string. We need to fix some broken logic in FKI's example too.

var/list/classes = list(
Human = list(
White = 'BaseMaleWhite.dmi',
Tan = null,
Black = null,
)
)

mob
var/class
var/skin

proc/new_char()
var/class
while(!class)
// choose gender..
class = input(src, "Choose a class.", "Choose your class") as null|anything in classes
if(class)
skin = input(src, "Choose a skin tone.", "Select a skin tone") as null|anything in classes[class]

// confirmation prompt..

update_appearance()

// finish creation stuff.

proc/update_appearance()
if(skin)
icon = skin


Although, honestly, it strikes me that nested lists aren't really a very good way of going about this.

var/list/races = list("Human" = new/Race/Human())

Race
proc
CharacterCreation()
Human
var
list/skin_tones = list("White"='baseWhite.dmi',"Tan"='baseTan.dmi',"Black"='baseBlack.dmi')
CharacterCreation(mob/m)
var/selection
while(!selection)
selection = input(src,"Choose a skin tone.", "Select a skin tone" as null|anything in skin_tones
m.icon = skin_tones[selection]

mob
var
race
proc
new_char()
while(!race)
race = input(src,"Choose a race.","Choose your race" as null|anything in races
var/race/r = races[race]
r.CharacterCreation(src)


In this example, I left the specifics of character creation up to each specific race datum. This will let you have more complexity and unique classes or whatever if it's necessary. If it's not, just don't define specific character creation under the race datum.