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

Rolling for loot! Understanding that If/Then statements are not possible, can I write a macro that knows to roll certain dice after certain results

October 13 (2 years ago)

Edited October 13 (2 years ago)

I'm new to roll 20 macros, but was hoping to make it easier for my players to roll loot. 


Currently, I have a big, multi pag, excel worksheet with different categories of items. When my players are rolling for loot it goes something like this:


"ok, roll d100"

"25... cool, that's a mundane item... now roll a d13"

"3... nice, that's a tool... now roll a d20"

"11.... nice you got some Mason's tools"


its fine, but requires a lot of back and forth and a lot of rolling. 


Is it possible to automate this process?

Here is an example demonstrating what i'd hope to achieve using language I'm familiar with.... but I know if/then statements are not possible. 

/roll d100

if result = 1-30 = /roll d13

if result = 31-40 = /roll d7

if result = 41-50 = /roll d4

if result = 51-60 = /roll d3

if result = 61-72 = /roll d6

....etc


of course, ideally also building in a second layer (though maybe this is asking too much)... if for example the d100 result =1-30, and the macro then automatically rolled a d13 then it would proceed

if result = 1 = /roll d6

if result = 2 = /roll d12

...etc


Please let me know if I need to clarify anything or if this is just flat-out impossible. 

Thank y'all for any feedback ;)


October 13 (2 years ago)
Loren the GM
Pro
Marketplace Creator

This is all very do-able with a Pro subscription and using the Recursive Tables API script. This lets you nest table rolls, which means you can build rollable tables that basically act as your if/then statements. In practice it would look like:

  • Macro: Roll on table named D100 to get value
    • Table D100 Rolls, and on result calls next table: Table Mundane Item
      • Table Mundane Item rolls and calls next table: Mundane - Tools
        • Table Mundane - Tools rolls, and produces result Mason's Tools.

You can easily get your spreadsheet data imported to tables using the TableExport script (which also imports, despite the name).

Without API access, I am not aware of a way to do what you are after.

October 13 (2 years ago)
Kraynic
Pro
Sheet Author

There is a way to nest rollable tables that is posted in the Roll20 Tricks thread.  You might check that out:

https://app.roll20.net/forum/post/5899495/stupid-roll20-tricks-and-some-clever-ones/?pageforid=6948596#post-6948596

October 13 (2 years ago)

thank you, i will check that out... however the thought of manually inputting hundreds of options into the rollable tables makes me wince

October 14 (2 years ago)

Edited October 14 (2 years ago)
GiGs
Pro
Sheet Author
API Scripter

If its possible to calculate the dice roll from the original d100 roll, it can be done as a standard macro. It doesnt seem like that is the case though, judging from your table earlier.