
I am attempting to create a sheet worker which will auto fill several modifiers from the base ability scores. The ability scores come in two parts whole and fractional so a typical strength might be Strength 14 Fractional 22 (each are in their own field with their own name) and some ability scores require both of them to calculate certain values. I am following an example in this link <a href="https://app.roll20.net/forum/post/8401671/how-to-autofill-a-field-by-table-lookup-of-attribute/?pageforid=8403979#post-8403979" rel="nofollow">https://app.roll20.net/forum/post/8401671/how-to-autofill-a-field-by-table-lookup-of-attribute/?pageforid=8403979#post-8403979</a> If possible, I just want to figure out how to get if/then statements to work first, then when I get my feet under me I can preform some maths to make it simpler. Here is the attributes <div class="sheet-col-1-16"><input type="text" name="attr_strength"/></div> <div class="sheet-col-1-16"><input type="text" name="attr_strength_fractional"/></div> <div class="sheet-col-1-12"><input type="number" name="attr_strength_damage_mod" value="0"/></div> <div class="sheet-col-1-12"><input type="number" name="attr_feat_of_strength" value="0"/></div> Here is my sheet worker const int = score => parseInt(score) || 0; on("change:strength change:strength_fractional sheet:opened", function() { getAttrs(["strength","strength_fractional"], function(values) { const str = int(values._strength); const strfrac = int(values.strength_fractional); let strtot = siz + strfrac*.1; console.log(strtot); let strength_damage_mod = 0; if (strtot <= 1.50) strength_damage_mod = -7; else if (strtot <= 2.50) strength_damage_mod = -6; else if (strtot <= 3.50) strength_damage_mod = -5; else if (strtot <= 5.00) strength_damage_mod = -4; else if (strtot <= 6.50) strength_damage_mod = -3; else if (strtot <= 8.00) strength_damage_mod = -2; else if (strtot <= 10.0) strength_damage_mod = -1; else if (strtot <= 12.00) strength_damage_mod = 0; else if (strtot <= 14.00) strength_damage_mod = 1; else if (strtot <= 15.50) strength_damage_mod = 2; else if (strtot <= 17.00) strength_damage_mod = 3; else if (strtot <= 18.50) strength_damage_mod = 4; else if (strtot <= 19.50) strength_damage_mod = 5; else if (strtot <= 20.50) strength_damage_mod = 6; else strength_damage_mod = 7; setAttrs({ feat_of_strength: feat_of_strength }); }); }); I also have a question, since Str has several modifiers (damage and feat of strength) when I get both the if/then stuff worked out would the set attribute structure look like this? setAttrs({ strength_damage_mod: strength_damage_mod; feat_of_strength: feat_of_strength