Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[Script Update] - checkLightLevel

1675574314

Edited 1675579907
Oosh
Sheet Author
API Scripter
checkLightLevel v0.5.0 Original thread (closed) GitHub repo This script requires Path Math (available from the one-click library) Description: A simple script to check the current light level of the selected token ( originally from Craig M's thread ). The script will process all relevant light emitters on the map, determine their light level if in range, and whether or not the light is blocked. v0.5.0 update: Script is better at dealing with the edge of light sources, and will report on tokens that are partially lit and partially in darkness. Added apiMeta data Submitted to one-click Usage: Select a token and type: !checkLight Example output: Limitations: The blocking check for walls is currently a simple center-to-center check. If the center of a token has unblocked LOS to the center of a light-emitting token, it is considered to be lit by that emitter. Tokens which are partially lit and partially in darkness will be reported as 'partially lit by...'. There are all kinds of edge cases where this could deliver odd results, like a massive token being partially lit by multiple sources being reported as being in 100% light despite the center of the token being in darkness. External Usage: The total illumination on a target can be called from Plugger , part of the Meta Toolbox. Details in the v0.4.1 post. checkLightLevel can also be called from other scripts: checkLightLevel.isLitBy(tokenOrTokenId) Example return: { bright: false, dim: [<token>, <token>], daylight: 0.3, total: 0.75, partial: false, } This would indicate a token lit by 2 dim sources, with a map daylight setting of 30%, with a total illumination of 75%. At least one of the sources is illuminating the entire token. Changes: v0.3.0: Added support for one way walls Added public method to call the script from other scripts v0.4.1: dim light falloff calculations additive light sources minor metamancy tokens on gmLayer no longer included in light calcs see post for details v0.5.0: implemented 'partially lit' check for tokens on the edge of a light source
1675600243
timmaugh
Pro
API Scripter
Oosh said: Submitted to one-click
1675628361
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
This is exactly what I needed!
1675634838
Oosh
Sheet Author
API Scripter
timmaugh said: Oosh said: Submitted to one-click Oh come on, it's only been............... 82 days since I said I'd submit it. That's what I call a sprint!
No matter what I do, including the following: 1. use with Dynamic Lighting Tool (from the one click menu) 2. use checkLightLevel alone from one click 3. use the older version from one click 4. use the version directly from github 5. change a token's "Emits Light" 6. Add roll20s prebuilt lights 7. Adding a separate token with emitting light on... it always comes back that my character token is in complete darkness. Except when I turn on daylight mode. Then it detects the daylight intensity, but nothing else. Am I doing something wrong? I have the Path Math api installed from one click... Thanks in advance.
1680414873
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi Troy! Can you post a screen capture of the report you get from selecting the token and entering "!dltool" and also one of what is returned when you press "why can't this token see?"