New problem, one, and only one section of this code is not updating properly:
//REAPTING mod value setting
var stats = ['Skill1','Skill2', 'Skill3', 'Skill4', 'Skill5', 'Skill6', 'Skill7', 'Skill8', 'Skill9', 'Skill10', 'Skill11', 'Skill12', 'Skill13', 'Skill14', 'Skill15', 'Skill19', 'Skill17', 'Skill18', 'Skill19', 'Skill20', 'Skill21', 'Skill22'];
stats.forEach(stat => {
'use strict';
on(`change:repeating_${stat}:${stat.toLowerCase()}_Spec_select change:repeating_${stat}:${stat.toLowerCase()}_Spec_mod sheet:opened`, () => {
getAttrs([`repeating_${stat}_${stat}_Spec_select`, `repeating_${stat}_${stat}_Spec_mod`], function(values) {
let setting = {};
setting[`repeating_${stat}_${stat}_Spec_subtotal`] = +values[`repeating_${stat}_${stat}_Spec_select`] + +values[`repeating_${stat}_${stat}_Spec_mod`];
setAttrs(setting);
});
});
on(`change:repeating_${stat}:${stat.toLowerCase()}_Spec_subtotal sheet:opened`, function() {
let dieFromSubtotal = {
'0': 'd0',
'1': 'd2',
'2': 'd4',
'3': 'd6',
'4': 'd8',
'5': 'd10',
'6': 'd12',
'7': 'd12+d2',
'8': 'd12+d4',
'9': 'd12+d4',
'10': 'd12+d8',
'11': 'd12+d10',
'12': 'd12+d12',
'13': 'd12+d12+d2',
'14': 'd12+d12+d4',
'15': 'd12+d12+d6',
'16': 'd12+d12+d8',
'17': 'd12+d12+d10',
'18': 'd12+d12+d12'
};
getAttrs([`repeating_${stat}_${stat}_Spec_subtotal`], function(values) {
let setting = {};
setting[stat] = dieFromSubtotal[values[`repeating_${stat}_${stat}_Spec_subtotal`]]; // Might want to add some defaults here in case something is undefined
setAttrs(setting);
});
});
});
I think, at the very end, "setting[stat]" is suppose to refer to "repeating_${stat}_${stat}" but I don't know how to name it right. Am I making sense?