
Hello! I'm running into an issue with a character sheet I'm designing and a sheet worker to calculate a stat based on its base times a multiplier. However, it doesn't seem like the default values I placed in the attribute fields are being used when I update the base value, so even though the character sheet may say, for example, 3 × 1, the sheet worker doesn't update the field to display the expected value (3). HTML: <span class="sheet-charstats">
<input class="sheet-base" name="attr_strength" type="number" min="0" step="1" value="0" />
</span>
<span class="sheet-charformula">
<input class="sheet-base" name="attr_strength_base" type="number" min="0" step="1" value="0" />
×<input class="sheet-base" name="attr_strength_multi" type="number" min="0" step="0.1" value="1" />
</span>
Worker: on("change:strength_base, change:strength_multi", function(eventInfo) {
getAttrs(["strength_base", "strength_multi"], function(values) {
var base = parseInt(values["strength_base"]);
var multi = parseFloat(values["strength_multi"]);
setAttrs({
strength: Math.ceil(base * multi)
});
});
});
I'm not sure what I'm doing wrong. Any assistance would be greatly appreciated. Thank you for your time! Edit: Tried to search the forum for search terms like "Sheet Worker Default Values" but didn't see any solution in code, so I wasn't sure where to turn. Apologies if this has been answered multiple times before. Edit 2: Also forgot to note I did try the below as well to no avail. Trying to debug with console.log also seemed to get nowhere when checking these values. I received no output in the browser's JS console. var base = parseInt(values["strength_base"]) || 0;
var multi = parseFloat(values["strength_multi"]) || 1;