Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Unable to trigger change/remove function of repeating section

Hello, I have a very basic inventory thingie made with a repeating section, and I cant figure out why the corresponding change or remove scripts do not execute at all. All my other scripts in my already complex sheet work fine... I am stuck on this one. <fieldset class="repeating_sursoi"> <div class="divTable"> <div class="divTableBody"> <div class="divTableRow"> <div class="divTableCell cell" style="width:75%">   <input type="text" value="" name="attr_sursoi_objet" style="width:100%"/> </div> <div class="divTableCell cell centered">   <input type="number" min="0" step="0.1" value="0" name="attr_sursoi_enc"/> </div> </div> </div> </div> </fieldset> on("change:repeating_sursoi:sursoi_enc remove:repeating_sursoi", function(ev) { console.log("FIRED");   getSectionIDs("repeating_sursoi", function(idarray) {     var attrs = [];     var i;     for (i = 0; i < idarray.length; i++) {       attrs[i] = 'repeating_sursoi_' + idarray[i] + '_sursoi_enc';     }     getAttrs(attrs, function(res) {       var enctot = 0;       for (i = 0; i < attrs.length; i++) {         enctot += parseFloat(res[attrs[i]]);       }       setAttrs({sursoi_enc_total: enctot});     });   }); });
1559130918
GiGs
Pro
Sheet Author
API Scripter
I just tested it, and it works fine for me. I suggest checking the scripts before this one in your block. If there's a major fault in one of them, nothing after them will work.
GiGs said: I just tested it, and it works fine for me. I suggest checking the scripts before this one in your block. If there's a major fault in one of them, nothing after them will work. Yes of course, but all the scripts before that are working fine. So I am stuck here.
The good news is, NOW it's working. Please ignore/erase this topic. No idea what happened. 
1559132753
GiGs
Pro
Sheet Author
API Scripter
There is either a problem with the scripts, or a big with the campaign. Try creating a new campaign, copy the html & css into it, and try it out. If it still doesnt work, you know its almost certainly not a campaign problem.  You can also test by removing ALL other scripts as a test (cut them out, save them somewhere so you can paste them back in). This will let you test this specific script. If it works, add back in your other scripts in batches, and when it stops working again, remove the ones you just added and add them one at a time till you identify which one is breaking. You might have to use more verbose logging to find out where the problem is. In the script above I had log entries to show the worker working, step by step. You may need to do something like this for other scripts to make sure they are working properly, and not just appearing  to work properly. on("change:repeating_sursoi:sursoi_enc remove:repeating_sursoi", function(ev) { console.log("========== REPEATING_SURSOI");   getSectionIDs("repeating_sursoi", function(idarray) {     var attrs = [];     var i;     for (i = 0; i < idarray.length; i++) {         attrs[i] = 'repeating_sursoi_' + idarray[i] + '_sursoi_enc';       console.log("============" + attrs[i]);     }     getAttrs(attrs, function(res) {       var enctot = 0;       for (i = 0; i < attrs.length; i++) {         enctot += parseFloat(res[attrs[i]]);         console.log("============" + enctot);       }       setAttrs({sursoi_enc_total: enctot});     });   }); }); Something that just occurred to me: Do you have multiple script blocks? If so, combine them all into one.
1559132786
GiGs
Pro
Sheet Author
API Scripter
oh well, never mind these tips, lol, but worth keeping in mind of a problem re-occurs.
Thanks a lot GiGs