I made an API script for Starfinder to see what CR of creatures are shaken from Intimidate and for how long. It works fine if I call it using a number, like so: !demoralize 20 But I want to call it using a macro that rolls for me, like this: !demoralize [[1d20+@{Dave|intimidate}+?{modifier|0}]] And the script (which will be included below) is not able to find a number in this. I read that I have to use JSON.parser if the message is of the type rollresult. But it is not, the type is "api". And the parser gives an error because of the "!" it contains. (Note that I have very little experience with JavaScript and have never used JSON parser before, and don't really know how.) This is the function: on ( "chat:message" , function (msg) { if ( msg . type == "api" && msg . content . indexOf ( "!demoralize" ) !== - 1 ) { dieRoll = findDieRoll ( msg . content ) sendChat ( msg . who , msg . who + " rolled a " + dieRoll + " to demoralize." ) if ( dieRoll < 16 ) { sendChat ( msg . who , "That's a fail." ) return } var rounds = 1 ; var maxCR = 20 ; while ( dieRoll >= 16 ) { maxCR = Math . floor (( dieRoll - 16 ) / 1.5 ) + 1 ; sendChat ( msg . who , "Creatures of CR **" + maxCR + "** or less are shaken for **" + rounds + "** rounds." ) dieRoll -= 5 ; rounds += 1 ; } } }); (The FindDieRoll function just extracts a number from a string.) log (msg.content) results in: "!demoralize $[[0]]" log (msg) results in: {"content":"!demoralize $[[0]]","inlinerolls":[{"expression":"1d20+24+0","results":{"resultType":"sum","rolls":[{"dice":1,"results":[{"v":15}],"sides":20,"type":"R"},{"expr":"+24+0","type":"M"}],"total":39,"type":"V"},"rollid":"-Md4IAIZ8K3iRf0zR-qV","signature":"46953488a84ac4845ee5661423882c62fb9e9ad565550b7b748f3cc73b0a9667552f00fabdc688ee6731b90766117d396aa2d73a1941097793bfd6747c9c3f6b"}],"playerid":"-MEtffmOWjMRieB0jFW0","type":"api","who":"Liz D. (GM)"} This is the part I seem to need: "total":39 How do I get it?