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

[Script,Update] RecursiveTable -- Now with Rollable Table Images and better prefixing rules for Roll Templates!

1571361660
The Aaron
Roll20 Production Team
API Scripter
Update v0.2.5 &nbsp;-- Added IconScale option to permit setting the size that icons are displayed at. (Thanks&nbsp; IrishWolf ! ) !rt[showicons|iconlabel:off|iconscale:2.5em] [[2t[Fate-Dice-Composite] ]] Update v0.2.4 &nbsp;-- Rollable Table Item Avatar Images can be shown in the results using the ShowIcons option: !rt[showicons] [[2t[Dice-Of-Fate] ]] The label is the text of the Rollable Table Item name.&nbsp; The label can be turned off with the IconLabel option: !rt[showicons|iconlabel:off] [[2t[Dice-Of-Fate] ]] If your Rollable Table Items contain references to Rollable Tables which contain images, they will be displayed in the label, so turning the label off will prevent showing those recursive results. Additionally, you can now use %% to separate options from their arguments: !rt[showicons%%on|iconlabel%%off] [[2t[Dice-Of-Fate] ]] This is particularly helpful for API Command Buttons, as they would otherwise see the : and treat the command like a URL. Finally, PrefaceUniqueWhitespace now does a better job.&nbsp; Originally, it just stuffed extra spaces in front of everything, but this caused some Roll Templates to break as '&nbsp; &nbsp; &nbsp;spellkey' is not the same as 'spellkey' and would fail to match properly.&nbsp; Now unique keys are individually tracked and prefaced with spaces so that only the ones that actually are duplicated are prefaced. (Thanks&nbsp; Diana P &nbsp;!) Update v0.2.0 &nbsp;-- Completely rewritten recursion engine taking advantage of Promises and lots of error handling. Automated fixing of API sendChat() inline rolls (in most cases). New formatting options. Thanks Scott C. for the ground work on the RollTemplate fix! RecursiveTable provides a way to expand the results of Rollable Tables which have inline rolls within them. Now with options and support for whispering Roll Templates. When using Rolltemplates, your message must have at least one&nbsp; {{ &nbsp;that in not coming from a Rollable Table. When using the&nbsp; PrefaceUniqueSpace &nbsp;option, be sure your&nbsp; {{name=something}} &nbsp;is first. Commands !rt[options] [--help| ... ] Performs all inline rolls, then continues to expand inline rolls (to a default maximum depth of around 10). --help &nbsp;-- Shows the Help screen. ... &nbsp;-- Anything following !rt will be expanded, then sent to to the chat. Options These are inline settings to adjust how the rolls are put together. Options are specified in&nbsp; [ ] &nbsp;right after the&nbsp; !rt : !rt[delimiter:-|maxdepth:20] something Options are separated with the verticle pipe symbol ( | ) and have an optional argument separated by a&nbsp; : . Omitting the argument causes&nbsp; true &nbsp;to be used for switch options, or the default value. All Options are case insenstive. Options are one of 3 types: Number (any integer), Boolean (true values:&nbsp; on ,&nbsp; yes ,&nbsp; y ,&nbsp; true . false values:&nbsp; off ,&nbsp; no ,&nbsp; n ,&nbsp; false ), or text (any value except&nbsp; ] , use&nbsp; \| &nbsp;for&nbsp; | ) MaxDepth &nbsp;-- Specifies the number of recursions to perform.&nbsp; Default: 10 (Number) Delimiter &nbsp;-- A string of text to put between table items. The special value&nbsp; BR &nbsp;will cause html line breaks to be used.&nbsp; Default: , (String) DropEmpty &nbsp;-- Causes empty table items to be dropped before joining with the delimiter.&nbsp; Default: on (Boolean) Sort &nbsp;-- Causes table items to be sorted before being joined by the delimiter. Note that this happens at a single layer of recursion, so if you have table items made of of lists of table items, the sorting will only be at each level.&nbsp; Default: off (Boolean) PrefaceUniqueSpace &nbsp;-- Causes the final message to have a unique number of spaces inserted after each&nbsp; {{ . This is useful if you're building Roll Templates and might have multiple lines with the same label.&nbsp; Default: off (Boolean) ShowIcons &nbsp;-- Causes table items with avatars to display their image.&nbsp; Default: off (Boolean) IconLabel &nbsp;-- Determines if the table items with avatars have their name as a label.&nbsp; Default: on Boolean) IconScale &nbsp;-- When table icons are shown, they are restricted to the provided scale. Any valid CSS size setting will work.&nbsp; Default: 5em) Examples Basic usage, whispering treasure to the gm: !rt /w gm [[1t[treasure-table]]] Whispering a roll template: !rt /w gm &amp;{template:default}{{treasure=[[1t[treasure-table]]]}} Whispering a roll template, with each item on a separate line: !rt[Delimiter:BR] /w gm &amp;{template:default}{{treasure=[[1t[treasure-table]]]}} Whispering a roll template, with each item on a separate line, with empty results replaced by Nothing: !rt[Delimiter:BR|EmptyDefault:Nothing] /w gm &amp;{template:default}{{treasure=[[1t[treasure-table]]]}} Whispering a roll template, with each item on a separate line, with a table that is returning&nbsp; {{label=values}} : !rt[Delimiter:BR|PrefaceUniqueSpace] &amp;{template:default}{{name=Treasure Bundles}}[[5t[treasure-bundle]]] Prior Thread:&nbsp; <a href="https://app.roll20.net/forum/post/5954076/script-update-recursivetables-now-with-rollable-table-images-and-better-prefixing-rules-for-roll-templates" rel="nofollow">https://app.roll20.net/forum/post/5954076/script-update-recursivetables-now-with-rollable-table-images-and-better-prefixing-rules-for-roll-templates</a> Git:&nbsp; <a href="https://github.com/shdwjk/Roll20API/blob/master/Re" rel="nofollow">https://github.com/shdwjk/Roll20API/blob/master/Re</a>... Support my work on If you use my scripts, want to contribute,&nbsp; and have the spare bucks to do so , go right ahead. However, please don't feel like you must contribute just to use them! I'd much rather have happy Roll20 users armed with my scripts than people not using them out of some sense of shame. Use them and be happy, completely guilt-free! Disclaimer:&nbsp; This Patreon campaign is not affiliated with Roll20; as such, contributions are voluntary and Roll20 cannot provide support or refunds for contributions.
1576390174

Edited 1576397135
How would I go about making a table call another table with any given result? And is it possible to remove the command when rolling the same table multiple times? edit: Also this is awesome edit2: okay I figured it out, now my question is how would I make the result show what table it's been rolled from?
1576422176
The Aaron
Roll20 Production Team
API Scripter
You'd need to prefix the row item that calls it with the table name: Potions [[ [[1d3]]t[5e-treasure-potions]]]]]
Would there be a way to display a specific message for each individual table that is called? So if TableA is called it shows MessageA, and if TableB is called it shows MessageB
1576440257
The Aaron
Roll20 Production Team
API Scripter
You would do that on each individual row since you know explicitly which table the row is calling.&nbsp;
So I'm only using [[ t[MasterTable] ]] table once, which means if I give it the prefix TableA if TableB is called it will still display TableA. I'm wondering if there is a way to dynamically change the prefix depending on what table is called.&nbsp; Thank you very much for your assistance btw!!
1576464718
The Aaron
Roll20 Production Team
API Scripter
I'm assuming MasterTable is made of up rows like: [[ [[1d6]]t[TableA] ]] [[ [[1d3]]t[TableB] ]] Which could be modified to: Table A: [[ [[1d6]]t[TableA] ]] Table B: [[ [[1d3]]t[TableB] ]] so as to get labeling specifically when accessing a given subtable.
I am an idiot and you are a saint, I'm having massive amounts of understanding how this all functions.. thank you so much for helping me understand! Absolute legend&nbsp;
1576465390
The Aaron
Roll20 Production Team
API Scripter
Hahahaha, not a problem at all.&nbsp; It seems pretty complex until you really get your head wrapped around it, then it's like "oh!"&nbsp; =D Cheers!
I use this script all the time for my PF1e campaign's loot tables, it's been such a great tool for this! I've been having difficulty using it in my PF2e campaign for some reason. Same exact version (0.2.5), and the latter campaign doesn't have any scripts that the former doesn't. But for some reason every time I use it in this game, it turns every result into '0'. Here's the macro and table I'm trying to use it for: I've tried placing an extra table layer between the macro and this table, I've tried using older versions of the script, and I've tried using the command with another table that has no inline rolls at all. I get only '0' every time. The script works fine in all other games I use it in, so I feel like I'm overlooking something obvious. I appreciate any suggestions you can offer.
1580269368
The Aaron
Roll20 Production Team
API Scripter
It's this bug with Roll20:&nbsp; <a href="https://app.roll20.net/forum/post/6778746/api-sendchat-returns-bad-results-to-callback-with-rollable-tables-expressions-with-inline-rolls" rel="nofollow">https://app.roll20.net/forum/post/6778746/api-sendchat-returns-bad-results-to-callback-with-rollable-tables-expressions-with-inline-rolls</a> You can try changing some of your syntax and maybe get it to work right.&nbsp;
I tried removing all the inline rolls from the table, and it still doesn't work, but the whole reason to use the command is so I could use inline rolls in the table. Does the number of items in the table need to change? Do I need to move where the inline rolls are in each entry? Is there something about the command that needs to be changed? It seems to match the correct syntax. !rt /w gm &amp;{template:rolls} {{header=Random Alchemy}} {{desc= [[1t[P2-H4-Random-Alchemy-Table]]] }} This syntax doesn't work either !rt /w gm [[1t[P2-H4-Random-Alchemy-Table]]] I even tried with a table where each entry is only a single word, all it returns is '0'.
1580354172
The Aaron
Roll20 Production Team
API Scripter
That sounds pretty broken. Maybe it's something new that's wrong. If you want to PM me a link to your game and GM me I can try to figure out what's going on.&nbsp;
Are you using the "Token Fate" script as well? When I had both enabled all I could get from RT was a "0" as well, but disabling "Token Fate" allowed RT to work perfectly. Persephone said: I tried removing all the inline rolls from the table, and it still doesn't work, but the whole reason to use the command is so I could use inline rolls in the table. Does the number of items in the table need to change? Do I need to move where the inline rolls are in each entry? Is there something about the command that needs to be changed? It seems to match the correct syntax. !rt /w gm &amp;{template:rolls} {{header=Random Alchemy}} {{desc= [[1t[P2-H4-Random-Alchemy-Table]]] }} This syntax doesn't work either !rt /w gm [[1t[P2-H4-Random-Alchemy-Table]]] I even tried with a table where each entry is only a single word, all it returns is '0'.
Yes! We worked it out but I didn't mention the fix here. Re-adding TokenFate so that it is installed after this script in your library should allow both to function. Terry McGinn said: Are you using the "Token Fate" script as well? When I had both enabled all I could get from RT was a "0" as well, but disabling "Token Fate" allowed RT to work perfectly.