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

Using Rollable Tables to call Macros?

September 20 (4 years ago)

Edited September 20 (4 years ago)

Is there a way to have a rollable table call a Macro?


For instance, suppose I have the macro:

Call-Rollable-Table

[[1t[?{Which Table|A|B}]]]


Can I then have a rollable table that calls one of two options? For example, for the table name A:

A

#Macro1

#Macro2

September 20 (4 years ago)

Edited September 20 (4 years ago)
Ziechael
Forum Champion
Sheet Author
API Scripter

[Edit] Post removed because I totally misread the question and wrote absolute garbage... will revisit when I aren't travelling and have time to actually be useful unless someone beats me to it.

September 20 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

Rollable tables cant call macros directly - they just print their table items as text to the chat, without being processed.

I think you can do this by reordering the macro, somethinglike

[[1t[#?{WhichTable|A|B}]]]

If I'm right, this will roll macros A or B depending on the table selection.

You have to be carful with table items inside inline roll brackets-  if the macro is just generating a number, it should be okay. But if it has anything else in it, it might not work as you expect.

You can test it by removing the query first, and doing [[1t[#A]]] and [[1t[#B]]], to make sure they give the output you expect.

September 20 (4 years ago)

I tried your example GiGs, but I couldn't get it to call a Macro while nested within the call for a rollable table.

I have found that the Recursive Tables API script improves rollable table functionality (e.g. works for rolls, /w, /em, etc.), but I haven't found a solution that works for macros.  The goal is to be able to weight macros via the rollable table.

September 20 (4 years ago)

After doing a bit more searching I found a script that seems to work for what I'm trying to do: https://wiki.roll20.net/Script:Rollable_Table_Macros