I have a partially working sheet worker, that looks like this function gloryFamous(traitValue) {
var result = 0;
if(traitValue>15) { result = traitValue; }
return result;
}
function GloryFromPassions() {
return function() {
getAttrs(["LoyaltyLiege", "LoveFamily","Hospitality","Honor", "HateSaxons","glory_passions"], function(v) {
var iglory = 0;
iglory = iglory + gloryFamous(parseInt(v.LoyaltyLiege));
iglory = iglory + gloryFamous(parseInt(v.LoveFamily));
iglory = iglory + gloryFamous(parseInt(v.Hospitality));
iglory = iglory + gloryFamous(parseInt(v.Honor));
iglory = iglory + gloryFamous(parseInt(v.HateSaxons));
getSectionIDs("repeating_passions", function(idarray) {
for(var i=0; i < idarray.length; i++) {
//Do something with the IDs
var ID = idarray[i];
getAttrs([
"repeating_passions"+ID+"_passion-value"
],function(values){
iglory = iglory + gloryFamous(parseInt(values["repeating_passions"+ID+"_passion-value"]));
});
}
});
setAttrs({
"glory_passions": iglory
});
});
};
}
on("change:loyaltyliege", GloryFromPassions());
on("change:lovefamily", GloryFromPassions());
on("change:hospitality", GloryFromPassions());
on("change:honor", GloryFromPassions());
on("change:hatesaxons", GloryFromPassions());
on("change:repeating_passions", GloryFromPassions());
The problem is that I dont understand what I'm doing. The getSectionIDs section does nothing.