1
\$\begingroup\$

In coming up with an answer to this question, I found a method to reference a table according to a variable. Quite different to this question, the solution concatenates a variable to a table name prefix to fetch a value from a single-item rollable table.

I tried to generalize this to use a success count as the suffix, and ended up with the code below, with two tables called sf0 and sf1 with the single rows "Failure" and "Success", respectively.

&{template:default}{{name=Soul check}}{{ [[1t[sf[[ {1d20+6}>[[?{Spell level}+ 12]] ]] ]] }}

Which doesn't evaluate the 1t function, and instead outputs [[1t[sf0 or [[1t[sf1. Is it possible to concatenate a roll result into a prefix to roll on a selected table?

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

Your main problem seems to be that

  • [[1t[sf[[ {1d20+6}>[[?{Spell level}+ 12]] ]] ]]

is not the correct syntax to call a roll table. It should have one less bracket around the roll itself and should not include "sf" like so:

  • [[1t[ [[{1d20+6}>[[?{Spell level}+ 12]] ] ]]

The linked forums' suggestion is to simply have the tables be "0" and "1" so that, whichever result is achieved by the die roll (0 or 1), gets passed as the Rollable Table name to be called. This should result in your success/failure messages being posted instead of 1/0.

Unfortunately, your method of setting the variable DC confuses the macro into thinking there are ]] close brackets; it may work better using HTML coding, but I would have to look that up before attempting that solution.

Fortunately

... the text from my other answer can be adopted to do this correctly, for sure, and the information here may allow you to fix your method if you prefer:

&{template:default} {{name=test macro}} {{ [[ 1t[[[ {1d20}>?{Level?|1,13|2,14|3,15|4,16|5,17|6,18|7,19|8,20|9,21} ]]] ]] }}

You should additionally have a table, named simply "1" and another named simply "0" (no letters) Roll Tables

Within each should be one (or more) text values indicating Success or Failure. Roll Table Items


Note: I ran into an issue that the "1t [[[" wasn't calling the Roll Tables; this was caused by the space. Your text doesn't have it, but note that it must be "1t[[[" in order for the answer to be parsed.

Post-Note: If your intent with including "sf" in the Rollable Tables was to allow for multiple different macros with different success/failure output, then you should be able to make further table pairs (2/3, 4/5, 6/7 etc) and add 2/4/6(...) to the result after your 1d20> but within the 1t[ ] call.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .