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

Roll script not parsing

I'm trying to build a sheet worker that will roll a bunch of d6 and then count the number of occurrences of each value, then: A – Display those counts in the rolltemplate B – Add those counts to attributes on the character sheet I managed this in a previous sheet (with a lot of help!) and have copied it for my new sheet, but for some reason the values aren't parsing and neither A nor B is happening. The rolltemplate just shows all 0s and the attributes in the sheet (attr_dummy#) remain unchanged. Can anyone please spot what's amiss? 1s:  <input type="number" name="attr_ones" min="0">  <input type="number" name="attr_dummy1" min="0"><br /> 2s:  <input type="number" name="attr_twos" min="0">  <input type="number" name="attr_dummy2" min="0"><br /> 3s:  <input type="number" name="attr_threes" min="0">  <input type="number" name="attr_dummy3" min="0"><br /> 4s:  <input type="number" name="attr_fours" min="0">  <input type="number" name="attr_dummy4" min="0"><br /> 5s:  <input type="number" name="attr_fives" min="0">  <input type="number" name="attr_dummy5" min="0"><br /> 6s:  <input type="number" name="attr_sixes" min="0">  <input type="number" name="attr_dummy6" min="0"><br /> <br /> <button type="action" name="act_all3" >Roll All</button>  <rolltemplate class="sheet-rolltemplate-all"> <b><table><tr>     <td style="width:20px;">1s</td>     <td style="width:20px;">2s</td>     <td style="width:20px;">3s</td>     <td style="width:20px;">4s</td>     <td style="width:20px;">5s</td>     <td style="width:20px;">6s</td> </tr>    <tr> <td style="text-align:center;">{{computed::ones}}</td> <td style="text-align:center;">{{computed::twos}}</td> <td style="text-align:center;">{{computed::threes}}</td> <td style="text-align:center;">{{computed::fours}}</td> <td style="text-align:center;">{{computed::fives}}</td> <td style="text-align:center;">{{computed::sixes}}</td> </tr></table></b> </rolltemplate> <script type="text/worker"> const all3 = [     'all3' ]; all3.forEach(button => {   on(`clicked:${button}`, () => {     getAttrs(['ones', 'twos', 'threes', 'fours', 'fives', 'sixes'], v => {       startRoll(`&{template:all} {{name=All3}} {{Roll=[[12d6]]}} {{ones=[[0]]}} {{twos=[[0]]}} {{threes=[[0]]}} {{fours=[[0]]}} {{fives=[[0]]}} {{sixes=[[0]]}}`, (all3) => {         const dice = all3.results.Roll.dice         const roll1s = dice.filter(d => d === 1).length;         const roll2s = dice.filter(d => d === 2).length;         const roll3s = dice.filter(d => d === 3).length;         const roll4s = dice.filter(d => d === 4).length;         const roll5s = dice.filter(d => d === 5).length;         const roll6s = dice.filter(d => d === 6).length;         setObj.dummy1 = dice.filter(d => d === 1).length;         setObj.dummy2 = dice.filter(d => d === 2).length;         setObj.dummy3 = dice.filter(d => d === 3).length;         setObj.dummy4 = dice.filter(d => d === 4).length;         setObj.dummy5 = dice.filter(d => d === 5).length;         setObj.dummy6 = dice.filter(d => d === 6).length;         finishRoll(           all3.rollId,           {               ones:   roll1s,               twos:   roll2s,               threes: roll3s,               fours:  roll4s,               fives:  roll5s,               sixes:  roll6s           }         );         setAttrs(setObj);       });     });   }); }); </script>
1668804009

Edited 1668804393
David
Sheet Author
Did you check the console for error messages? ReferenceError: setObj is not defined     at fullfillAttrReq (sheetsandboxworker.js:54:1)     at messageHandler (sheetsandboxworker.js:741:1) sheetsandboxworker.js:764 ReferenceError: setObj is not defined     at Object.eval [as -NHBSGP78_9jDQudd56z//0.8487419299035956] (eval at messageHandler (sheetsandboxworker.js:732:1), <anonymous>:16:9)     at fullfillAttrReq (sheetsandboxworker.js:54:1)     at messageHandler (sheetsandboxworker.js:741:1)     at Object.eval [as -NHBSGP78_9jDQudd56z//0.8487419299035956] (eval at messageHandler (sheetsandboxworker.js:732:1), <anonymous>:16:9) You haven't declared setObj.         let setObj = [];         setObj.dummy1 = dice.filter(d => d === 1).length;         setObj.dummy2 = dice.filter(d => d === 2).length;         setObj.dummy3 = dice.filter(d => d === 3).length;         setObj.dummy4 = dice.filter(d => d === 4).length;         setObj.dummy5 = dice.filter(d => d === 5).length;         setObj.dummy6 = dice.filter(d => d === 6).length; You have it declared as    const setObj = {[`${button}used`]: 1}; in other code you have posted.
Oh man, how did I miss that?? Thanks mate!