There are bigger issues with those update_functions, and OP would be advised to remove them all and replace them with the simpler approach I illustrated. (I just reread this post - sorry if that sounded curt!) That final function: on("change:repeating_backpackitems", function() {
getSectionIDs("BackpackItems", function(idarray) {
var spaceUsed = 0;
for(var i=0; i < idarray.length; i++) {
getAttrs(["repeating_BackpackItems_" + idarray[i] + "_BackpackItemSpace"], function(value){
spaceUsed = (spaceUsed + value["repeating_BackpackItems_" + idarray[i] + "_BackpackItemSpace"])
});
}
setAttrs({
BackpackSpace: spaceUsed
});
});
});
Should be rewritten more like this (untested, but the structure should be more like this): on("change:repeating_backpackitems", function() {
getSectionIDs("BackpackItems", function(idarray) {
var fieldNames = [];
for(var i=0; i < idarray.length; i++) {
fieldNames.push("repeating_BackpackItems_" + idarray[i] + "_BackpackItemSpace");
}
getAttrs(fieldNames, function(value){
var spaceUsed = 0;
for(var i=0; i < idarray.length; i++) {
spaceUsed = spaceUsed + parseFloat(value["repeating_BackpackItems_" + idarray[i] + "_BackpackItemSpace"])||0;
}
setAttrs({
BackpackSpace: spaceUsed
});
});
});
});
I added parseFloat with a default of 0 onto the attribute, because if it returns a null or NaN, you'll have issues. (Like, if one of the cells is a space, or not a number, the calculation can fail.) PS: i noticed another couple of variable/attribute name issues, such as one function calling AC-att and ACatt, so there's a load of issues scattered through your scripts. Reminder: remove them ALL, and add one at time, getting each working before going on to the next.