In my D&D 3.5 custom sheet I track up to four classes and 52 skills. I am tracking skill points spent by class (for class/cross-class purposes). To display unspent skill points by class (skillpoints01_unspent, skillpoints02_unspent, etc.), I have the following "brute force" sheetworker in my sheet four times (once for each class: class01, class02, etc.). This code works, but it is ugly and I am sure it could be more economical and efficient and have it check each class and skill all in one go, but Javascripting is cross-class for me. :-) I am sure I need to use let and make arrays of the skillnames and an array of class01-class04, and use map and loop through. I also have The Aaron Sheet included and that can probably help make a running total through the loops. For the sample code below I have eliminated most of the skills and listed just for class01 to keep the code brief. Any advice/assistance/suggestions/scriptomancy appreciated! on("sheet:opened change:character_level change:acrobatics_class01_points \
change:appraise_class01_points change:bluff_class01_points change:climb_class01_points \
change:craft1_class01_points change:craft2_class01_points change:craft3_class01_points", function() {
getAttrs(["class01_skillpoints", "acrobatics_class01_points", "appraise_class01_points",
"bluff_class01_points", "climb_class01_points", "craft1_class01_points",
"craft2_class01_points", "craft3_class01_points"], function(values) {
setAttrs({
"skillpoints01_unspent": (parseInt(values["class01_skillpoints"],10) || 0) - (
(parseInt(values["acrobatics_class01_points"],10) || 0) +
(parseInt(values["appraise_class01_points"],10) || 0) +
(parseInt(values["bluff_class01_points"],10) || 0) +
(parseInt(values["climb_class01_points"],10) || 0) +
(parseInt(values["craft1_class01_points"],10) || 0) +
(parseInt(values["craft2_class01_points"],10) || 0) +
(parseInt(values["craft3_class01_points"],10) || 0)
)
});
});
});