ID:156650
 
How would i go about changing the color of an object during runtime? I have
obj
Clothes
verb
Change_Color()
set category = null
set src in usr
if(src.loc == usr)
var/pick = input("What color do you want to change your [src] to?","[src] Color") as color|null
if(pick == null)
return
else
src.icon += pick

I know this will work for the base icon without added colors but im not sure how i would change the color from an existing icon with added color.
I am having difficulty understanding what you are trying to accomplish, can you please re-explain your question?

Are you looking to change the object's color?
src.icon.Blend(pick)
In response to RJTaylor
Im getting undefined proc?
In response to Shades12163
Shades12163 wrote:
Im getting undefined proc?

I am sorry for providing the wrong answer.

obj
Clothes
verb
Change_Color()
set category = null
set src in usr
if(src.loc == usr)
var/pick = input("What color do you want to change your [src] to?","[src] Color") as color|null
if(pick == null)
return
else
var/icon/i = new(src.icon)
i.Blend(pick)
src.icon = i
In response to RJTaylor
No, this blends the color i mean using a completly different rgb for the icon and have nothing to do with the old variable
In response to Shades12163
Shades12163 wrote:
No, this blends the color i mean using a completly different rgb for the icon and have nothing to do with the old variable

You need to make your request just a tad bit clearer. I am still having a hard time understanding what you need help with.

Do you only want to change the color of the clothes’ initial icon? If so, I shall direct you towards the initial() procedure. It will return the compile-time value of a variable. In your case, it will reset the icon to its default value.

var/icon/i = new(initial(src.icon))
i.Blend(pick)
src.icon = i
In response to RJTaylor
That worked out thank you