ID:146605
 
Code:
        Click()
var/obj/E = src
var/r = input("Please choose between 0 and 255 for red")
var/g = input("Please choose between 0 and 255 for green")
var/b = input("Please choose between 0 and 255 for blue")
E.icon -= rgb(r,g,b)


Problem description:
well, simply put, it won't recolor an object that is dominantly white in color when it is clicked. Everything should work.

since white is 255,255,255, then naturally subtracting the color values should make it less white, and more of that color, however it will not do this.

can someone point out to me what I'm doing wrong? this is my first time using the RGB() proc. Thanks in advance.
Clowd wrote:
Code:
>       Click()
> var/obj/E = src
> var/r = input("Please choose between 0 and 255 for red")
> var/g = input("Please choose between 0 and 255 for green")
> var/b = input("Please choose between 0 and 255 for blue")
> E.icon -= rgb(r,g,b)
>

Problem description:
well, simply put, it won't recolor an object that is dominantly white in color when it is clicked. Everything should work.

since white is 255,255,255, then naturally subtracting the color values should make it less white, and more of that color, however it will not do this.

can someone point out to me what I'm doing wrong? this is my first time using the RGB() proc. Thanks in advance.

For one. just always put input as number if your wanting a number entered. so your code should look like this, that way people cant enter text as the input for the variable. but i dont rly know what the problem is. maybe making E = src.icon might help as well.

        Click()
var/obj/E = src.icon
var/r = input("Please choose between 0 and 255 for red") as num
var/g = input("Please choose between 0 and 255 for green") as num
var/b = input("Please choose between 0 and 255 for blue") as num
E -= rgb(r,g,b)
In response to Odine
Odine wrote:
maybe making E = src.icon might help as well.

Not at all.

One can't set an obj equal to an atom's icon variable.
Clowd wrote:
well, simply put, it won't recolor an object that is dominantly white in color when it is clicked. Everything should work.

since white is 255,255,255, then naturally subtracting the color values should make it less white, and more of that color, however it will not do this.

Adding or subtracting color values is a fairly bogus way to color your icons. What you should do instead is multiply.

Lummox JR
In response to Wizkidd0123
obj
Equipment
Click()
var/obj/E = src
var/r = input("Please choose between 0 and 255 for red")as null|num
var/g = input("Please choose between 0 and 255 for green")as null|num
var/b = input("Please choose between 0 and 255 for blue")as null|num
remred(r, E)
remgreen(g, E)
remblue(b, E)

proc
remred(var/red, var/atom/O)
O.icon -= rgb(0,red,red)

remblue(var/blue, var/atom/O)
O.icon -= rgb(blue,blue,0)

remgreen(var/green, var/atom/O)
O.icon -= rgb(green, 0, green)


Thanks for the help, this is the system I wound up using. Basically, this is for coloring weapons based upon a system I'm using for my game. the weapon starts with a black outline, and shades of white to gray for the weapon's coloration. Then, I remove colors to allow one particular one to show through, shaded based upon the shades of the white on the weapon. It works, and if I choose, say, 150 red, the weapon is shaded to a pinkish-red, if I do, say, 255 red, then it becomes sorta a blood red color.