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

Checkboxes and totals

Hi there.   I'm looking for a bit of help, I*think* with checkboxes and displaying values, but I'm totally up for other solutions, too.   I'm using a homebrew system, where players buy upgrades in increments, rather than "levelling up"; each upgrade costs a different value.  I was thinking that I would like a little chart, maybe showing the available costs and allowing players to tick a checkbox in each upgrade they'd taken - but critically, totalling the upgrades taken.   I think I may have found the exact solution I'm after - the Rogue Trader character sheet.  It contains the following code: --- <table> <tr> <th>Skill Name</th>             <th></th>             <th>10</th>             <th>20</th>             <th>Roll</th>             </tr> <tr>             <td>Awareness (Per)</td>             <td><input type="checkbox" name="attr_awareness1" value="0.5" /></td>             <td><input type="checkbox" name="attr_awareness2" value="10" /></td>             <td><input type="checkbox" name="attr_awareness3" value="10" /></td>             <td><button type="roll" name="roll_awareness" value="/em rolls Awareness with [[(@{awareness}+?{Modifier|0}-1d100)/10]] degree(s) of success!">             <input type="number" name="attr_awareness" value="floor((@{awareness1}+0.5)*@{per}+@{awareness2}+@{awareness3})" disabled="true"/>             </button></td> </tr> ---   ...which displays checkboxes, and a total of the values generated by the checkboxes (10 each time - I can't attach an image to my post today, for some reason). I've nicked that, and turned it into the following: --- <table> <tr>                         <th>Upgrades purchased</th>                         <td>Hit Dice</td>                         <td><input type="checkbox" name="HD2" value="667" /></td>                         <td><input type="checkbox" name="HD3" value="1000" /></td>                         <td><input type="checkbox" name="HD4" value="2000" /></td>                         <td><input type="checkbox" name="HD5" value="5333" /></td>                         <td><input type="checkbox" name="HD6" value="8000" /></td>                         <td><input type="checkbox" name="HD7" value="16000" /></td>                         <td><input type="checkbox" name="HD8" value="42667" /></td>                         <td><input type="checkbox" name="HD9" value="64000" /></td>                         <td><input type="checkbox" name="HD10" value="128000" /></td>                         <td><input type="number" name="XPHD" value="(@{HD2}+@{HD3}+{@HD4}+{@HD5}+{@HD6}+{@HD7}+{@HD8}+{@HD9}+@HD10})" disabled/></td> </tr> </table> --- ...which displays as a row of checkboxes, and an empty value box (again, I can't seem to attach images today).   But, for the life of me, I cannot make the total of the checkboxes selected appear in the total box.  I've removed the reference to it being a button, because I don't want it to roll, but even when I leave the code to make it a button in, it still doesn't display the total the way the Rogue Trader does.   Is anyone able to tell me what I'm missing?   Thanks!
1598463371
Andreas J.
Forum Champion
Sheet Author
Translator
At least you've forgotten the "attr_" prefix in the attribute names, which is essential for roll20 to save values.&nbsp; It's among the most common pitfalls with character sheets. <a href="https://wiki.roll20.net/Building_Character_Sheets#Common_Mistakes" rel="nofollow">https://wiki.roll20.net/Building_Character_Sheets#Common_Mistakes</a> <a href="https://wiki.roll20.net/Building_Character_Sheets#Storing_User_Data" rel="nofollow">https://wiki.roll20.net/Building_Character_Sheets#Storing_User_Data</a>
Thanks so much!&nbsp; Also, to my embarrassment - my brackets are ALL OVER the place.&nbsp; A salient lesson about not doing this stuff past midnight. :) The code's working now, it reads as : --- &lt;table&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;tr&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;th&gt;Upgrades purchased&lt;/th&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/tr&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;Hit Dice&lt;/td&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;&lt;input type="checkbox" name="attr_HD2" value="667" /&gt;&lt;/td&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;&lt;input type="checkbox" name="attr_HD3" value="1000" /&gt;&lt;/td&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;&lt;input type="checkbox" name="attr_HD4" value="2000" /&gt;&lt;/td&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;&lt;input type="checkbox" name="attr_HD5" value="5333" /&gt;&lt;/td&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;&lt;input type="checkbox" name="attr_HD6" value="8000" /&gt;&lt;/td&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;&lt;input type="checkbox" name="attr_HD7" value="16000" /&gt;&lt;/td&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;&lt;input type="checkbox" name="attr_HD8" value="42667" /&gt;&lt;/td&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;&lt;input type="checkbox" name="attr_HD9" value="64000" /&gt;&lt;/td&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;&lt;input type="checkbox" name="attr_HD10" value="128000" /&gt;&lt;/td&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td&gt;&lt;input type="number" name="attr_XPHD" value="(@{HD2}+@{HD3}+@{HD4}+@{HD5}+@{HD6}+@{HD7}+@{HD8}+@{HD9}+@{HD10})" disabled=”true”/&gt;&lt;/td&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/tr&gt; &lt;/ table &gt; ---