Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Fuller inline roll documentation or clarification of processinlinerolls?

I'm working with the ProcessInlineRolls function from the cookbook, and am I bit baffled by this line: function processInlinerolls (msg) { if (_. has (msg,'inlinerolls')){ return _. chain (msg.inlinerolls) . reduce ( function (m,v,k){ var ti = _. reduce (v.results.rolls, function (m2,v2){ if (_. has (v2,'table')){ The only documentation I can find on the format of inline rolls is on the API:Chat documentation page. But it does not show any circumstance in which a results member itself somehow has a rolls member, nor when that has a table member. Is there a full specification anywhere?
1598307322
GiGs
Pro
Sheet Author
API Scripter
Sadly there's no full spec anywhere - as far as I know, the only way to figure out the full inline roll possibilities is to create different rolls and log the results, and examine them.  You're looking at the second example of the processinlinerolls function, and that one handles rollable table results. Thats what the table and tableitem parts are for. 
I get that's what table is for, but it's the v.results.rolls that gets me . That implies rolls is a child of results, whereas in all the examples, it's a sibling.
1598310115
GiGs
Pro
Sheet Author
API Scripter
Thats a good point. I have seen in results as both a child and sibling of rolls, but cant remember seeing rolls as a child of results. 
1598374157
The Aaron
Roll20 Production Team
API Scripter
An inline roll object at the top level has the expression that was rolled, a roll id and signature , and a results field containing all the rolls.  Within the results field, there is a result type , total , type and an array of rolls .  Each roll is specific to a number of dice of the same size rolled together and contains the number of dice rolled, the number of sides it has, a type , and an array of results containing individual rolls. Inline Roll Example: {    "content": "!! $[[0]]",    "inlinerolls": [       {          "expression": "1d20",          "results": {             "resultType": "sum",             "rolls": [                {                   "dice": 1,                   "results": [                      {                         "v": 16                      }                   ],                   "sides": 20,                   "type": "R"                }             ],             "total": 16,             "type": "V"          },          "rollid": "-MFaV1E0rug5LEQyETlT",          "signature": "471a8c599e2e5551c00b24d6c58772b71fa9db4f199aa262a01442cf9f151869ad9dad4aa94bc2c6482c78515b0c9811bcbb613f6decae914a32c3cf9f5b7a14"       }    ],    "playerid": "-MA-6LlhK58UhtPa2ib7",    "type": "api",    "who": "The Aaron (GM)" } Rollable Table Example: {    "content": "!! $[[0]]",    "inlinerolls": [       {          "expression": "1t[wgd6]",          "results": {             "resultType": "sum",             "rolls": [                {                   "dice": 1,                   "results": [                      {                         "tableItem": {                            "avatar": "",                            "id": "-MCSKLokGK29dieBU_RG",                            "name": "0 [3]",                            "weight": 1                         },                         "tableidx": 3,                         "v": 0                      }                   ],                   "sides": 6,                   "table": "wgd6",                   "type": "R"                }             ],             "total": 0,             "type": "V"          },          "signature": false       }    ],    "playerid": "-MA-6LlhK58UhtPa2ib7",    "type": "api",    "who": "The Aaron (GM)" }