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 Tables Question: Roll on a table, use the results to roll on other tables?

November 11 (1 year ago)

I've just begun to dip my toes into RT and I'm in over my head already.  Treading water, but starting to flail about...  Okay, enough swimming/drowning metaphors.

I've searched the forum and dug into videos and other postings, but I feel like I'm going in circles now and it might be better to just ask, so here goes:

I have a set of tables for looting bodies.  LTB-1 is a "roll 2d6 to determine what loot table(s) to look at" table.  LTB-2 through LTB-12 are the various tables that I want to pull my loot from.

I've managed to get a command to roll on LTB-1 and give me an output of the results:  

!rt[Delimiter:BR] /w gm &{template:default}{{name=Loot The Body}} {{[[ [[1d5+2]]t[LTB-1] ]]}}

Is there a way that I can have RT roll from those other tables for me directly from the result of the initial roll?  I know I can set up chat buttons and click on the appropriate LTB-* buttons, but I'm hoping to just hit one "Loot The Body" button and get my loots.

Is this possible, and if so, can someone explain it like I'm 5?

November 11 (1 year ago)

Edited November 11 (1 year ago)

What is the content of the LTB-1 table? The output of the first table needs to be a roll itself. Here's how you can set it up:


LTB-Tables

[[1t[LTB-1]]]
[[1t[LTB-2]]]
[[1t[LTB-3]]]
[[1t[LTB-4]]]
...

If you don't want all of the tables to have an equal chance of being picked, then you just need to weight each item accordingly.

LTB-1

Table 1 Loot Item 1
Table 1 Loot Item 2
Table 1 Loot Item 3
Table 1 Loot Item 4
...

LTB-2

Table 2 Loot Item 1
Table 2 Loot Item 2
Table 2 Loot Item 3
Table 2 Loot Item 4
...

Then the code for your macro will be:

!rt[Delimiter:BR] /w gm &{template:default} {{name=Loot The Body}} {{[[ [[1d5+2]]t[LTB-Tables] ]] }}

or for the D&D 5E sheet:

!rt[Delimiter:BR] /w gm &{template:npcaction} {{rname=Loot The Body}} {{description= [[ [[1d5+2]]t[LTB-Tables] ]] }}



You could also forgo the 'LTB-Tables' table altogether (replace the 1d4 with the number of LTB tables you have) - this only works if you want each table to have an equal chance of being picked:

!rt[Delimiter:BR] /w gm &{template:default} {{name=Loot The Body}} {{[[[[1d5+2]]t[LTB-[[1d4]]]]]]}}
!rt[Delimiter:BR] /w gm &{template:npcaction} {{rname=Loot The Body}} {{description=[[[[1d5+2]]t[LTB-[[1d4]]]]]]}}
November 11 (1 year ago)

Jarren,

The content of LTB-1 is (was) the names of the other tables.  I modified it to the rolls as shown here and it works exactly how I was hoping.  Thank you!

The suggestion at the end, to "...forgo the 'LTB-Tables' table altogether (replace the 1d4 with the number of LTB tables you have)" didn't work for me.  It returned the table names but not the loot rolled from those tables.  Not too sure why that is, but I'm happy with the first solution, so again:  Thank you!


Jarren said:

What is the content of the LTB-1 table? The output of the first table needs to be a roll itself. Here's how you can set it up:


LTB-Tables

[[1t[LTB-1]]]
[[1t[LTB-2]]]
[[1t[LTB-3]]]
[[1t[LTB-4]]]
...

LTB-1

Table 1 Loot Item 1
Table 1 Loot Item 2
Table 1 Loot Item 3
Table 1 Loot Item 4
...

LTB-2

Table 2 Loot Item 1
Table 2 Loot Item 2
Table 2 Loot Item 3
Table 2 Loot Item 4
...

Then the code for your macro will be:

!rt[Delimiter:BR] /w gm &{template:default} {{name=Loot The Body}} {{[[ [[1d5+2]]t[LTB-Tables] ]] }}

or for the D&D 5E sheet:

!rt[Delimiter:BR] /w gm &{template:npcaction} {{rname=Loot The Body}} {{description= [[ [[1d5+2]]t[LTB-Tables] ]] }}



You could also forgo the 'LTB-Tables' table altogether (replace the 1d4 with the number of LTB tables you have):

!rt[Delimiter:BR] /w gm &{template:default} {{name=Loot The Body}} {{[[[[1d5+2]]t[LTB-[[1d4]]]]]]}}
!rt[Delimiter:BR] /w gm &{template:npcaction} {{rname=Loot The Body}} {{description=[[[[1d5+2]]t[LTB-[[1d4]]]]]]}}





November 11 (1 year ago)

Eponymous said:

The suggestion at the end, to "...forgo the 'LTB-Tables' table altogether (replace the 1d4 with the number of LTB tables you have)" didn't work for me.  It returned the table names but not the loot rolled from those tables.  Not too sure why that is, but I'm happy with the first solution, so again:  Thank you!

Hmm you're right. For some reason that is only returning a value of '1' for the innermost '1d4' roll. But adding a '+0' works for some reason (I'm sure there's some parsing logic within RecursiveTables that is coming in to play):

!rt[Delimiter:BR] /w gm &{template:default} {{name=Loot The Body}} {{[[[[1d5+2]]t[LTB-[[1d4+0]]]]]]}}
!rt[Delimiter:BR] /w gm &{template:npcaction} {{rname=Loot The Body}} {{description=[[[[1d5+2]]t[LTB-[[1d4+0]]]]]]}}
November 12 (1 year ago)

That also works for me.  I may use this method for my next batch of loot tables.  Thanks for sorting this out for me!

Jarren said:

Eponymous said:

The suggestion at the end, to "...forgo the 'LTB-Tables' table altogether (replace the 1d4 with the number of LTB tables you have)" didn't work for me.  It returned the table names but not the loot rolled from those tables.  Not too sure why that is, but I'm happy with the first solution, so again:  Thank you!

Hmm you're right. For some reason that is only returning a value of '1' for the innermost '1d4' roll. But adding a '+0' works for some reason (I'm sure there's some parsing logic within RecursiveTables that is coming in to play):

!rt[Delimiter:BR] /w gm &{template:default} {{name=Loot The Body}} {{[[[[1d5+2]]t[LTB-[[1d4+0]]]]]]}}
!rt[Delimiter:BR] /w gm &{template:npcaction} {{rname=Loot The Body}} {{description=[[[[1d5+2]]t[LTB-[[1d4+0]]]]]]}}