proc
updateHealth()
if(src.client)
for(var/obj/HUD/Health/a in client.screen)
a.icon = (a.icon | rgb(health, 0, 0, 0))
Problem description:
I'd like to colour a HUD object on the player's screen to represent how 'healthy' they are. I've tried:
a.icon += rgb(health,0,0)
and whilst that coloured them when they were injured , it didn't uncolour them when they were injured (and -=rbg() did nothing either).
I've searched around a lot to no avail, even trying CaptFalcon's: http://www.byond.com/forum/?post=195047&hl=set%20rgb
CaptFalcon's let me set the colour however I wanted, but I couldn't then Scale it (The HUD object is scaled up from 32,32 to 96,96).
I'm struggling to use both rgb() and Scale appropriately. Why is it that I can't do "src.icon.Scale(X,Y)"? I wish I could create a var, set it to any icon (src.icon or var/icon/I or whatever) and it would replicate/copy it's size, rgb, e.t.c., maybe even overlays too.
Ignoring the rant; how can I set a HUD's icon to specific colours without changing it's Scale?
Also, you might want to check out Lummox JR's IconProcs library/article. It offers some interesting effects that you may be interested in.
I'm not sure what you mean by the second part of your post, but keep in mind that the atom/icon variable actually holds an RSC cache reference and not a /icon object:
When this variable is assigned to any dynamically created icon object, that object gets dumped into the world's resource cache (the .rsc file), and a reference to that cached file is assigned to atom.icon.
If you want to Blend(), Scale(), ect on an icon, you need to create your own /icon object and not use the atom's icon variable.
You may also be interested in this: GetFlatIcon. I just found a bug in it, but once I fix that, it sounds like it might do what you want.