You have several options. If the user used the /roll command (or an alias), the msg.type will be "rollresult" and the msg.content will be a JSON string describing the roll they made. If the user included one or more inline rolls in their message, msg.inlinerolls will be defined, and contain an array of roll data. You can generate the same randomness as a die roll with the randomInteger function. For example, if you need to "roll" 1d20 from the script, you can use var dieValue = randomInteger(20); You can send a complete roll to the dice engine with sendChat , and capture the result by supplying a third parameter to the function. For example: sendChat("Riley", "/roll 1d20+4", function(ops) {
// ops will be an ARRAY of command results.
var rollresult = ops[0];
//Now do something with rollresult, just like you would during a chat:message event...
});