ID:824138
 
(See the best response by Alathon.)
I've recently begun programming and have been slowly working on building something from an RPG demo.

I'm having issues with allowing the user to create things like skin tone, hair color, eye color. I'm not sure how to reflect the correct icons for each state, say if they chose light skin, their avatar would be represented by the light skinned icon.

mob/create_pc
Login()
var/mob/character
var/classlist[] = list("Dragoon","Mage","Paladin","Priest")
var/charactername = src.key
if((src.key == "Ironsoul") || (src.key == "YourName"))
classlist += "GM" // Set this to your key ^
alert(src, "Welcome to [world.name], initializing character creation...click OK to continue.")
switch(input("Choose a class.","Class Selection","Dragoon") in classlist)
if("Dragoon")
character = new /mob/pc/dragoon()
if("Mage")
character = new /mob/pc/mage()
if("Paladin")
character = new /mob/pc/paladin()
if("Priest")
character = new /mob/pc/priest()
if("GM")
character = new /mob/pc/gm/a/b/c()
character.name = charactername
src.client.mob = character
if(character.name == null)
character.name = src.key
del(src)


Not sure where to go from here.

any help for a newbie would be much appreciated.
For Both You Can Use switch(input statements :
for hair and eye color you need to do src.overlays+=
'iconname.dmi'

for skin tone you that should be which type of base so u need to do src.icon='icon.dmi'
So you can either follow above and add an overlay with a defined color, or you can set the icons to a specific color using the icon commands (if they are setup in dmi file correctly) and change the icon color - then add this changed icon as an overlay.
i'm sure there's a fairly obvious error and an easy correction, but alas, i am new and can't figure it out for the life of me.

mob/create_pc
Login()
var/mob/character
var/classlist[] = list("Dragoon","Druid","Mage","Paladin","Priest")
var/tonelist[] = list("Light","Medium","Dark")
var/hairstylelist[] = list("Long","Headband")
var/charactername = src.key
if((src.key == "Ironsoul") || (src.key == "YourName"))
classlist += "GM" // Set this to your key ^
alert(src, "Welcome to [world.name], initializing character creation...click OK to continue.")
switch(input("Choose a class.","Class Selection","Dragoon") in classlist)
if("Dragoon")
character = new /mob/pc/dragoon()
if("Druid")
character = new /mob/pc/druid()
if("Mage")
character = new /mob/pc/mage()
if("Paladin")
character = new /mob/pc/paladin()
if("Priest")
character = new /mob/pc/priest()
if("GM")
character = new /mob/pc/gm/a/b/c()
switch(input("Choose a skin tone.","Skin Tone Selection","Light") in tonelist)
if("Light")
src.icon = 'light.dmi'
if("Medium")
src.icon = 'medium.dmi'
if("Dark")
src.icon = 'dark.dmi'
switch(input("Choose a hair style.","Hair Style Selection","Long") in hairstylelist)
if("Long")
src.overlays += 'long.dmi'
if("Headband")
src.overlays += 'headband.dmi'
character.name = charactername
src.client.mob = character
if(character.name == null)
character.name = src.key
del(src)


that's what i took from the posts, but still no icon shows up when the player enters the world.

for the hair color, i manually edited the icons to reflect the different colors i'm allowing users to choose from, i'm sure there's some type of html color wheel that would make my life easier but for now i just want to get this character creation mess solved.

any continuing help would be much appreciated.
Best response
Notice that you create character, and when selecting skin tone you set the icon of src (The same applies to hairstyle).

Then you set the clients mob to character (Who has no icon or overlays), and delete src, who you set the icon of and added overlays to.