ID:150980
 
To remove an overlay on an object, you specify the actual icon name you wish to remove. What do you do if you have overlayed an icon_state of one object onto another object and you wish to remove it? How do you reference it, especially if you don't have a pointer to the particular object you copied from (i.e. it has been deleted).
To remove an overlay on an object, you specify the actual icon name you wish to remove. What do you do if you have overlayed an icon_state of one object onto another object and you wish to remove it? How do you reference it, especially if you don't have a pointer to the particular object you copied from (i.e. it has been deleted).

For this case it's best to create a simple registry of objects, each representing a specific icon/state combination. Then you can just use Registry.AddOverlay('snake.dmi', "rattler") and Registry.GetOverlay('snake.dmi', "rattler").

I have some sample code at home--if you need it, I can post it tonight.
In response to Gughunter
On 6/13/01 8:20 am Gughunter wrote:
To remove an overlay on an object, you specify the actual icon name you wish to remove. What do you do if you have overlayed an icon_state of one object onto another object and you wish to remove it? How do you reference it, especially if you don't have a pointer to the particular object you copied from (i.e. it has been deleted).

For this case it's best to create a simple registry of objects, each representing a specific icon/state combination. Then you can just use Registry.AddOverlay('snake.dmi', "rattler") and Registry.GetOverlay('snake.dmi', "rattler").

I have some sample code at home--if you need it, I can post it tonight.

That's a good idea. I've actually coded myself something that works for my purposes, but I still think we should be able to remove an icon_state overlay by name. :-)