ID:143252
 
Code:
var/hair = input("Which hairstyle do you want?","Naruto: Legendary Warriors") in list("Kakashi","test")
if(hair == "Kakashi")
var/icon/I = new('hairstyles.dmi',"kakashiH")
var/rgb1 = input("How much red do you want in your hair?","Naruto: Legendary Warriors") as num
var/rgb2 = input("How much green do you want in your hair?","Naruto: Legendary Warriors") as num
var/rgb3 = input("How much blue do you want in your hair?","Naruto: Legendary Warriors") as num
I += rgb(rgb1,rgb2,rgb3)
usr.icon += I


Problem description:

When I run the program, I get a runtime error saying type mismatch when I enter the RGB values. What is wrong?
 switch(input("Which hairstyle do you want?","Naruto: Legendary Warriors") in list("Kakashi","test")
if("Kakashi")
var/icon/I = new('hairstyles.dmi',"kakashiH")
var/rgb1 = input("How much red do you want in your hair?","Naruto: Legendary Warriors") as num
var/rgb2 = input("How much green do you want in your hair?","Naruto: Legendary Warriors") as num
var/rgb3 = input("How much blue do you want in your hair?","Naruto: Legendary Warriors") as num
I += rgb(rgb1,rgb2,rgb3)
usr.overlays += I


var/hair is un-needed unless working with a mob/M as mob in world
Armiris wrote:
Code:
> var/hair = input("Which hairstyle do you want?","Naruto: Legendary Warriors") in list("Kakashi","test")
> if(hair == "Kakashi")
> var/icon/I = new('hairstyles.dmi',"kakashiH")
> var/rgb1 = input("How much red do you want in your hair?","Naruto: Legendary Warriors") as num
> var/rgb2 = input("How much green do you want in your hair?","Naruto: Legendary Warriors") as num
> var/rgb3 = input("How much blue do you want in your hair?","Naruto: Legendary Warriors") as num
> I += rgb(rgb1,rgb2,rgb3)
> usr.icon += I
>

Problem description:

When I run the program, I get a runtime error saying type mismatch when I enter the RGB values. What is wrong?

I is an /icon datum, not an icon file. To blend with the datum you need to call I.Blend(rgb(...), ICON_ADD) or some such. If you have an actual icon file, then just adding the RGB works fine because BYOND is designed to understand that.

What you've got here is datum += text. Type mismatch.

Lummox JR
In response to Lummox JR
I have a hairstyles.dmi file, I'm trying to import it into a new temporary icon so the user can change the color of the hair. How would I fix it?