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

[Help] Debugging Sheet Worker script

1509647236

Edited 1509647282
Missingquery
Pro
Sheet Author
API Scripter
I considered putting this into the Character Sheet section, but I thought I'd get the best advice in a dedicated JS-centric subforum. I'm trying to grab the text of an attribute on my character sheet for use in a Sheet Worker Script, but as it turns out when I log it to the console, it always turns up as "undefined". Is there something I'm doing wrong here? <script type="text/worker"> //This  is an autofill script for convenience' sake //Class bases/growths; use consts since they don't need to be mutable @runtime on("change:Class", function(eventInfo) {     //tons of stat lists, probably not important?     let classIndex = 0;     let currentclass = eventInfo.newvalue;     if (unPr_classList.indexOf(currentclass) != -1) {         classIndex = unPr_classList.indexOf(currentclass);             getAttrs(["HP_sf", "HP_gf"], function(values) {                 setAttrs({                     HP_sf: unPr_HP_b[classIndex]                 });             });     }     console.log("Stats set for " + currentclass) }); </script>
1509649098
The Aaron
Pro
API Scripter
Try logging eventInfo.  I'm not sure it contains a newvalue property.
1509649170
The Aaron
Pro
API Scripter
Ah.&nbsp; Case matters.&nbsp; Looks like it's eventInfo.newValue See:&nbsp;<a href="https://wiki.roll20.net/Sheet_Worker_Scripts#eventInfo_Object" rel="nofollow">https://wiki.roll20.net/Sheet_Worker_Scripts#eventInfo_Object</a>
1509656654
Missingquery
Pro
Sheet Author
API Scripter
Yep, that ended up being the problem. Thanks!
1509656912
The Aaron
Pro
API Scripter
np.