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

Help with a macro to call rollable tables please

1606209774
Senjak
Pro
Sheet Author
So I have two rollable tables, 'spell-1st-level' and 'spell-2nd-level'.and I'm trying to build a macro that will allow me to pick which table is rolled from. So far I have: /me Checks a random scroll &{template:default} {{name=?{Level|1st, 1st|2nd, 2nd} Level Scroll}} {{  [[ 1t[spell-1st-level]  ]]   }} And although that is part of the way there, I'd much rather have the table inserted in so that I'm not just rolling on the 1st level spell table. So I tried something like the following (and many variants!) /me Checks a random scroll &{template:default} {{name=?{Level|1st, 1st|2nd, 2nd} Level Scroll}} {{  [[ 1t[[spell-?{Level}-level]]  ]]   }} but that doesn't seem to do it, the macro doesn't return anything. I'm fairly sure that I'm missing something fairly basic, but I've been beating my head against the wall on this one. I'd love some help please. Thanks! Senjak
1606216902

Edited 1606217198
Oosh
Sheet Author
API Scripter
You were close! /me Checks a random scroll &{template:default} {{name=?{Level|1st,1st|2nd,2nd} Level Scroll}} {{[[1t[spell-?{Level}-level]]]}} Watch out for spaces where you don't need them! You had a couple after the commas in the Query, and everything after the comma gets substituted for the Query. So your rollable table name was getting expanded to "spell- 1st-level" with a space between the hyphen and Query result, which breaks the macro. Spaces can make macros easier to read, but there's a few places where they'll break stuff, too - Queries and Template properties are a couple that spring to mind. Another common Query error is ?{Whisper roll?|Yes, /w GM|No, } - a forward-slash command only works in chat if it's the first character, so that space after the comma will prevent the whisper Query from doing anything. And you just need single squackets around your table name as well (like in your first example), the inline roll in the second one won't work. Under some conditions you can use an inline roll in a table name, but you still need the single brackets around that, so: [[[1d6]]tableName] for example... but this isn't directly relevant.
1606253720
Senjak
Pro
Sheet Author
Thank you!  I must try to undo years of making code more readable by adding excess white space!