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

[Help] Nested rolls from API

1487356762

Edited 1487360859
It would be really emberrasing if I just missed something easy, but I can't figure it out. I'm using complex structure of fables to roll loot using RecursiveTable script and recently I noticed a weird '0' in the output. After quite some digging I pinponted the problem. Apparently nested roll are unfolded differently depending on wether they are posted from chat or from the API. Here's a sample [[6d6*100]] cp, [[3d6*100]] sp, [[2d6*10]] gp, [[[[2d4]]t[ArtObjects25gp]]], [[1t[MagicItemTableG]]] Output if I post it in chat 1900 cp, 1400 sp, 90 gp, Cloth-of-gold vestments (25gp), Weapon +2 Which admittedly still doesn't process nested roll but inlinerolls are recognized correctly. However if I make test script to post it from API: on("chat:message", function(msg) {     'use strict'     if(msg.type == 'api' && msg.content.startsWith('!test')) {        sendChat('','[[6d6*100]] cp, [[3d6*100]] sp, [[2d6*10]] gp, [[[[2d4]]t[ArtObjects25gp]]], [[1t[MagicItemTableG]]]');     } }); Result: 2100 cp, 1000 sp, 70 gp, Gold locket with a painted portrait inside (25gp), 0 Any advise? EDIT: Sample tables for anyone who wants to reproduce: !import-table --_FigurineOfWondrousPower --show !import-table-item --_FigurineOfWondrousPower --Bronze griffon --1 -- !import-table --MagicItemTableG --show !import-table-item --MagicItemTableG --Weapon +2 --11 -- !import-table-item --MagicItemTableG --Figurine of wondrous power <%%91%%><%%91%%>1t<%%91%%>_FigurineOfWondrousPower<%%93%%><%%93%%><%%93%%> --3 -- !import-table-item --MagicItemTableG --Adamantine armor (breastplate) --1 -- !import-table --ArtObjects25gp --show !import-table-item --ArtObjects25gp --Silver ewer (25gp) --1 -- !import-table-item --ArtObjects25gp --Carved bone statuette (25gp) --1 --
You have a type-o in your magicitem table.  You have "MagicItemTablG" but your calling the table "MagicItemTableG"
Thanks for noticing, I fixed it in the post but unfortunatelly it has nothing to do with the issue I described.
1487361171
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hi Roman, This is due to a bug in how sendChat processes inline rolls. It doesn't process them quite the same as the chat parser and it can lead to some weird random funkiness. This issue should be getting fixed in the next update to Recursive Tables whenever Aaron finds time to fully integrate the additions and changes. Aaron and I have investigated this previously (several times) and it's nothing wrong with your table entries. -Scott
1487361325

Edited 1487361464
Ok thanks, I'll be waiting for Recursive Tables update then. But shouldn't it be fixed on Roll20 side though?
The 0 in the output is from the table call that was invalid wasn't it.  when you call a table that does not exist you get 0
Michael S. said: The 0 in the output is from the table call that was invalid wasn't it.  when you call a table that does not exist you get 0 No it wasn't. I had correct name of the table in my game and I just made a mistake when I copy\pasted stuff for the post. Refer to Scotts answer which seem to cover it.
While I was just trying to help and when I run your code (with the correct table name) I get the following: But I understand if you do not want me help.  
1487408943

Edited 1487411998
Michael S. said: But I understand if you do not want me help.   Any help is welcome, this is why I created this post. Did you run it from the API? Try repeating it several times. Reason I'm so unenthusiastic about this is because I spent quite some time around this issue and I'm fairly sertain it's real. Theres definitely a difference in how nested rolls are processed from the chat and from he API and it prevents Rollable Table script form unfolding it correctly.
1487424572
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
I apologize Michael, I should have clarified. By "weird random funkiness", I meant that the occurrence is random, not just that it didn't make sense, which is what has made it such a pain to figure out.