ID:162523
 
i notice most of the games on byond have hair colors? Am i right? So do really have to add all the diffrent hair colors or is just something in the DM that does it?
I know for a fact that you can use a code to change the hair but I don't remember how, just search for a demo and I'm sure you'll find it.

It has something to do with RGB colors I think.
Usually it is an overlay.

Create an icon file with different states, all of hair colors of varying hue. Set it as an overlay, I do this usually by:
[code]
obj
overlay
BrownHair
icon = 'brownhair.dmi'
icon_state = "BrownHair"
[/code]

Now, you need to create a proc or verb that sets the overlay based on a condition. Like, for example mob/Login().

[code]
mob
Login()
var/haircolor = input ("What color hair would you like?") in list ("Blonde","Brown","Bald")
if(haircolor == "Blonde")
HairIsBlonde()
else if (haircolor == "Brown"
HairIsBrown()
else
Bald()
[/code]

[code]
mob
proc
HairIsBrown()
src.overlays += /obj/overlay/BrowHair
[/code]
In response to DisturbedSixx
You can do it programmatically using either icon arithmetic or icon.Blend() and rgb'd colours.
In response to Hazman
Just make them type it in as a number. Most games do that.
In response to Zuglilth
BBCode does not work on these forums. HTML tags are used (to an extent, of course). For posting code, use the <DM></DM> tags.