This topic is aimed at the Mighty Aaron and his wonderfull TAS script, but perhaps others could help or be interested by this. I've got an API script that help create characters (no copyright infrigement, it's for a free french retroclone, and I'm working with game's author on this). As repeating sections can't be handled through the API (unless I'm mistaken) and following a suggestion by Aaron, my API script puts a JSON string in an hidden attribute, containing the base equipments/inventory. This string is then processed by a sheet worker on the sheet:opened event, and it creates the inventory lines. Then it empties the JSON string Then it calls TAS.repeatingSimpleSum to tally the encumbrance Then it calls another function of mine to use the total encumbrance to calculate and sets movement rates (and this doesn't work). Basically it's doing this : on('sheet:opened',function(){
getAttrs(["todoequip"], function(values) {
if(values.todoequip.length > 0){ // there is an equipment JSON string list to process
// Do stuff with the JSON string to add repeating_equipement (equipment items)
// use setAttrs to empty the todoequip attribute
TAS.repeatingSimpleSum('equipement','equippoidstot','encombrement'); // THIS WORKS : tally the encumbrance in the 'encombrement' attribute
PMT.majEncombrement(); //DOESN'T WORK : my function that sets movement rates based on the total encumbrance ('encombrement' attribute)
}
});
}); Then, I've got other events that use the same function / logic, but it works : on("change:repeating_equipement:equipqte change:repeating_equipement:equippoids", function() {
getAttrs(["repeating_equipement_equipqte", "repeating_equipement_equippoids"], function(values) {
//DO STUFF WITH ITEM
});
TAS.repeatingSimpleSum('equipement','equippoidstot','encombrement'); //tally the encumbrance in the 'encombrement' attribute
});
});
on('remove:repeating_equipement',function(){
TAS.repeatingSimpleSum('equipement','equippoidstot','encombrement'); tally the encumbrance in the 'encombrement' attribute
});
on("change:encombrement", function() { // the total encumbrance has changed
PMT.majEncombrement(); //THIS WORKS : my function that sets movement rates based on the total encumbrance ('encombrement' attribute)
});
I don't get why the encumbrance total is correctly calculated on the sheet:opened event, but my function PMT.majEncombrement() doesn't appear to anything, while it's working on the change:encombrement event. Any idea ?