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

Sheet Worker not running

For some reason the sheet worker on my custom sheet just won't run, even though it's properly typed as "text/worker".&nbsp; Github link:&nbsp; <a href="https://github.com/JPMeehan/DragonTacticsCharacter" rel="nofollow">https://github.com/JPMeehan/DragonTacticsCharacter</a>... Any help is greatly appreciated, I just can't figure out why it's not working On a side note, I found a bug with the CSS interpreter: When I added some formatting blocks in my file, like so /********************************************** * HEADERS AND BACKGROUND **********************************************/ .charsheet { background-color: #EEE5CE; } the background color property stopped applying. This didn't happen for any of the later comment blocks. When I changed it to the current /* HEADERS AND BACKGROUND */ .charsheet { background-color: #EEE5CE; } my background color started working properly again.
1522821723

Edited 1522822040
GiGs
Pro
Sheet Author
API Scripter
Do any of your sheet workers work? If you remove all sheet workers, and add in one at a time, do any of them work?&nbsp; I don't believe the last sheetworker is set up properly - the setAttrs function is outside the scope of the getAttrs, and wont be able to find its attributes. , and the ones which call the updateAC/Fort/etc functions look like the syntax is wrong too (functions like that need special handling in sheet workers). Though I'm not sure why they are written that way anyway. Instead of something like this: on("change:wismod", function() { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;update_Will(); &nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp;on("change:chamod", function() { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;update_Will(); &nbsp;&nbsp;&nbsp;&nbsp;}); Try&nbsp; on("change:wismod change:chamod change:level-half", function() { getAttrs(["wismod","chamod","Quest", "Level-half"], function(values) { var finalattr = (10 + Math.max(values.wismod, values.chamod) + values.Quest + values['Level-half']); setAttrs({ Will: finalattr }); }); }); Note also the syntax of Level-half var finalattr line. attribute names with "-" in them don't work&nbsp; unless you use that method. I notice other attribute names like this (AC-Att). So tehre's a bunch of errors scattered throughout your scripts. You cant fix them all in one go. Make sure you remove all sheet workers, and add them in one at a time, and make sure each is working before adding the next.
1522821975
vÍnce
Pro
Sheet Author
Not sure if it's stopping things, but I noticed on("change:intmod", function() { update_Ref(); update_AC(); } is missing " ); " should be&nbsp; on("change:intmod", function() { update_Ref(); update_AC(); }); .
1522822883

Edited 1522824624
GiGs
Pro
Sheet Author
API Scripter
There are bigger issues with those update_functions, and OP would be advised to remove them all and replace them with the simpler approach I illustrated. (I just reread this post - sorry if that sounded curt!) That final function: on("change:repeating_backpackitems", function() { &nbsp;&nbsp;&nbsp;&nbsp; getSectionIDs("BackpackItems", function(idarray) { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var spaceUsed = 0; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(var i=0; i &lt; idarray.length; i++) { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;getAttrs(["repeating_BackpackItems_" + idarray[i] + "_BackpackItemSpace"], function(value){ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;spaceUsed = (spaceUsed + value["repeating_BackpackItems_" + idarray[i] + "_BackpackItemSpace"]) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setAttrs({ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BackpackSpace: spaceUsed &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp;}); Should be rewritten more like this (untested, but the structure should be more like this): on("change:repeating_backpackitems", function() { &nbsp;&nbsp;&nbsp;&nbsp; getSectionIDs("BackpackItems", function(idarray) { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var fieldNames = []; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(var i=0; i &lt; idarray.length; i++) { fieldNames.push("repeating_BackpackItems_" + idarray[i] + "_BackpackItemSpace"); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;getAttrs(fieldNames, function(value){ var spaceUsed = 0; for(var i=0; i &lt; idarray.length; i++) { spaceUsed = spaceUsed + parseFloat(value["repeating_BackpackItems_" + idarray[i] + "_BackpackItemSpace"])||0; } &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setAttrs({ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BackpackSpace: spaceUsed &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp;}); I added parseFloat with a default of 0 onto the attribute, because if it returns a null or NaN, you'll have issues. (Like, if one of the cells is a space, or not a number, the calculation can fail.) PS: i noticed another couple of variable/attribute name issues, such as one function calling AC-att and ACatt, so there's a load of issues scattered through your scripts. Reminder: remove them ALL, and add one at time, getting each working before going on to the next.
Thank you for the swift replies! I'll fix up those errors and hopefully that will fix everything nicely
1522824501
GiGs
Pro
Sheet Author
API Scripter
Good luck! By the way, there's a bug forum, if you want to raise that CSS interpreter issue.
Thank you very much for the help, the errors were all due to sloppy syntax. This is turning into a good project for deepening my understanding of HTML, CSS, and javascript.
Character sheet fully updated, thank you very much for the help!
1523063244
GiGs
Pro
Sheet Author
API Scripter
Glad to hear it :)