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 with sheet worker

Hi I'm trying to use sheet worker to set a value when the sheet is opened but it doesn't seem to set the value at all. Any ideas? html <div><span name="attr_Trait1_spelldc"></span></div> script I'm using on("sheet:opened"), function() {     getAttrs(["Mind", "Trait1_spelldc_bonus", "Trait2_spelldc_bonus"], function(values) {         let mind = parseInt(values.Mind)||0;     let t1_spelldc_bonus = parseInt(values.Trait1_spelldc_bonus)||0; let t2_spelldc_bonus = parseInt(values.Trait2_spelldc_bonus)||0;         setAttrs({             Trait1_spelldc: 8 + mind + t1_spelldc_bonus,             Trait2_spelldc: 8 + mind + t2_spelldc_bonus         })     }); }
1596050588
GiGs
Pro
Sheet Author
API Scripter
The error is in your first and last lines: on("sheet:opened", function() { and  } ) ;
1596050599
Finderski
Plus
Sheet Author
Compendium Curator
Not sure if this is it, but you're missing a semicolon after setAttrs...that should be: setAttrs({             Trait1_spelldc: 8 + mind + t1_spelldc_bonus,             Trait2_spelldc: 8 + mind + t2_spelldc_bonus         });
1596050643
Finderski
Plus
Sheet Author
Compendium Curator
GiGs said: The error is in your first and last lines: on("sheet:opened", function() { and  } ) ; Good catch on the first line...
Thanks for the catches on those errors Have a great day!