ID:144074
 
Code:
mob
player
verb
Costume()
var/R = input("How much red would you like to be in your mask? (Max: 255)","Costume Customization", 0) as num
var/G = input("How much green would you like to be in your mask? (Max: 255)","Costume Customization", 0) as num
var/B = input("How much blue would you like to be in your mask? (Max: 255)","Costume Customization", 0) as num
var/obj/Mask/O = new/obj/Mask
O.icon += rgb(R,G,B)
src.overlays += O


Problem description:
After I enter the numbers for R, G, and B nothing happens at all. I've tried making src.icon = O, but the icon is just blank. For some reason the icon is getting deleted or something. I know the icon_state and everything is right for the object cause I have a mask on the map and it looks fine. Any idea what's wrong? And how I can fix it?

Dession wrote:
Code:
> mob
> player
> verb
> Costume()
> var/R = input("How much red would you like to be in your mask? (Max: 255)","Costume Customization", 0) as num
> var/G = input("How much green would you like to be in your mask? (Max: 255)","Costume Customization", 0) as num
> var/B = input("How much blue would you like to be in your mask? (Max: 255)","Costume Customization", 0) as num
> var/obj/Mask/O = new/obj/Mask // /obj/Mask is not needed as the new procedure will take the reference variable type.
> O.icon += rgb(R,G,B)
/* as far as I know the icon variable has no addition operator for the rgb procedures return value.
So you should use the blend function of the icon object.
var/icon/I = O // set the icon object with the Mask objects icon.
I.Blend(rgb(R,G,B)) // Blend a solid color
O.icon = I
> src.overlays += O
>

Problem description:
After I enter the numbers for R, G, and B nothing happens at all. I've tried making src.icon = O, but the icon is just blank. For some reason the icon is getting deleted or something. I know the icon_state and everything is right for the object cause I have a mask on the map and it looks fine. Any idea what's wrong? And how I can fix it?


I do not have much knowledge in dealing with icon addition or the icon object. It might be best if you seeked the guide or reference for answeres.
You shouldn't use objects for overlays to begin with.

...
var/icon/I=new(icon='icons/myicon.dmi',icon_state="blah")
I.Blend( rgb(R,G,B) )
src.overlays+=I


If you want to get fancy with pixel offsets and layering, use images:

...
var/icon/I=new(icon='icons/myicon.dmi',icon_state="blah")
I.Blend( rgb(R,G,B) )
src.overlays+=image(icon=I,icon_state="blah",layer=-2,pixel_x=32,pixel_y=-32)
In response to Android Data
Thank you! It works perfectly now. I'll try not to use objects as overlays next time. =]