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 .
×
D&D 2024 has arrived! Pre-order the new core rulebooks now and get an exclusive pre-order bonus for free!
Create a free account

Nested API rollable table

1434995153

Edited 1434995214
DXWarlock
Sheet Author
API Scripter
Doing inline table rolls such as [[1t[Test]]] works in chat. Trying it in API as such: sendChat(msg.who, "[[1t[Test]]]"); throws this error: Could not determine result type of: [{"type":"M","expr":1},{"type":"C","text":"t[Test"}] Does anyone know if this was addressed? Or a work around that still returns and inline result? I found a thread about it here 3 months old: <a href="https://app.roll20.net/forum/post/1669182/help-rol" rel="nofollow">https://app.roll20.net/forum/post/1669182/help-rol</a>...
1435001157
The Aaron
Pro
API Scripter
Try putting spaces around it: [sendChat(msg.who, "[[ 1t[Test] ]]");
1435004271
DXWarlock
Sheet Author
API Scripter
that didnt seem to help, using: sendChat('api', "[[ 1t[Test] ]]"); I get: SyntaxError: Expected "[" or [ |\t] but "1" found.
1435004471

Edited 1435005175
DXWarlock
Sheet Author
API Scripter
Ahh but THIS works just a space after the table: sendChat('api', "[[1t[Test] ]]"); Very strange (well to me, as there is probably a reason that I don't understand behind it). Thank for pointing into a direction to look, I didnt even consider it was a space issue. I was trying eveything and about to make a complicated sendchat roll thing that looked up the table by findObjs and its _rollabletableid:, get total count, random roll a number of that count-1 and return that 'item' as a string.
1435020998
The Aaron
Pro
API Scripter
Brian has a script for that somewhere. You're doing this on Prod, right?
1435021171

Edited 1435021440
DXWarlock
Sheet Author
API Scripter
Yes, its on prod sever. And I didn't need the script to do that, was the only way I could think to cobble together something to return it as just a single entry instead of a /roll result. I believe you helped me on the part of turning the inline result of tables that had like [[1d20]] in the text to a string using a function, so I already had that part. just trying to use the API to return the result using [[ ]] was fighting me.