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

Recursive Table !rt[Delimiter:BR] help

When I run the following macro in the chat window it isn't breaking apart the results by line, rather it just posts a run-on sentence as shown below. Is there something I'm missing in the code to get it to show each item on a separate line? !rt[Delimiter:BR] /w gm &{template:default} {{name=Random Treasure}}{{You Found=[[[[2d4]]t[250gp-Art]]] 250gp [[[[1d6]]t[MITA]]] Magic item}}
Hiya, I put a pipe character after the BR and it seems fine (had to change the table names obviously!)
Simon G. said: Hiya, I put a pipe character after the BR and it seems fine (had to change the table names obviously!) Thanks Simon, for the response and your suggestion. Unfortunately, even with the pipe after the BR I'm still getting it as a run-on sentence like I shared above.
Your format appears OK since it works for me, stepping back and checking basics, what browser are you using, do you have any add-ons or extensions, have you tried clearing cache or a private browsing window? Just looking to establish whether the cause is outside of the script? What about the tables themselves, have you a snippet?
1708961140

Edited 1708995023
Simon G. said: Your format appears OK since it works for me, stepping back and checking basics, what browser are you using, do you have any add-ons or extensions, have you tried clearing cache or a private browsing window? Just looking to establish whether the cause is outside of the script? What about the tables themselves, have you a snippet? Thank you again, Simon, for following up on my last post. So I'm using Firefox, because I found that it runs smoother than Google does for Roll20. I have tow add-ons; Stylus and Google Translate, but that's it for this browser. I clear the cache and private browsing windows automatically on closing Firefox. As for the tables here's a couple of them and what I'm using as well as the macro Macro: !rt[Delimiter:BR|] /w gm &{template:default} {{name=Random Treasure}}{{You Found=?{Choose|10gp Gems, [[1t[10gp-Gems]]] 10gp|50gp Gems, [[1t[50gp-Gems]]] 50gp|100gp Gems, [[1t[100gp-Gems]]] 100gp|500gp Gems, [[1t[500gp-Gems]]] 500gp|1000gp Gems, [[1t[1000gp-Gems]]] 1000gp|5000gp Gems, [[1t[5000gp-Gems]]] 5000gp|25gp Art, [[1t[25gp-Art]]] 25gp|250gp Art, [[1t[250gp-Art]]] 250gp|750gp Art, [[1t[750gp-Art]]] 750gp|2500gp Art, [[1t[2500gp-Art]]] 2500gp|7500gp Art, [[1t[7500gp-Art]]] 7500gp|Individual Treasure Tier I, [[1t[ITTI]]]|Individual Treasure Tier II, [[1t[ITTII]]]|Individual Treasure Tier III, [[1t[ITTIII]]]|Individual Treasure Tier IV, [[1t[ITTIV]]]|Treasure Horde Tier I, [[1t[THTI]]]|Treasure Horde Tier II, [[1t[THTII]]]|Treasure Horde Tier III, [[1t[THTIII]]]|Treasure Horde Tier IV, [[1t[THTIV]]]} }} Tables: [[6d6*100]] Copper pieces [[3d6*100]] Silver pieces [[2d6*10]] and Gold pieces [[6d6*100]] Copper pieces [[3d6*100]] Silver pieces [[2d6*10]] Gold pieces [[[[2d6]]t[10gp-Gems]]] 10gp [[6d6*100]] Copper pieces [[3d6*100]] Silver pieces [[2d6*10]] Gold pieces [[[[2d4]]t[25gp-Art]]] 25gp [[6d6*100]] Copper pieces [[3d6*100]] Silver pieces [[2d6*10]] Gold pieces [[[[2d6]]t[10gp-Gems]]] 10gp [[[[1d6]]t[MITA]]] [[6d6*100]] Copper pieces [[3d6*100]] Silver pieces [[2d6*10]] Gold pieces [[[[2d4]]t[25gp-Art]]] 25gp [[[[1d6]]t[MITA]]] [[6d6*100]] Copper pieces [[3d6*100]] Silver pieces [[2d6*10]] Gold pieces [[[[2d6]]t[10gp-Gems]]] 10gp [[[[1d4]]t[MITB]]]
1708964292

Edited 1708964352
The Aaron
Roll20 Production Team
API Scripter
This is probably happening because the rolls in: !rt[Delimiter:BR] /w gm &{template:default} {{name=Random Treasure}}{{You Found=[[[[2d4]]t[250gp-Art]]] 250gp [[[[1d6]]t[MITA]]] Magic item}} happen in the client, before it is passed to the API.  If you want to see what the API will see, you can take the ! off the front of an API command, and what goes to chat is what the API has to work with. If you want RecursiveTable to apply to this, you'll probably need the rolls to be in a table.  Assuming you had a table named Treasure1 with 1 roll like this: [[[[2d4]]t[250gp-Art]]] 250gp [[[[1d6]]t[MITA]]] Magic item and called it like this: !rt[Delimiter:BR] /w gm &{template:default} {{name=Random Treasure}}{{You Found=[[1t[Treasure1]]]}} You should get what you are after.
1708996154

Edited 1708996200
The Aaron said: This is probably happening because the rolls in: !rt[Delimiter:BR] /w gm &{template:default} {{name=Random Treasure}}{{You Found=[[[[2d4]]t[250gp-Art]]] 250gp [[[[1d6]]t[MITA]]] Magic item}} happen in the client, before it is passed to the API.  If you want to see what the API will see, you can take the ! off the front of an API command, and what goes to chat is what the API has to work with. If you want RecursiveTable to apply to this, you'll probably need the rolls to be in a table.  Assuming you had a table named Treasure1 with 1 roll like this: [[[[2d4]]t[250gp-Art]]] 250gp [[[[1d6]]t[MITA]]] Magic item and called it like this: !rt[Delimiter:BR] /w gm &{template:default} {{name=Random Treasure}}{{You Found=[[1t[Treasure1]]]}} You should get what you are after. Hi Aaron, So, thanks as always for you help. What I've been trying to do is get this macro !rt[Delimiter:BR|] /w gm &{template:default} {{name=Random Treasure}}{{You Found=?{Choose|10gp Gems, [[1t[10gp-Gems]]] 10gp|50gp Gems, [[1t[50gp-Gems]]] 50gp|100gp Gems, [[1t[100gp-Gems]]] 100gp|500gp Gems, [[1t[500gp-Gems]]] 500gp|1000gp Gems, [[1t[1000gp-Gems]]] 1000gp|5000gp Gems, [[1t[5000gp-Gems]]] 5000gp|25gp Art, [[1t[25gp-Art]]] 25gp|250gp Art, [[1t[250gp-Art]]] 250gp|750gp Art, [[1t[750gp-Art]]] 750gp|2500gp Art, [[1t[2500gp-Art]]] 2500gp|7500gp Art, [[1t[7500gp-Art]]] 7500gp|Individual Treasure Tier I, [[1t[ITTI]]]|Individual Treasure Tier II, [[1t[ITTII]]]|Individual Treasure Tier III, [[1t[ITTIII]]]|Individual Treasure Tier IV, [[1t[ITTIV]]]|Treasure Horde Tier I, [[1t[THTI]]]|Treasure Horde Tier II, [[1t[THTII]]]|Treasure Horde Tier III, [[1t[THTIII]]]|Treasure Horde Tier IV, [[1t[THTIV]]]} }} to pull the from the Treasure Horde Tier I Table (THTI), which has 17 weighted items in the table to roll on the other tables. Note I've also have three other Treasure Horde Tier Tables with weighted items in each table setup much like these items are in the THTI table. [[6d6*100]] Copper pieces [[3d6*100]] Silver pieces [[2d6*10]] Gold pieces [[[[2d6]]t[10gp-Gems]]] 10gp [[[[1d6]]t[MITA]]] [[6d6*100]] Copper pieces [[3d6*100]] Silver pieces [[2d6*10]] Gold pieces [[[[2d6]]t[50gp-Gems]]] 50gp [[[[1d4]]t[MITF]]] I've finally got the macro to work and report back to chat the results. However, now I'm trying to clean up the report in chat. Currently I get the following results, which as you can see doesn't display all of the gems, or magic items if more than one is rolled in chat. I see the others when I hover over the results. I was hoping I might be able to get them to all display like this at least, or in a list rather than a run-on sentence But perhaps I'm asking too much of the API. Honestly I know next to nothing about coding and have been doing most of this stuff by reading at other's scripts and trying to get them to work in my own sandbox and then I export them into my campaigns. PS If you can recommend a book on coding a old fart like me might be able to learn from I'd appreciate that as well.
1709005443
The Aaron
Roll20 Production Team
API Scripter
There are a bunch of tutorials for Javascript out there.&nbsp; I usually send people to&nbsp; <a href="http://jsforcats.com/" rel="nofollow">http://jsforcats.com/</a> &nbsp;because I like cats, but just about any of them should be good for learning the language.&nbsp; Here are a few forum threads that might help: <a href="https://app.roll20.net/forum/post/6605115/namespaces-novice-seeks-help-exploring-the-revealing-module-pattern" rel="nofollow">https://app.roll20.net/forum/post/6605115/namespaces-novice-seeks-help-exploring-the-revealing-module-pattern</a> <a href="https://app.roll20.net/forum/post/6584105/creating-an-object-that-holds-specific-character-dot-id-and-character-name/?pagenum=1" rel="nofollow">https://app.roll20.net/forum/post/6584105/creating-an-object-that-holds-specific-character-dot-id-and-character-name/?pagenum=1</a> <a href="https://app.roll20.net/forum/post/6237754/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/6237754/slug%7D</a> For your table issue, I think it is a question of where the roll is happening.&nbsp; If you want to PM me an invite to your game and GM me, I can come and try to sort it out in situ.