I have a script that is supposed to get the information from a roll, and modify the character sheet accordingly For normal sections it's pretty easy. I have structured the rolltemplate such that one of the input is the character_id and the other is the name of the attribute to change. However I am not sure how to do it for a repeating sections. The code works really well when a normal session is used, but for repeating sections, I need a way to pass either the number of the repeating section (so I can use $N) or the unique ID. To give you an idea. This is how the call to the rolltemplate in the sheet button looks like value="@{gm_toggle} &{template:rolls} {{characterid=@{character_id}}} {{attribute=nameattribute}}" And this is what the code is supposed to do on('chat:message',(msg)=>{ let msgCopy = _.clone(msg), rollResult,rollRating,attributeToSet,characterID; const rolltype=/rolls/; // name of the template I'm interested in const rollskill=/{{characterid=/; // only the rolls I'm interested in have the characther_id information const patternMatch = /{{characterid=(.+?)}} {{attribute=(.+?)}}/ // this is the regExp to extract the information I need if(rolltype.test(msg.rolltemplate) && rollskill.test(msg.content)){ rollRating=msg.inlinerolls[1].results.total; // the second roll is the total rating rollResult=msg.inlinerolls[2].results.total; // the third roll is the result if (rollResult>rollRating){ // I'm only interested in log('checkmark'); msg.content.replace(patternMatch,(match,cID,attributeToChange)=>{ characterID=cID; attributeToSet=attributeToChange; log(characterID); log(attributeToSet);
// find the object I need...
let obj=findObjs({characerid:characterID,name:attributeToSet},{caseInsensitive:true});
obj.setWithWorker({current:1}); // set the value to 1 on a failure (it's zero if you never failed)
}); } } }); EDIT: I'm thinking more about the problem, one option would probably be to add an hidden value called "fullname" that is populated on ready or on the creation of a new repeating section with the text "repeating_skill_ID_valueIwant". I would prefer to pass something like unique name of the button itself, but if there is no simpler way, I think that could be a workaround