
Situation: The rules has a penalty to all action rolls equal to the number of wounds taken; so if someone has taken 3 wounds they are at -3. This value can be ignored for a scene by spending a plot die or some power uses. It is also possible that a buff may temporarily increase current wound value resulting in a positive; in this situation the penalty should be set to 0 otherwise it becomes a + to the action roll. I setup a sheetworker where a player can choose to apply the penalty (default) or ignore the penalty (by spending a plot die or using a power) for selecting the minimum value of either a 0 or a negative (wounds - current wounds). The sheetworker also ensures the penalty is either a 0 or negative value and never a positive through Math.min. In the following the scenario of ignore passes through the 0 properly but the scenario of apply is generating a NaN (not a number) error. What is wrong with the following. Structured through tables (<td> removed for brevity) I have: <input type="number" name="attr_Wounds" disabled="true" title="Value: 1 + Vigor Passive Modifier." value="((@{VigorModifier} + @{WoundsMod} + 1))"/> <input type="text" name="attr_WoundNotes"/> <!-- if checked set value equal to the penalty --> <input type="radio" value="((@{CurrentWounds}-@{Wounds}))" checked name="attr_WndPenToUse"/> <span>Apply</span> <!-- if checked set value equal to 0 to ignore the penalty --> <input type="radio" value="0" name="attr_WndPenToUse"/><span>Ignore</span> <!-- manipulate hidden field by sheetworker to ensure the value is either negative or 0; never >0 --> <input type="hidden" name="attr_WoundDiff" value="((@{WndPenToUse}))" /> <!-- set equal to hidden field to prevent a disabled field from being activated (see Roll20 wiki) --> <input type="number" value="((@{WoundDiff}))" disabled="true" name="attr_WoundPenalty" > <script type="text/worker"> // When radio button (wndpentouse) changes, set Wound Penalty (wounddiff input value) to the value from wndpentouse; there are instances when wndpentouse can be positive... in that situation it needs to be 0 on("change:wndpentouse", function() { getAttrs(["wndpentouse", "wounddiff"], function(values) { setAttrs({wounddiff: Math.min(0,values.wndpentouse)}); }); }); Any and all help or suggestions are greatly appreciated!