Sheet Workers: on("change:str sheet:opened", function() {
getAttrs(["str"], function(values) {
setAttrs({
str_mod_hidden: Math.floor(values.str/2 - 5)
});
});
});
on("change:con sheet:opened", function() {
getAttrs(["con"], function(values) {
setAttrs({
con_mod_hidden: Math.floor(values.con/2 - 5)
});
});
});
on("change:dex sheet:opened", function() {
getAttrs(["dex"], function(values) {
setAttrs({
dex_mod_hidden: Math.floor(values.dex/2 - 5)
});
});
});
on("change:int sheet:opened", function() {
getAttrs(["int"], function(values) {
setAttrs({
int_mod_hidden: Math.floor(values.int/2 - 5)
});
});
});
on("change:wis sheet:opened", function() {
getAttrs(["wis"], function(values) {
setAttrs({
wis_mod_hidden: Math.floor(values.wis/2 - 5)
});
});
});
on("change:cha sheet:opened", function() {
getAttrs(["cha"], function(values) {
setAttrs({
cha_mod_hidden: Math.floor(values.cha/2 - 5)
});
});
});
on("change:str_mod change:con_mod sheet:opened", function() {
getAttrs(["str_mod", "con_mod"], function(values) {
let str_mod = parseInt(values.str_mod)||0;
let con_mod = parseInt(values.con_mod)||0;
let abil = Math.max(str_mod, con_mod);
setAttrs({
fort_abil_hidden: abil
});
});
});
on("change:dex_mod change:int_mod sheet:opened", function() {
getAttrs(["dex_mod", "int_mod"], function(values) {
let dex_mod = parseInt(values.dex_mod)||0;
let int_mod = parseInt(values.int_mod)||0;
let abil = Math.max(dex_mod, int_mod);
setAttrs({
ref_abil_hidden: abil
});
});
});
on("change:wis_mod change:cha_mod sheet:opened", function() {
getAttrs(["wis_mod", "cha_mod"], function(values) {
let wis_mod = parseInt(values.wis_mod)||0;
let cha_mod = parseInt(values.cha_mod)||0;
let abil = Math.max(wis_mod, cha_mod);
setAttrs({
will_abil_hidden: abil
});
});
});
const groups = ['basic', 'lesser', 'greater', 'feature', 'item', 'other'];
groups.forEach(function (group) {
const texts = ['attack_hit_', 'attack_crit_', 'attack_miss_', 'attack_effect_', 'attack_maintain_', 'attack_special_'];
texts.forEach(function (text) {
on("change:repeating_" + group + ":" + text + group + " sheet:opened", function () {
usText = "repeating_" + group + "_" + text + group
getAttrs([usText], function (values) {
setAttrs({
[usText + '_noroll']: values[usText].split("[[").join("").split("]]").join("")
});
});
});
});
}); The first six sheetworkers set an ability modifier based on an ability score. They are working as intended as far as I can tell. The next three are new, and pick the higher of two abilities to use in calculating the Fortitude, Reflex, and Will defenses. I've tried three different variations, listed below. That last one is something complicated and mostly unrelated: there can be text in 'repeating_basic_attack_hit_basic' which references the six ability modifiers above, but those are the only things that would feed into that sheetworker. HTML Input Code: <input type="number" name="attr_fort_abil" value="((@{str_mod} + @{con_mod}) + abs(@{str_mod} - @{con_mod})) / 2" disabled="true"/> <input type="number" name="attr_ref_abil" value="@{ref_abil_hidden}" disabled="true"/>
<input type="hidden" name="attr_ref_abil_hidden" value="0"/> <input type="number" name="attr_will_abil" value="@{will_abil_hidden}" disabled="true"/> The Fortitude input doesn't use the sheetworker, it just does an auto-calc. It appears to be working fine. The Reflex input is disabled and takes the value of the hidden field updated by the sheetworker. It doesn't appear to work at all, now that I've tested it on other characters. The Will input is disabled and takes the value of the hidden attribute updated by the sheetworker, which does not have a field of its own. It also doesn't appear to work at all.