Using a rollable table to simulate If/Then statements?

1528963539
Garrett G.
Pro
Sheet Author
I've seen references to doing this but have not been able get what I'm wanting to do to work quite right. Basically what I'm wanting to do is purely cosmetic and I don't want to alter the character sheet in order to do it. It works like this: 1) Player rolls 3d6. 2) If the player rolls equal to or less than the target number, then the roll is a success and I would like the result to show "SUCCESS". 3) If not, then the roll is a fail and I would like the result to show as "FAIL". I originally thought I'd found a way but it's just not working for me and wanted to see if anyone else had a way. I could just use an API to get it done but I'm really hoping to find a way to do it using a macro or small series of them.
1528974112
G G
Pro
Sheet Author
You cant actually use a table for that. You'd need a different table for each target number. You should be able to use the < syntax like these three examples: /roll 3d6<7 /roll 3d6<@{selected|Attribute} /roll 3d6<[[@{selected|Attribute}+@{selected|OtherAttribute}]]
1529010826
Garrett G.
Pro
Sheet Author
Thanks for the reply but the usage of the < symbol is not the problem I'm experiencing. I'm using this basic formula: [[ {3d6, {100}}<?{Target|11} ]] This formula will always generate a result of 0 (for no successes) or 1 (for the one success possible). The command line I'm using it in looks like this: /em rolls [[ {3d6, {100}}<?{Target|11} ]] successes. Output: *player name* rolls {0 or 1} successses. However, since the roll only ever generates a 0 or 1, I want to find a way to substitute the result so that instead I can then change the output. Desired Output: *player name* rolls a {SUCCESS, FAIL}. I originally tried this formula: /em rolls a [[1t[Table?{{3d6, {100}}<?{Target|11}}]]. I had a Table0 set up with 1 possible roll result that said SUCCESS and a Table1 set up also with 1 possible result of FAIL. Unfortunately, various attempts to change the formula to mitigate some of the aberrant results I was getting still failed to get me the result I wanted. I'm hoping that someone out there has done something like this before and may be able to point me in the right direction.
1529012646
keithcurtis
Roll20 Mod Team
Hmm. I tried adding a custom attribute called "0" with a value of "Failure" and an attribute called "1", with a value of "success", but the macro wants to resolve them in the opposite order. I eventually used enough HTML entity replacements to get the formula to come out right: @{0}, but it doesn't recognize a roll result as an attribute name. /em rolls a @{[[{3d6, {100}}<?{Target|11}]]} Maybe someone smarter than me can figure out a way using that approach?
1529020076

Edited 1529020102
The Aaron
Pro
API Scripter
You can do this by making two tables, one named 0 with a single row of "Failure" and one named 1 with a single row of "Success". You then construct your roll such that the result of a passing test will be the name of the table: [[ 1t[ [[1d2>2]] ] ]]
1529043174

Edited 1529043321
Garrett G.
Pro
Sheet Author
Yep, I can definitely get it to work with your formula. And my initial try at doing it used the same basic concept (even so far as having a table named 0 for FAIL and 1 for SUCCESS). So seeing your work, evidently my issue is somewhere in my statement (possibly the fact that there's a sub equation?). Mine will do the query but after that, there's no output. <--Entering in query info. <-- Fails to output anything new, even error information. I'm guessing either I've missed something in my macro or it just can't be done the way I'm trying.