I've been getting back into the swing of jscript since I took it for about 2-3ish years during high school (which was about 6 years ago granted) but I am lost on so much when it comes to repeating sections and how they work within roll20. I got the hang of the ID and separated attribute names for calling certain bits as needed and for the most part I've gotten that part of this API to work. It's serving well as a way to relearn jscript as well but one thing I can't seem to get to work in any capacity is _reporder_repeating_<sectionname> and some aspects regarding it. on("change:_reporder:repeating_weapons", function(eventInfo) {
getSectionIDsOrdered("repeating_weapons", function(idarray) {
ID = idarray[0];
getAttrs(["_reporder_repeating_weapons", "EquippedName", "repeating_weapons"+ID+"_WName"], function(v) {
setAttrs({
EquippedName: v["repeating_weapons"+ID+"_WName"]
});
});
});
}); Some searching around and attempting to figure out how to get it so that when the order of the repeating_weapons section is changed by moving stuff around it'll automatically change a readonly input field I have to match the name of it elsewhere on the sheet. I did find this but I'm not sure I quite understand what its even doing. var getSectionIDsOrdered = function (sectionName, callback) {
'use strict';
getAttrs([`_reporder_${sectionName}`], function (v) {
getSectionIDs(sectionName, function (idArray) {
let reporderArray = v[`_reporder_${sectionName}`] ? v[`_reporder_${sectionName}`].toLowerCase().split(',') : [],
ids = [...new Set(reporderArray.filter(x => idArray.includes(x)).concat(idArray))];
callback(ids);
});
});
}; Other aspects of the repeating section works, if I were to instead change it to change:repeating_weapons with the same code shown in the topmost code snip it updates the name of the EquippedName attribute just fine. As a work-around I also tried to do it with a button, setting it up near but not inside of the repeating_weapons fieldset. Even using clicked:equip which was the name of it, act_equip it didn't actually do anything. It seemed like the action part of the button just failed overall. Looking through the wiki it even tells me to use this as a basis but it's gotten me nowhere. on ( "change:_reporder:<sectionname>" , function (eventInfo) {
// Where <sectionname> above should be a repeating section name, such as skills or spells
}); Any help would be greatly appreciated.