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 .
×

Roll is being initiated but not finished

I thought I was getting a hang of sheetworkers, but perhaps not... When I click the act_roll button I get the following error messages: A roll was initiated by a character sheet, but it was not finished: {{roll= 13 }} A roll was initiated by a character sheet, but it was not finished: {{done= 0 }} A roll was initiated by a character sheet, but it was not finished: {{dtwo= 0 }} etc. Can anyone help me find what's wrong in my code? The sheetworker should be rolling a number of d6 equal to the value of attr_dis and the rolltemplate should then return the counts of each value (e.g. done is the number of 1s, dtwo is the number of 2s, etc.). <rolltemplate class="sheet-rolltemplate-action"> {{done}} <br /> {{dtwo}} <br /> {{dthree}} <br /> {{dfour}} <br /> {{dfive}} <br /> {{dsix}} <br /> </rolltemplate> <script type="text/worker"> on('clicked:roll', function () {     getAttrs(['dis'], function (v) {         let dis = parseInt(v.dis) || 0;         startRoll(`&{template:action} {{roll=[[${dis}d6]]}} {{done=[[0]]}} {{dtwo=[[0]]}} {{dthree=[[0]]}} {{dfour=[[0]]}} {{dfive=[[0]]}} {{dsix=[[0]]}} `, (action) => {                 const dtotal = action.results.roll.result                 const ddice = action.results.roll.dice //This will be an array of the values rolled on all the dice             const dtotal1s = ddice.filter(d => d === 1).length;             const dtotal2s = ddice.filter(d => d === 2).length;             const dtotal3s = ddice.filter(d => d === 3).length;             const dtotal4s = ddice.filter(d => d === 4).length;             const dtotal5s = ddice.filter(d => d === 5).length;             const dtotal6s = ddice.filter(d => d === 6).length;             finishRoll(action.rollId, {                 done:   dtotal1s,                 dtwo:   dtotal2s,                 dthree: dtotal3s,                 dfour:  dtotal4s,                 dfive:  dtotal5s,                 dsix:   dtotal6s             });         });     }); }); </script>
1775755736
vÍnce
Pro
Sheet Author
What happens if you do not have new lines in your macro? ie         startRoll(`&{template:action} {{roll=[[${dis}d6]]}} {{done=[[0]]}} {{dtwo=[[0]]}} {{dthree=[[0]]}} {{dfour=[[0]]}} {{dfive=[[0]]}} {{dsix=[[0]]}}`, (action) => {
It does stop the errors, thank you! However, all the results are coming back as 0, regardless of what value attr_dis is set to. Any idea why?
1775760087
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
because you are using the raw value in your template. You need to specify that you want to use the computed value: <rolltemplate class="sheet-rolltemplate-action"> {{computed::done}} <br /> {{computed::dtwo}} <br /> {{computed::dthree}} <br /> {{computed::dfour}} <br /> {{computed::dfive}} <br /> {{computed::dsix}} <br /> </rolltemplate>
1775760155
vÍnce
Pro
Sheet Author
I think you need ::computed in your roll template in order to use the "computed" results, otherwise it just uses the [[0]] you've included in your roll. example; (not tested) <rolltemplate class="sheet-rolltemplate-action"> {{ computed :: done}} <br /> {{ computed :: dtwo}} <br /> {{ computed :: dthree}} <br /> {{ computed :: dfour}} <br /> {{ computed :: dfive}} <br /> {{ computed :: dsix}} <br /> </rolltemplate>
1775760195
vÍnce
Pro
Sheet Author
Sniped.   Always listen to @Scott ;-P
I literally just realised! <facepalm> Cheers!