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

Sheetworkers not calculating on live sheet

1630019341
Chris D.
Pro
Sheet Author
Hiya, I recently published a sheet to the community, which was accepted (yay!).  While it is mostly working as intended, I had created a few sheetworkers to calculate some results (how many companions do you have, how much damage to the leg have you taken etc.). Everything was working in the Sheet Sandbox I set up to help build the charactersheet, but now the sheet is out in the wild, none of the calculations are being run. It's not critical to the running of the sheet, but it's a nice thing to have. As an example of one of the sheet workers: //////////////////////////////////////////////////////////////////////////// //Catching and calculating all of the Left Leg hitboxes into a single value // on("change:lleg1 change:lleg2 change:lleg3 change:lleg4 change:lleg5 change:lleg6 change:lleg7 change:lleg8 change:lleg9 change:lleg10", function() { const stats = ["lleg1", "lleg2", "lleg3", "lleg4", "lleg5", "lleg6", "lleg7", "lleg8", "lleg9", "lleg10"]; getAttrs(stats, function(values) { let stunTotal = 0; stunTotal = calcStun(stats, values); //console.log("stunTotal: "+stunTotal); let killTotal = 0; killTotal = calcKill(stats, values); //console.log("killTotal: "+killTotal); setAttrs({ lLegStun: stunTotal, lLegKill: killTotal }); }); }); The code here calculates the amount of stun or kill damage taken to the left leg and posts the result to an attribute.  However, now the attribute is not updating. I have noticed that the charactersheet is not generating all of the attributes on the sheet.   It will only generate them as they are used (the damage boxes only have their attribute created if you click on them for example), perhaps this is the cause of the issue.  But even when I generate all of the attributes necessary for the code to work, it is still coming up blank. Any insight into this would be appreciated.  Maybe there is a fundamental issue with sheetworkers or charactersheets that I don't know about.  I am still new to this. Thanks for any help you can provide.
1630022707

Edited 1630023450
GiGs
Pro
Sheet Author
API Scripter
That sheet worker looks fine, it should work fine so the problem is somewhere before it in the script block. Although the calcStun and calcKill functions arent included so if there's a fault in those it could cause the worker to fail. However, if you have multiple sheet workers failing, there's another more likely problem: If you have a single faulty worker, that is faulty in a serious enough way, it can break the entire script block. Every worker after it in the block will fall to work. If worse comes to worse, you might have to remove all the sheet workers and add them back in bundles to see where the problem lies. And I have had a quick look at your sheet and can tell you that's exactly the issue here: your rolltemplate is inside the script block. Check out lines 1460-1464 of your HTML file. You need to move the entire rolltemplate block up to before the <script line.
1630060571
Chris D.
Pro
Sheet Author
Thanks very much GiGs.  I had thought that the rolltemplate should be part of the block.  Obviously I was wrong.  I'll try to sort that out ASAP.
1630063966
GiGs
Pro
Sheet Author
API Scripter
Yeah, the rolltemplate is its own block, technically part of the html not the script block.
1630067655
Chris D.
Pro
Sheet Author
Hiya, I have updated the code and committed the new sheet.  Hopefully it will be updated in a few days. Looking at the code, I should have guessed that it was in the wrong place.  I don't know why I thought that code should be within a script tag.  It clearly uses HTML syntax.  
1630070669

Edited 1630070919
Andreas J.
Forum Champion
Sheet Author
Translator
You made some mistake on your pull request, it shows zero changes: <a href="https://github.com/Roll20/roll20-character-sheets/pull/9428" rel="nofollow">https://github.com/Roll20/roll20-character-sheets/pull/9428</a> Recommend you use separate branches on github where you store your changes, and not just do things on your master branch. Might be that you overwritten some of your later changes by updating your master-branch to be up-to-date with Roll20's repo.
1630083655
Chris D.
Pro
Sheet Author
Hiya, Thanks for letting me know. I'll try to take a look at this ASAP.&nbsp; I am still new to using GitHub. Chris.