Sorry, the rollresult 's msg.content needs to be parsed, but msg.inlinerolls does not. [{"v":11}] is an array (length 1) containing an object with a single property (v) with the value 11. message.rolls[0].results[0]['v'] should be the number 11 in that scenario. Here's an example from typing /r 3d7+10 , with some line breaks and comments thrown in {
"type":"V",
"rolls":
[
{
"type":"R",
"dice":3, // 3 dice
"sides":7, // which were d7s
"mods":{},
"results":[{"v":6},{"v":2},{"v":3}] // rolled a 6, 2, and 3
},
{
"type":"M",
"expr":"+10" // Added 10 to the 3d7
}
],
"resultType":"sum",
"total":21
}
Contrast that with /r [[2d5]]d6+d20 {
"type":"V",
"rolls":
[
{
"type":"R",
"dice":5, // the 2d5 totalled 5, see below
"sides":6, // 5d6
"mods":{},
"results":[{"v":4},{"v":4},{"v":5},{"v":4},{"v":5}] // rolled 4, 4, 5, 4, 5
},
{
"type":"M",
"expr":"+" // Add the previous roll with the next one
},
{
"type":"R",
"dice":1,
"sides":20, // 1d20
"mods":{},
"results":[{"v":17}] // rolled a 17
}
],
"resultType":"sum",
"total":39
}
The 2d5 was stored in msg.inlinerolls : {
"expression":"2d5",
"results":
{
"resultType":"sum",
"rolls":
[
{
"dice":2, // rolled 2 dice
"results":[{"v":4},{"v":1}], // rolled 4 and 1
"sides":5, // rolling d5s
"type":"R"
}
],
"total":5,
"type":"V"
}
}
As you can see, the information you get from the dice roller can be comlicated, and these examples didn't even delve into things like comparison operators, rerolls, grouping, keep high/low, etc. If you've got some more specific needs for your script, it's easier, but trying to handle all cases is difficult, to say the least. Fortunately, you won't ever have to deal with queries in your script, since those are processed before control is passed on to the API, so you don't have to worry about them.