I have a problem with getting this scripting to work. Here's the code, can you see something I don't? <div class="sheet-col-1-5 sheet-padl">
<div class="sheet-row sheet-sub-header">
<div class="sheet-col-1 sheet-vert-bottom sheet-center sheet-small-label">Spell Points</div>
<div class="sheet-col-1-3 sheet-vert-bottom sheet-center sheet-small-label">Current Points</div>
<div class="sheet-col-1-3 sheet-vert-bottom sheet-center sheet-small-label">Max Points</div>
<div class="sheet-col-1-3 sheet-vert-bottom sheet-center sheet-small-label">Max Spell Lvl</div>
</div>
<hr>
<div class="sheet-row sheet">
<div class="sheet-col-1 sheet-vert-bottom sheet-center sheet-small-label">Bard, Cleric, Druid, Sorcerer, Wizard</div>
<div class="sheet-col-1-3"><input type="number" name="attr_current_spell_slots_l1" value="0" min="0"></div>
<div class="sheet-col-1-3"><input type="number" name="attr_spell_slots_l1" value="0" disabled="disabled"></div>
<div class="sheet-col-1-3"><input type="number" name="attr_spell_slots_l1_max" value="0" disabled="disabled"></div>
</div>
<hr>
<div class="sheet-row sheet">
<div class="sheet-col-1 sheet-vert-bottom sheet-center sheet-small-label">Paladin, Ranger</div>
<div class="sheet-col-1-3"><input type="number" name="attr_current_spell_slots_l2" value="0" min="0"></div>
<div class="sheet-col-1-3"><input type="number" name="attr_spell_slots_l2" disabled="disabled"></div>
<div class="sheet-col-1-3"><input type="number" name="attr_spell_slots_l2_max" disabled="disabled"></div>
</div>
<hr>
<div class="sheet-row sheet">
<div class="sheet-col-1 sheet-vert-bottom sheet-center sheet-small-label">Arcane Trickster, Eldritch Knight</div>
<div class="sheet-col-1-3"><input type="number" name="attr_current_spell_slots_l3" value="0" min="0"></div>
<div class="sheet-col-1-3"><input type="number" name="attr_spell_slots_l3" disabled="disabled"></div>
<div class="sheet-col-1-3"><input type="number" name="attr_spell_slots_l3_max" disabled="disabled"></div>
</div>
</div>
and here are the script workers on("sheet:opened change:level", function() {
getAttrs(["spell_slots_l1", "spell_slots_l1_max", "spell_slots_l2", "spell_slots_l2_max", "spell_slots_l3", "spell_slots_l3_max"], function(value) {
switch(value.level) {
case "1":
setAttrs({
"spell_slots_l1": "4", "spell_slots_l1_max": "1st", "spell_slots_l2": "4", "spell_slots_l2_max": "1st", "spell_slots_l3": "4", "spell_slots_l3_max": "1st"
});
break;
case "2":
setAttrs({
"spell_slots_l1": "6", "spell_slots_l1_max": "1st", "spell_slots_l2": "4", "spell_slots_l2_max": "1st", "spell_slots_l3": "4", "spell_slots_l3_max": "1st"
});
break;
case "3":
setAttrs({
"spell_slots_l1": "14", "spell_slots_l1_max": "2nd", "spell_slots_l2": "6", "spell_slots_l2_max": "1st", "spell_slots_l3": "4", "spell_slots_l3_max": "1st"
});
break;
case "4":
setAttrs({
"spell_slots_l1": "17", "spell_slots_l1_max": "2nd", "spell_slots_l2": "6", "spell_slots_l2_max": "1st", "spell_slots_l3": "6", "spell_slots_l3_max": "1st"
});
break;
case "5":
setAttrs({
"spell_slots_l1": "27", "spell_slots_l1_max": "3rd", "spell_slots_l2": "14", "spell_slots_l2_max": "2nd", "spell_slots_l3": "6", "spell_slots_l3_max": "1st"
});
break;
case "6":
setAttrs({
"spell_slots_l1": "32", "spell_slots_l1_max": "3rd", "spell_slots_l2": "14", "spell_slots_l2_max": "2nd", "spell_slots_l3": "6", "spell_slots_l3_max": "1st"
});
break;
case "7":
setAttrs({
"spell_slots_l1": "38", "spell_slots_l1_max": "4th", "spell_slots_l2": "17", "spell_slots_l2_max": "2nd", "spell_slots_l3": "14", "spell_slots_l3_max": "2nd"
});
break;
case "8":
setAttrs({
"spell_slots_l1": "44", "spell_slots_l1_max": "4th", "spell_slots_l2": "17", "spell_slots_l2_max": "2nd", "spell_slots_l3": "14", "spell_slots_l3_max": "2nd"
});
break;
case "9":
setAttrs({
"spell_slots_l1": "57", "spell_slots_l1_max": "5th", "spell_slots_l2": "27", "spell_slots_l2_max": "3rd", "spell_slots_l3": "14", "spell_slots_l3_max": "2nd"
});
break;
case "10":
setAttrs({
"spell_slots_l1": "64", "spell_slots_l1_max": "5th", "spell_slots_l2": "27", "spell_slots_l2_max": "3rd", "spell_slots_l3": "17", "spell_slots_l3_max": "2nd"
});
break;
case "11":
setAttrs({
"spell_slots_l1": "73", "spell_slots_l1_max": "6th", "spell_slots_l2": "32", "spell_slots_l2_max": "3rd", "spell_slots_l3": "17", "spell_slots_l3_max": "2nd"
});
break;
case "12":
setAttrs({
"spell_slots_l1": "73", "spell_slots_l1_max": "6th", "spell_slots_l2": "32", "spell_slots_l2_max": "3rd", "spell_slots_l3": "17", "spell_slots_l3_max": "2nd"
});
break;
case "13":
setAttrs({
"spell_slots_l1": "83", "spell_slots_l1_max": "7th", "spell_slots_l2": "38", "spell_slots_l2_max": "4th", "spell_slots_l3": "27", "spell_slots_l3_max": "3rd"
});
break;
case "14":
setAttrs({
"spell_slots_l1": "83", "spell_slots_l1_max": "7th", "spell_slots_l2": "38", "spell_slots_l2_max": "4th", "spell_slots_l3": "27", "spell_slots_l3_max": "3rd"
});
break;
case "15":
setAttrs({
"spell_slots_l1": "94", "spell_slots_l1_max": "8th", "spell_slots_l2": "44", "spell_slots_l2_max": "4th", "spell_slots_l3": "27", "spell_slots_l3_max": "3rd"
});
break;
case "16":
setAttrs({
"spell_slots_l1": "94", "spell_slots_l1_max": "8th", "spell_slots_l2": "44", "spell_slots_l2_max": "4th", "spell_slots_l3": "32", "spell_slots_l3_max": "3rd"
});
break;
case "17":
setAttrs({
"spell_slots_l1": "107", "spell_slots_l1_max": "9th", "spell_slots_l2": "57", "spell_slots_l2_max": "5th", "spell_slots_l3": "32", "spell_slots_l3_max": "3rd"
});
break;
case "18":
setAttrs({
"spell_slots_l1": "114", "spell_slots_l1_max": "9th", "spell_slots_l2": "57", "spell_slots_l2_max": "5th", "spell_slots_l3": "32", "spell_slots_l3_max": "3rd"
});
break;
case "19":
setAttrs({
"spell_slots_l1": "123", "spell_slots_l1_max": "9th", "spell_slots_l2": "64", "spell_slots_l2_max": "5th", "spell_slots_l3": "38", "spell_slots_l3_max": "4th"
});
break;
default:
setAttrs({
"spell_slots_l1": "133", "spell_slots_l1_max": "9th", "spell_slots_l2": "64", "spell_slots_l2_max": "5th", "spell_slots_l3": "38", "spell_slots_l3_max": "4th"
});
break;
}
});
});
</script>