
Hey guys... again :P Still trying to get my head around Sheet Workers. I am trying my hand at a piece of code that will generate an attribute of /1 or /2 depending on one input box being equal to or less than another. Here is what I have so far: on("sheet:opened change:hp", function() {
getAttrs(["wound_threshold","hp"], function(values) {
let wound_threshold = parseInt(values.wound_threshold)||0;
let hp = parseInt(values.hp)||0;
if (wound_threshold >= hp) {
wound_mod = "/2";
} else if (wound_threshold <= hp) {
wound_mod = "/1";
}
setAttrs({
"wound_mod":wound_mod
});
});
}); Anybody able to point out what I did wrong? Apologies if the code is utterly offensive to some of you. I took it from elsewhere I tried my hand at working with it. EDIT: Corrected a typo in the code, wasn't what seems to be the issue, however.