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

Display value of roll when rolling on table

September 22 (1 year ago)
Joab
Pro

Is there a way to display the number that is rolled when rolling on a table?

September 22 (1 year ago)

https://app.roll20.net/forum/post/11629292/hook-for-manual-dice-rolling

Yes: 

Roll20 Tricks & Tips thread: Use Manual/In-Person Rolls Within Roll20 (D&D 5E)

September 22 (1 year ago)
Joab
Pro

I don't see the answer there.

What I'm looking for is, when rolling on a table, say the roll is 5. The system returns the text for item 5. I want to also see the value (e.g., 5). How can I do that?

September 22 (1 year ago)

Ah I totally misunderstood what you meant by 'rolling on a table' to mean 'rolling in person with physical dice on a physical table'! :P 

Rollable Tables don't actually have any value associated with items (at least that is exposed to us as players or to Mod scripts). 

Two options:

1. You could add a name to each item to denote which item number it is. Just make sure that you don't put the number at the start of the item, or else Roll20 will assume you only want a numerical result and won't show the rest of the text. E.g. if Item #5 currently looks like this:

You encounter 2 goblins in a forest!

You could do either of these:

(5) You encounter 2 goblins in a forest!
-5 You encounter 2 goblins in a forest!

But not this:

5. You encounter 2 goblins in a forest!

2. The other option is to use Timmaugh's MetaScript Suite (specifically Muler) to create a table that can be rolled on and provide more detailed information, such as the numerical result, or range of numbers that would have resulted in the output (such as rolling in person from the DMG Magic Items table, which lists each item as range.) I'm not savvy with using Muler, but Timmaugh will probably jump in here in a moment with an elegant solution. :)

September 22 (1 year ago)
timmaugh
Forum Champion
API Scripter

You called?

=D

With the latest release, Muler actually doesn't require you to build your table as a mule (a character ability formatted in a particular x=y format every line). It can actually read from Roll20 rollabletables... and, specific to this conversation, can do that with normal inline rolls.

Imagine you have a rollabletable named "Encounters" with a total weight (of all items in the table) of 10. That could be 10 items that are each 1-weight, or 5 items that are each 2-weight, or other variations.

This example shows how to reference items from that table with Muler, and how to reuse the number:

!&{template:default}{{name=Rollable Table Reference}}{{Roll 0=[[1d10]]}}{{Result 0=get.table.Encounters.$[[0]].value/get}}{{Roll 1=[[1d10]]}}{{Result 1=get.table.Encounters.$[[1]].value/get}}{{Roll 3=[[1d10]]}}{{Result 3=get.table.Encounters.$[[2]].value/get}} {&simple}

Scripts Required

Muler, ZeroFrame

September 22 (1 year ago)
Joab
Pro

Actually, what I am looking for is the table index value as a separate variable. Is that what Muler does?

What I have is the following:

!import-table --Panic-Check --show
!import-table-item --Panic-Check --Success --0 --
!import-table-item --Panic-Check --Adrenaline Rush. Increased difficulty of non-violent tasks. Lasts a scene. --1 --
!import-table-item --Panic-Check -- Hyperventilation. Increased difficulty for all tasks. Lasts the rest of the scene. --1 --
!import-table-item --Panic-Check -- Scream. Increase Stress Level by one. Nearby crew members make a Panic Check. --1 --
!import-table-item --Panic-Check -- Crippling Fear. The character is incapacitated for the rest of the scene. 50% chance of gaining a new phobia. Recurring nightmares for 1d6 days. --1 --
!import-table-item --Panic-Check -- Psychotic. Attack the nearest crew member, if there is none attack the environment. Lasts a scene. 50% chance of acquiring a nervous twitch. --1 --
I want to roll values 1-5 (e,g,, 1d5+1), display the value, which updates a bar on the token and a radio button on the character sheet, and display the text value in the chat.
Is this the correct code?
!&{template:default}{{name=Rollable Table Reference}}{{Roll 0=[[1d5]]}}{{Result 0=get.table.Panic-Check.$[[0]].value/get}}
September 22 (1 year ago)
timmaugh
Forum Champion
API Scripter

The verbiage is correct, generally, but I would weight your table slightly differently.

I would give each item a weight of 1 (currently you have Success as a 0-weight, so it would never come up in a Roll20 roll against the table). If you structure your table that way, then yes, every item in the table can be obtained by its index (where the item indices are 1-based).

Then, if I wanted to roll against this table of 6 items, I would use a d6. If I instead wanted to *disallow* the Success result, I would roll 1d5 + 1 (only giving you results 2 through 6).

Finally, to actually see the results of your command line, you need to have ZeroFrame installed and include the {&simple} tag. So, if you modify your table as described, your command line against the whole table would be:

 !&{template:default}{{name=Rollable Table Reference}}{{Roll 0=[[1d6]]}}{{Result 0=get.table.Panic-Check.$[[0]].value/get}}{&simple}

... and if you wanted to disallow the "Success" outcome:

 !&{template:default}{{name=Rollable Table Reference}}{{Roll 0=[[1d5+1]]}}{{Result 0=get.table.Panic-Check.$[[0]].value/get}}{&simple}
September 22 (1 year ago)
Joab
Pro

OK. We're getting somewhere. With the last line above, I get the following output:

How do I get the result to show the text from the table?

September 22 (1 year ago)
timmaugh
Forum Champion
API Scripter

Do you have Muler installed? If you do, then the get.table.Panic-Check.5/get should have resolved to the table results.