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

Referencing Attributes for DL Scores

In one of my games, I've been running a character's line of sight as equivalent to their Perception skill rank in meters. Since these numbers often change (and since I'm trying to move on to snazzier things that require this as a basic component), I would like to be able to reference Attributes for the first "emits light" value. I've even gone so far as to set one of the 3 bars as "Perception." I tried inputting @{Bar3} and @{selected|perception}, etc in the "Emits Light" box, but it doesn't seem to reference them accurately. Has anyone succeeded in something similar?
1390300390
Gauss
Forum Champion
I do not think that the Emits Light function was designed to use attributes, sorry.
You could write an API script that when the Perception value is changed, it updates all tokens that are controlled by that sheet to the new Perception value.
How does one do that?
I'm not the greatest with the API, but to pseudocode it, it'd be an on:change:attribute, check to see if it's Perception being changed. If so, grab the _characterid, the loop through all the current tokens and find which ones have that id as the controlledby. Then update their light_radius to equal the new perception value.
…and this is the part that always stumps me. Can you tell me where to go to learn how to use API?
<a href="http://www.codecademy.com/tracks/javascript" rel="nofollow">http://www.codecademy.com/tracks/javascript</a> That'll give you the basics of javascript. Then you can pick apart the scripts already in the API forum and use the wiki to figure out what you want to do. Or you could put the request to the API forums and someone will likely be along to help you.