ID:264744
 
Code:
obj
demo
icon = 'blank.dmi' // "blank" black 32x32 icon

mob
var
obj/color
r // rgb values
g
b

Stat()
if(src.color) // if its not null, keep checking sliders to update color
CPick()

Login()
src.color = new /obj/demo // temporarily create object that will change color



proc
CPick() // proc for color picking
src.r = round(255 * text2num(winget(src, "rgb.bar1","value")) / 100) // get decimal value of number represented by % of 255
src.g = round(255 * text2num(winget(src, "rgb.bar2","value")) / 100)
src.b = round(255 * text2num(winget(src, "rgb.bar3","value")) / 100)
src.color.icon = 'icon.dmi' + rgb(src.r,src.g,src.b)
winset(src,"rgb.red", "text= [src.r]") // label representing current value of player's red
winset(src,"rgb.green", "text=[src.g]")
winset(src,"rgb.blue", "text=[src.b]")
winset(src,"rgb.image", "image=[src.color.icon]")


Problem description: What I'm attempting to do is allow players to adjust 3 slide bars in order to change RGB values and allow a preview of the color, but what actually happens is the initial color of black is shown, while others are not as the bars are adjusted; the space where the image should be appears blank.

i made something like that in the demo for this : RGB2HEX Library...With Bars :D
To show the icon in an interface element, you'll need to use the \ref text macro, like so:

winset(src,"rgb.image", "image=\ref[src.color.icon]")
In response to Garthor (#2)
Garthor wrote:
To show the icon in an interface element, you'll need to use the \ref text macro, like so:

winset(src,"rgb.image", "image=\ref[src.color.icon]")

I see that ACWraith had previously mentioned this but I didn't fully comprehend it until now, thanks.