This will be a 2-step process. First you have to parse the content field of the message to find the roll index, it will look like $[[0]] or similar. Second, you have to find the roll in the inlinerolls field of the message and get the roll. After that, you can do your logic on the value and perform output. Here's what the structure looks like (for a Lich's Melf's Acid Arrow (cuz that was handy...) ): {
"content": " {{attack=1}} {{damage=1}} {{dmg1flag=1}} {{name=Lich}} {{rname=[Melf's Acid Arrow](~-MClN7CxELQc-W2E_Yf8|repeating_npcaction_-MClN7NOh9l-snJSxKxl_npc_dmg)}} {{rnamec=[Melf's Acid Arrow](~-MClN7CxELQc-W2E_Yf8|repeating_npcaction_-MClN7NOh9l-snJSxKxl_npc_crit)}} {{type=[^{attack-u}](~-MClN7CxELQc-W2E_Yf8|repeating_npcaction_-MClN7NOh9l-snJSxKxl_npc_dmg)}} {{typec=[^{attack-u}](~-MClN7CxELQc-W2E_Yf8|repeating_npcaction_-MClN7NOh9l-snJSxKxl_npc_crit)}} {{r1=$[[0]]}} {{always=1}} {{r2=$[[1]]}} charname=Lich",
"inlinerolls": [
{
"expression": "1d20+(12+0)",
"results": {
"resultType": "sum",
"rolls": [
{
"dice": 1,
"results": [
{
"v": 5
}
],
"sides": 20,
"type": "R"
},
{
"expr": "+(12+0)",
"type": "M"
}
],
"total": 17,
"type": "V"
},
"rollid": "-MGic_vUv0Ne515qRJTP",
"signature": "03eb1ac04d061e7850cb996948e399fcf7a3d45e765d1d5ac36cd9d3855015d760af3f3e3068c2427274078fb4f16668ca4b334128568e228270f51c5fe85ba0"
},
{
"expression": "1d20+(12+0)",
"results": {
"resultType": "sum",
"rolls": [
{
"dice": 1,
"results": [
{
"v": 1
}
],
"sides": 20,
"type": "R"
},
{
"expr": "+(12+0)",
"type": "M"
}
],
"total": 13,
"type": "V"
},
"rollid": "-MGic_vUv0Ne515qRJTQ",
"signature": "5b31c9e678f5ba38b7a557fa45945e0f58f4def3ca1aa69afc7ffaa1aa5dd94eca2d75472783cf35d308f39a8d0c411977883a62e614c420641659ae49f9296f"
}
],
"playerid": "-MA-6LlhK58UhtPa2ib7",
"rolltemplate": "npcatk",
"type": "general",
"who": "The Aaron (GM)"
} You can see r1 and r2 are the two rolls for the attack. r1 has index 0 and r2 has index 1, looking at the inline rolls, you can find the v: 5 for the first roll and the v: 1 for the second roll.