So, I'm trying to figure out why a Sheet Workers isn't working on a particular character sheet. It seems to be only one character that is having the problem (at least I haven't been able to replicate it on any other character), and the Developer Console is woefully unhelpful (at least for me). So, before I recommend that the player just fill out a new character sheet, I thought I would ask the collective for help in seeing if this is a problem with my Sheet Worker, or if there is something else that may be going on... The Issue : totalloadcarried and encumbrance resolve to NaN when adding weight values to the various forms of equipment. The total weight calculates properly, but the attributes mentioned above, always resolve to NaN. I do use TheAaronSheet sheet worker do do the sums for the various weights. Following the TAS, I have these sheet workers to calculate Load Carried and Encumbrance penalty: //Calculate Total Load Carried
on("sheet:opened change:armortotalweightcarried change:meleetotalweightcarried change:rangedtotalweightcarried change:geartotalweightcarried",function(){
getAttrs(["armortotalweightcarried", "meleetotalweightcarried", "rangedtotalweightcarried", "geartotalweightcarried"], function(lvalue) {
var armor = parseInt(lvalue.armortotalweightcarried);
var melee = parseInt(lvalue.meleetotalweightcarried);
var range = parseInt(lvalue.rangedtotalweightcarried);
var gear = parseInt(lvalue.geartotalweightcarried);
setAttrs({ totalloadcarried: armor + melee + range + gear });
});
});
//Calculate Encumbrance Penalty
on("sheet:opened change:loadlimit change:totalloadcarried change:loadlimit",function(){
getAttrs(["loadlimit", "totalloadcarried"], function(lvalue) {
var load = parseInt(lvalue.totalloadcarried);
if (load === 0) {
load = 1; //If there is no current load, then need to set it to 1, so the result of the calc = 0
}
var limit = parseInt(lvalue.loadlimit);
setAttrs({ encumbrance: Math.floor((limit - load) / limit) });
});
});
As I've said, those seem to work for me and I can't replicate the issue. While on that character, the developer console logs report: I have no idea what that means, so I'm hoping someone here can help me pinpoint where the issue may be. In reviewing the character, I see no values that would cause this to fail (i.e. all the necessary values are numbers, enforced by the character sheet). Short of just adding a new character and moving data over, can anyone help me figure out what's going on? If there is something wrong with the sheet worker scripting, I would like to resolve that, but none of the TAS error capturing stuff is making it to the log and when I can't see anything with with the load limit and encumbrance script. Help, please. :)