ID:273553
 
Is there a possible way to make a more advanced system of changing the color of something, other than the most basic...?

var/r = input("How much red?","Hair Color") as num
var/g = input("How much green?","Hair Color") as num
var/b = input("How much blue?","Hair Color") as num
Ryu-Kazuki wrote:
Is there a possible way to make a more advanced system of changing the color of something, other than the most basic...?

var/r = input("How much red?","Hair Color") as num
var/g = input("How much green?","Hair Color") as num
var/b = input("How much blue?","Hair Color") as num

If you'd like you could use the interface color input. I find this the best way to change an icons color:

            var/new_rgb=input(usr, "What color would you like your hair to be?") as color
if(new_rgb)
var/icon/I = new('hairicon.dmi')
I.Blend(new_rgb)
overlays+= I
In response to AbdelJN
How would I implement that with this code?

Dye_Hair()
set src in view(1)
set name = "Dye Hair"
usr<<"Hair Stylist: Hey there, ever thought about changing the color of your hair?"
sleep(15)
switch(input("Would you like to dye your hair?", "Hair") in list("Yes", "No"))
if("Yes")
var/r = input("How much red?","Hair Color") as num
var/g = input("How much green?","Hair Color") as num
var/b = input("How much blue?","Hair Color") as num
usr.overlays -= usr.hairstyle
usr.hairstyle += rgb(r,g,b)
usr.overlays += usr.hairstyle
if("No")
return
In response to Ryu-Kazuki
Ryu-Kazuki wrote:
How would I implement that with this code?

Dye_Hair()
set src in view(1)
set name = "Dye Hair"
usr<<"Hair Stylist: Hey there, ever thought about changing the color of your hair?"
sleep(15)
switch(input("Would you like to dye your hair?", "Hair") in list("Yes", "No"))
if("Yes")
var/r = input("How much red?","Hair Color") as num
var/g = input("How much green?","Hair Color") as num
var/b = input("How much blue?","Hair Color") as num
usr.overlays -= usr.hairstyle
usr.hairstyle += rgb(r,g,b)
usr.overlays += usr.hairstyle
if("No")
return

Please use <*dm> tags for codes, it makes it much more readable.(<*dm>
code here<*/dm>, remove *'s.

As for your question.

        Dye_Hair()
> set src in view(1)
> set name = "Dye Hair"
> usr<<"Hair Stylist: Hey there, ever thought about changing the color of your hair?"
> sleep(15)
> switch(input("Would you like to dye your hair?", "Hair") in list("Yes", "No"))
> if("Yes")
var/icon/I = new(usr.hairstyle)//create a new icon variable for your current hairstyle
new_rgb=input(usr, "What color would you like your hair to be?") as color//show the color menu to simply select a color to apply to the hair
> /*var/r = input("How much red?","Hair Color") as num//this is your old code
> var/g = input("How much green?","Hair Color") as num//the new one above
> var/b = input("How much blue?","Hair Color") as num*/
// does all this in one line of code.
> usr.overlays -= usr.hairstyle//remove the old hairstyle(a better way would be to remove all your overlays incase of an overlay bug and to rebuild all your overlays.)
> I.Blend(new_rgb)//add the colors to the icon
usr.hairstyle=I//Add the new icon to your hairstyle variable
> usr.overlays += usr.hairstyle//Add the new dyed hair to your overlays
> if("No")
> return


This was made quickly, if you have any problems, just tell me.
In response to AbdelJN
much ablidged
In response to Ryu-Kazuki
"Obliged". Get a spellchecker for your browser, they're absurdly useful.