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

Any simple way to total checkboxes?

I'm using the Kids on Bikes character sheet and I was just looking for a way to add the adversity token checkboxes together to use it on the token bar. Unfortunately I seem to be very dumb and I can't understand any of the results I've found. Almost everything that describes this uses  <script type="text/worker"> which the API editor immediately rejects for using <, or it mentions character sheet html which I can't even find. Any help would be appreciated
1706140398

Edited 1706141742
vÍnce
Pro
Sheet Author
Hi Marigold. Are you wanting to edit the character sheet for a custom game to show a total on the sheet, make a macro that shows the total, or ...? Screen shot might help as well. like so? &{template:rolls}{{header=Adversity}} {{dice=[[ @{selected|token1} + @{selected|token2} + @{selected|token3} + @{selected|token4} + @{selected|token5} + @{selected|token6} + @{selected|token7} + @{selected|token8} + @{selected|token9} + @{selected|token10} + @{selected|token11} + @{selected|token12} + @{selected|token13} + @{selected|token14} + @{selected|token15} ]]}}
1706149352

Edited 1706149422
I was looking for a way to use the number on the token bar, like you can do with like ammo or health on other sheets.
1706161570

Edited 1706161644
vÍnce
Pro
Sheet Author
Hmm.  It's easy to grab attribute data for a macro and manipulate off-sheet, but it looks like the sheet only uses individual check-boxes as a visual indicator but doesn't total them to a single attribute.  So there isn't a totaled attribute to link to. ;-( IF the sheet Attributes tab allowed calculations this could be as simple as creating an 'adversity' attribute with the value ; ( @{token1} + @{token2} + @{token3} + @{token4} + @{token5} + @{token6} + @{token7} + @{token8} + @{token9} + @{token10} + @{token11} + @{token12} + @{token13} + @{token14} + @{token15} ) and then linking your token bar to 'adversity'... but alas, there isn't a total value included on the sheet. The sheet code is available on roll20's github and could easily be modified for a custom game (Pro required) example; <input type="hidden" name="attr_adversity" value="( @{token1} + @{token2} + @{token3} + @{token4} + @{token5} + @{token6} + @{token7} + @{token8} + @{token9} + @{token10} + @{token11} + @{token12} + @{token13} + @{token14} + @{token15} )" disabled="true" /> I'm not sure of any other way to auto-calculate those attribute values so the total can be linked to a token bar.
1706180467

Edited 1706219137
GiGs
Pro
Sheet Author
API Scripter
Anything that includes this  <script type="text/worker"> is describing how to edit a character sheet - it's designed for the script block of a character sheet, not the API and won't work there. For what you need: if the sheet doesn't include a total attribute, you can't add it to a token bar the way you want to. You can create a new attribute, using a script like ScriptCards or setAttrs (or just manually add it to the Attributes list on the Attributes and Abilities tab - - but the script wroute is needed if you want to autocalculate the values, and you'd probably need to rerun it each time you want the attribute changed), and then put that attribute in the token bar. You'd need to create the attribute for every character. Vince's suggestion of making a custom sheet based on the existing Kids on Bikes sheet is the best solution (and adding a sheet worker to calculate the attribute), but you won't get updates if the sheet is still being updated.
Okay, that makes sense. Thank you all so much!!
1706219319
GiGs
Pro
Sheet Author
API Scripter
vÍnce said: The sheet code is available on roll20's github and could easily be modified for a custom game (Pro required) example; <input type="hidden" name="attr_adversity" value="( @{token1} + @{token2} + @{token3} + @{token4} + @{token5} + @{token6} + @{token7} + @{token8} + @{token9} + @{token10} + @{token11} + @{token12} + @{token13} + @{token14} + @{token15} )" disabled="true" /> Would an autocalc attribute work here? You want a token bubble to change. It seems to me that a sheet worker would be a much better way to calculate that attribute (and you could set a _max attribute), and considering would be pretty easy with that attribute naming scheme.
1706226675

Edited 1706227612
vÍnce
Pro
Sheet Author
I agree a sheetworker is better option 99% of the time.  Given it was a single attribute (or 2 w/max), maybe something that a total novice(unknown but going with the lowest common denominator) may be wanting to implement, and I don't believe the sheet uses any workers, I thought a simple html-calc attribute would be ok.  I didn't really think about the max value although that's as simple as creating it as well, right?  I believe it's a fixed amount for this sheet (ie 15) that could be entered manually in the max token field ? Not sure if that works. Just checked. It doesn't. ;-) So it's either make two html-calculated attributes (ie attr_adversity and attr_adversity_max) or use worker to do the same.