If I save the sum as an attribute and I repeat the same function for every change (so instead of a compound on("change:x change:y ... I make a different event caller with the same function inside) it seems to work, but it doesn't when I use variables defined in the script. The code should just look if the different checkbox are checked (each one has value one) and if their sum is greater than 2 (this version of the code is simplified cause I wanted to print out in the box the result to check. <code> let checkstim=['stim1_chk','stim2_chk','hardstim1_chk','hardstim2_chk','exhaustion_chk']; on(checkstim.map(str => `change:${str}`).join(' '),function(){ getAttrs(checkstim,function(v){ let sum=0; for(let i=0;i<v.length;i++){ sum+=(parseInt(v[`${checkstim[i]}`],10) || 0); } setAttrs({stim_chk: sum}); }); }); </code> Also it would be useful to create the program in this form because for every checkbox I have a value with hidden modifier number, the norm of the product of the two vector (sum(chk*values), with check being 0 if unchecked and 1 if checked) would give me the total modifier for my rolls. I could write a function for each on("change:mod_chk") but it would took forever and it would be almost impossible to debug if I change samething. Please I'm desperate