Pantoufle here's the proto API script I whipped up: on('chat:message',(msg)=>{
log(msg);
let msgCopy = _.clone(msg),
rollResult,attributeToSet,characterID;
const patternMatch = /{{characterid=(.+?)}} {{attribute=(.+?)}} {{roll=\$\[\[(\d+)\]\]}}/,//this will match the rolltemplate text of {{characterid=-ty8U95t}} {{attribute=repeating_sectionName_-J4tlkjasdf90TH-78sR_receptacle}} {{roll=[[xdy]]}}
rollTemplateRegex = /yourRollTemplatesHere|separatedByBars/;//What roll templates we want to act on
if(msg.rolltemplate && rollTemplateRegex.test(msg.rolltemplate)){
msg.content.replace(patternMatch,(match,cID,attributeToChange,rollIndex)=>{
rollResult = msg.inlinerolls[rollIndex].results.total;
characterID = cID;
attributeToSet = attributeToChange;
let attributeObj = findObjs({
type:'attribute',
characterid:characterID,
name:attributeToSet
});
log(`character ID: ${characterID}`);
log(`toSet: ${attributeToSet}`);
log(`result: ${rollResult}`);
log(attributeObj);
if(attributeObj){
attributeObj = attributeObj[0];
attributeObj.set({current:rollResult});
}
});
}
}); And here's the macro I tested it with (note this was in a character sheet less game where I made an attribute called TestAttribute): &{template:yourRollTemplatesHere} {{characterid=@{character_id}}} {{attribute=TestAttribute}} {{roll=[[1d8]]}} And, now for a (probably pretty bad) explanation of what's going on. First we're looking for specific roll templates to respond to so that we can do a quick yay/nay on whether to do more computationally involved process on the message. Second we then look to see if the message has the information we are looking for and extract it if it does (the .replace). The way I set this up, the script is expecting a roll template field that contains the id of the character to affect, a field with what attribute this roll needs to be stored in and a roll field for the roll itself. Keep in mind that the API's parsing of the message does not care at all about what formatting your roll template has on it or which fields are displayed in chat and which ones aren't; it only cares about the raw text of the chat message. The other thing to keep in mind is that the roll results of a message aren't stored directly in the message content; instead references to them are inserted into the content and then there is an array called "inlinerolls" that is part of the msg object that stores all the details on these rolls. Finally, once we've extracted all this information we find the object that is the attribute we want to modify and set it's current value to the value of the roll. Using this protoscript, you should be able to update any attribute's current value with the value of a roll by passing the character id, the name of the attribute you want to affect, and the roll. This includes everything from repeating_section_-yT78Er43-5yU80_roll_storage to strength . You'll just need to do a simple sheetworker to update repeating items with what attribute gets changed from rolls of that item.