ID:148640
 
Hey, I asked this some time ago, but...I never got a clear answer, so I'm gonna ask again ^_^

How can you remove an rgb overlay without making all the overlays null?

Like for instance...here's part of a code:
var/hair='hair.dmi'
hair+=rgb(usr.r,usr.g,usr.b)
usr.overlays+=hair

that's a coing snippet from game, but...it's using temporary vars, so I can't just simply remove the rgb like usr.overlays-=hair
Anyone know a way? If you're still confused after reading it...(I'm not good at explaining things) contact me online at [email protected]

Thanks,
Goku72
Does anyone know the source of my problem that I described above?
Well, I'm not quite sure what the problem is with that small of a code snippet, but I'll try my best to help you.

usr.overlays -= hair

Try that. That is the most basic thing I could think of that would suit your needs
I don't use overlays much, so this might not work. Could you loop thru all the overlays, and get rid of all of the overlays that are 'hair.dmi', like:
<code> for(var/icon/I in usr.overlays) if(I.icon == 'hair.dmi') usr.overlays -= I </code>
I didn't test that code.
In response to Kamion
Goku72 wants to remove the hair overlay at a later time, but he doesn't want to remove all overlays, just the hair one. Removing var/hair wouldn't work because var/hair isn't a global var.
In response to Goku72
Yes, make the hair a variable of the mob. Then remove it by referencing the mob's hair variable.

~X
In response to Xooxer
Well, I know how to remove basic underlays and overlays, but...the problem is this, when I do, the RGB colors stay there. :-(