So I'm working on creating a custom sheet which has "Hitpoint" markers (icons). A character can only have a max of 10 and right now it shows all 10 by default, but I would like it so that when I change the value of the hitpoints it "hides" excess markers. I do have console.log statements in the worker script, and I do see it getting set. I even retrieve the value after setting, and it is returning the proper "hideme" values, but they are not "hiding". If I do manually set the input value (in the browser) during live session, it does hide the icon so I know the CSS is working. This is what it currently shows: This is what I would like it to show once I enter in a value of 5. Source HTML: <div class="sheet-hitpoints">
<div class="sheet-radiobutton-tracker">
<input type="checkbox" class="sheet-life" name="attr_bodyHits0" value="showme0" /><label for="attr_bodyHits0"></label>
<input type="checkbox" class="sheet-life" name="attr_bodyHits1" value="showme1" /><label for="attr_bodyHits1"></label>
<input type="checkbox" class="sheet-life" name="attr_bodyHits2" value="showme2" /><label for="attr_bodyHits2"></label>
<input type="checkbox" class="sheet-life" name="attr_bodyHits3" value="showme3" /><label for="attr_bodyHits3"></label>
<input type="checkbox" class="sheet-life" name="attr_bodyHits4" value="showme4" /><label for="attr_bodyHits4"></label>
<input type="checkbox" class="sheet-life" name="attr_bodyHits5" value="showme5" /><label for="attr_bodyHits5"></label>
<input type="checkbox" class="sheet-life" name="attr_bodyHits6" value="showme6" /><label for="attr_bodyHits6"></label>
<input type="checkbox" class="sheet-life" name="attr_bodyHits7" value="showme7" /><label for="attr_bodyHits7"></label>
<input type="checkbox" class="sheet-life" name="attr_bodyHits8" value="showme8" /><label for="attr_bodyHits8"></label>
<input type="checkbox" class="sheet-life" name="attr_bodyHits9" value="showme9" /><label for="attr_bodyHits9"></label>
</div>
</div> Source CSS: (when I manually set the input.values it does hide/show them. .sheet-hitpoints .sheet-radiobutton-tracker input[value^="showme"] + label {
display: inline-block;
}
.sheet-hitpoints .sheet-radiobutton-tracker input[value^="hideme"] + label {
display: none;
}
Worker Script: on("change:hitpoints ", function(eventInfo) {
let hpValue = eventInfo.newValue;
let index = 0;
hitPointIcons.forEach(iconName => {
if (index++ < hpValue) {
setAttrs({
iconName: "showme"
});
} else {
setAttrs({
iconName: "hideme"
});
}
});
});