Generally, you don't, unless you use a system or custom list to keep track of overlays yourself. It probably shouldn't be needed often, either. There is a way though, involving looping through the special elements of the list and checking their vars. There are examples here: [link], ID 677477. This would be considered a hacky method, though; you're generally not supposed to even try to access things in the overlays list, even though it works and could be useful at times. Also note depending on the purpose of what you're doing this could be a bad method to choose to implement it. For example, if you'd use this for determining various statuses of an atom based on what overlays it has, that would be not-robust similarly to identifying an atom based by its name alone.
The first linked post already demonstrates searching for a specific overlay, so I say read, experiment and think on your own more, and ask less. =P Note such code on its own would of course generate a compile-time error (even disregarding the if() statement) as well as a runtime one once the former is fixed.
#4 Jan 8 2009, 10:58 am (Edited on Jan 8 2009, 1:49 pm)
How would I reference that specific icon state inside that icon file?
That's pretty simple. You'll do it the same way as you would the icon itself, so once you get that working this won't be a problem. The same thing for most other appearance-related vars, such as layer. I trust you can figure out the rest. ;P
Then there's the "src." I deliberately didn't put in. So that will loop through every overlay with the icon states within the icon.dmi file? And then of course I can run whatever I wanted to do if that check runs true...
I was in a rush and had to go somewhere, so I didn't really get the chance to test it. I probably could've waited to get back, but sometimes I just prefer getting an okay from someone who knows what they're doing before I start using a different technique on how to do something.