ID:2089390
 
Im trying to find a way to code for an Ai character merchant who upon speaking to would ask "what do you want to buy?" then a number of choices would appear such as "a shirt". if shirt is selected, a color wheel would appear giving you the option to choose what color thus changing the icon color of the default(black) shirt.

Ive tried various different ways of coding for this but always come up with errors and warnings, if anyone with the coding capabilities necessary could possibly code it for me that would be very helpful, as Im working on a game right now solo and Im just trying to get that small but relevant problem out of the way. Thanks! :)







BYOND has a built-in color selection window:
var c = input(src, "MESSAGE", "TITLE", rgb(50, 150, 250)) as color




It's better for the base color of the shirt to be white instead of black. That way, you can color it using atom.color:
shirt.color = input(src, "Select the color of your shirt.", "Shirt Color", shirt.color) as color

Eventually, you should to move this color selector over to a HUD or something that better fits your game's style.
Thank you very much
If you do want to use additive color on a mostly-black base, though, you can still use atom.color--since 509 we've had support for color matrices.

To do additive color with a color matrix, you'd do this:

var/oldcolor = shirt.color
if(istype(oldcolor,/list)) oldcolor = rgb(oldcolor[17]*255, oldcolor[18]*255, oldcolor[19]*255)
var/newcolor = input(src, "Select the color of your shirt.", "Shirt Color", oldcolor)
shirt.color = list(null,null,null,null,newcolor)