I have a series of checkboxes to represent wounds. Whenever a box from the trivial wounds section is checked, it applies a -1 modifier, when a box from the light wounds is checked, it applies a -2 modifier, etc. It then takes the highest value of all the sections (i.e. if two trivial wounds are checked, and 1 light wound is checked, it would display "-2"). I got this to display the way I want using an autocalc field, but when I pass that to a button macro, it crashes. I; sure there is a way to update the field with a sheet worker instead, but I have no clue how to accomplish this. What I have right now is: HTML <div class="health-bar"> <div class="health-container"> <input type="hidden" class="health" name="attr_health1_flag" value="1" /> <button type="action" name="act_health1" class="health left-cap">k <span class="chequed">k</span> </button> </div> <div class="health-container"> <input type="hidden" class="health" name="attr_health2_flag" value="1"/> <button type="action" name="act_health2" class="health">k <span class="chequed">k</span> </button> </div> <div class="health-container"> <input type="hidden" class="health" name="attr_health3_flag" value="1" /> <button type="action" name="act_health3" class="health">k <span class="chequed">k</span> </button> </div> <div class="health-container"> <input type="hidden" class="health" name="attr_health4_flag" value="1" /> <button type="action" name="act_health4" class="health bar-divider">k <span class="chequed">k</span> </button> </div> <div class="health-container"> <input type="hidden" class="health" name="attr_health5_flag" value="7" /> <button type="action" name="act_health5" class="health">k <span class="chequed">k</span> </button> </div> <div class="health-container"> <input type="hidden" class="health" name="attr_health6_flag" value="2" /> <button type="action" name="act_health6" class="health">k <span class="chequed">k</span> </button> </div> <div class="health-container"> <input type="hidden" class="health" name="attr_health7_flag" value="2" /> <button type="action" name="act_health7" class="health bar-divider">k <span class="chequed">k</span> </button> </div> <div class="health-container"> <input type="hidden" class="health" name="attr_health8_flag" value="3" /> <button type="action" name="act_health8" class="health">k <span class="chequed">k</span> </button> </div> <div class="health-container"> <input type="hidden" class="health" name="attr_health9_flag" value="3" /> <button type="action" name="act_health9" class="health bar-divider">k <span class="chequed">k</span> </button> </div> <div class="health-container"> <input type="hidden" class="health" name="attr_health10_flag" value="4" /> <button type="action" name="act_health10" class="health">k <span class="chequed">k</span> </button> </div> <div class="health-container"> <input type="hidden" class="health" name="attr_health11_flag" value="4" /> <button type="action" name="act_health11" class="health bar-divider">k <span class="chequed">k</span> </button> </div> <div class="health-container"> <input type="hidden" class="health" name="attr_health12_flag" value="5" /> <button type="action" name="act_health12" class="health right-cap">k <span class="chequed">k</span> </button> </div> <input type="hidden" name="attr_w1" value="(((@{health1_flag} + @{health2_flag}) + abs(@{health1_flag} - @{health2_flag})) / 2)"/> <input type="hidden" name="attr_w2" value="(((@{health3_flag} + @{health4_flag}) + abs(@{health3_flag} - @{health4_flag})) / 2)"/> <input type="hidden" name="attr_trivial" value="(((@{w1} + @{w2}) + abs(@{w1} - @{w2})) / 2)"/> <input type="hidden" name="attr_w3" value="(((@{health5_flag}*2 + @{health6_flag}*2) + abs(@{health5_flag}*2 - @{health6_flag}*2)) / 2)"/> <input type="hidden" name="attr_light" value="(((@{w3} + @{health7_flag}*2) + abs(@{w3} - @{health7_flag}*2)) / 2)"/> <input type="hidden" name="attr_minor" value="(((@{trivial} + @{light}) + abs(@{trivial} - @{light})) / 2)"/> <input type="hidden" name="attr_moderate" value="(((@{health8_flag}*3 + @{health9_flag}*3) + abs(@{health8_flag}*3 - @{health9_flag}*3)) / 2)"/> <input type="hidden" name="attr_severe" value="(((@{health10_flag}*4 + @{health11_flag}*4) + abs(@{health10_flag}*4 - @{health11_flag}*4)) / 2)"/> <input type="hidden" name="attr_major" value="(((@{moderate} + @{severe}) + abs(@{moderate} - @{severe})) / 2)"/> <input type="hidden" name="attr_nonfatal" value="(((@{minor} + @{major}) + abs(@{minor} - @{major})) / 2)"/> <input disabled type="number" class="wound-mod" name="attr_wounded-mod" value="-1*(((@{nonfatal} + @{health12_flag}*5) + abs(@{nonfatal} - @{health12_flag}*5)) / 2)"/> </div> <div class="health-bar"> <label style="width:96px;text-align:center;padding:0px;font-weight:normal;font-size:10px;border-right: solid 1px;">Trivial</label> <label style="width:72px;text-align:center;padding:0px;font-weight:normal;font-size:10px;border-right: solid 1px;">Light</label> <label style="width:48px;text-align:center;padding:0px;font-weight:normal;font-size:10px;border-right: solid 1px;">Moderate</label> <label style="width:48px;text-align:center;padding:0px;font-weight:normal;font-size:10px;border-right: solid 1px;">Severe</label> <label style="width:32px;text-align:center;padding:0px;font-weight:normal;font-size:10px;">Fatal</label> </div> </div> Sheet worker: <script type="text/worker"> // Register the click handler to all specified buttons. const healthList = ["health1","health2","health3","health4","health5","health6","health7","health8","health9","health10","health11","health12"]; healthList.forEach(function(button) { on(`clicked:${button}`, function() { const flag = `${button}_flag`; // Check the current value of the hidden flag. getAttrs([flag], function(v) { // Update the value of the hidden flag to "1" for checked or "0" for unchecked. setAttrs({ [flag]: v[flag] !== "1" ? "1" : "0" }); }); }); }); </script> CSS .sheet-wound-mod{ font-size:24px; font-weight:bold; color:red; text-align:center; border:none; background-color:transparent; } .sheet-bar-divider{ border-right: solid 1px #FFF !important; } .sheet-left-cap{ border-radius:50% 0% 0% 50%; border-right:none !important; } .sheet-right-cap{ border-radius:0% 50% 50% 0%; } .sheet-health-bar{ display:flex; margin-top:-8px; } /* Configure a container for the health */ .sheet-health-container { display: inline-flex; align-items: center; } button.sheet-health:focus{ outline:0 !important; } /* Configure the button styling. This example makes it look like a checkbox. */ button.sheet-health { padding: 0; border: solid 1px #000; border-left:none; border-right:none; cursor: pointer; background-color:#BDBDBD; width: 24px; height: 24px; display: flex; justify-content: center; align-items: center; font-family:pictos; font-size: 18px; color:#FFF; } .sheet-chequed{ position:absolute; font-family:pictos; color:#FF3300; } /* Hide the "checked" section of the health if the attribute value is not "1". */ input.sheet-health:not([value="1"]) ~ button.sheet-health > span.sheet-chequed { display: none; }