Advertisement Create a free account

Automatically detect the lighting around a creature or player?

Because of the way lighting renders in Roll20, with such a gradual gradient from bright to dim, it's hard to tell, at a glance, whether a token is in dim light or bright light. Would it be possible to create a script that marks each creature or player according to what level of light it occupies?  It seems plausible to me. Every light source has an explicit radius of bright and dim defined. And you can set up fog of war so that bright light on a square reveals it but dim light doesn't, so the system can obviously detect and use those values. However I don't really know anything about scripting or programming or how Roll20 works under the hood, so I don't know if it's actually plausible for a script to do something like check those values on all the light sources, check the positions of all the creatures/players, and then indicate which ones fall within which level of light.  It's not a huge deal, and I can think of some other ways to solve the problem (probably GM-only auras?). Just curious if this could be done, or maybe if it already has been done and I just can't find it.  Thanks!
The Aaron
Forum Champion
API Scripter
It would definitely be possible.  The only complication you run into is that dim and bright are subjective based on the vision of the token perceiving them.  Consider a warlock with devils sight, standing next to an elf, standing next to a human with a torch.  All three might see or not see a token in different levels of lighting.