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 .
×

Macro: How to make Target Number give dialogue.

So I have a % script I wanna use so that say there is something with a 20% chance and it Succeeds it gives dialogue, and if it fails, it gives another type of dialogue. This is what I have so far. I just wanna know how to make it so when it rolls a 1 it will say "Success" and when it rolls a 0 or -1 it says "Failed"  &{template:default} {{name=Miss Chance}} ?{%Roll| 20%,[[1d100>20f<20]]| 50%,[[1d100>50f<50]] }
1683102865

Edited 1683103073
HazyPhantom said: So I have a % script I wanna use so that say there is something with a 20% chance and it Succeeds it gives dialogue, and if it fails, it gives another type of dialogue. This is what I have so far. I just wanna know how to make it so when it rolls a 1 it will say "Success" and when it rolls a 0 or -1 it says "Failed"  &{template:default} {{name=Miss Chance}} ?{%Roll| 20%,[[1d100>20f<20]]| 50%,[[1d100>50f<50]] } You could set up a rollable table for this.
Gargamond said: You could set up a rollable table for this. Then how do you do that with text?
HazyPhantom said: Gargamond said: You could set up a rollable table for this. Then how do you do that with text? You type the text in the table entries.
Gargamond said: HazyPhantom said: Gargamond said: You could set up a rollable table for this. Then how do you do that with text? You type the text in the table entries. Mind giving me an example?
HazyPhantom said: Gargamond said: HazyPhantom said: Gargamond said: You could set up a rollable table for this. Then how do you do that with text? You type the text in the table entries. Mind giving me an example? I’m on my phone not my pc rn but I gave you a link to rollable tables
1683123787
Ziechael
Forum Champion
Sheet Author
API Scripter
If the chance of success is liable to change and you want to just output success or failure depending on a calculation you can use the custom output 'trick':&nbsp;<a href="https://app.roll20.net/forum/permalink/7510651/" rel="nofollow">https://app.roll20.net/forum/permalink/7510651/</a>
1683128079

Edited 1683165455
timmaugh
Roll20 Production Team
API Scripter
I sometimes find that multiple-tables trick to be a bit cluttering to my game. Here is a solution that uses metascripts: ! &amp;{template:default} {\&amp;global ([theRoll]&nbsp; {&amp;if&nbsp; ?{%Roll|20%|50%} &nbsp;= '20%'} [[1d100&gt;20f&lt;20]]{&amp;elseif&nbsp; ?{%Roll} = '50%'} [[1d100&gt;50f&lt;50]]{&amp;end} )}&nbsp; {{name=Miss Chance}} {{Chance= ?{%Roll}}} {{Roll=theRoll}}&nbsp; {{Result={\&amp;if theRoll.value = 1}Success!{\&amp;else}Failure!{\&amp;end}}}{&amp;simple} And the output: A couple of notes, though... your roll can produce 3 different values: -1, 0, or 1. If you just need it to roll over a certain number to know if it is a success, you can drop the "failure" portion of the roll... so the 20% roll would become: [[1d100&gt;20]] Also, structuring your query options to include the % symbol means that you can't use them in a roll equation. If you remove it (and include it in the template where you need to report the Chance percentage), your command line gets a whole lot simpler. Because inline rolls are processed after roll queries, you'd have a single roll to worry about. Provided you'd already supplied the answer for the ?{%Roll} query in your command line prior to this point (see my example, below), your roll would be either: [[1d100&gt;?{%Roll}f&lt;?{%Roll}]] or [[1d100&gt;?{%Roll}]] ...depending on your answer to whether you need the "failure" number to provide a potential -1 value to the roll. That would let your new command line become: ! &amp;{template:default} &nbsp; {{name=Miss Chance}} {{Chance= ?{%Roll|20|50}%}} {{Roll=[[1d100&gt;?{%Roll}]]}}&nbsp; {{Result={&amp;if $[[0]] = 1}Success!{&amp;else}Failure!{&amp;end}}}{&amp;simple} ...and it would produce the same sort of output as pictured, above. Required Scripts ZeroFrame, APILogic
1683145573
GiGs
Pro
Sheet Author
API Scripter
If you are using rollable tables, you can include the 20% success chance in the table, by multiplyig the total successes by 16, to find the weight for the miss chance.
timmaugh said: I sometimes find that multiple-tables trick to be a bit cluttering to my game. Here is a solution that uses metascripts: ! &amp;{template:default} {\&amp;global ([theRoll]&nbsp; {&amp;if&nbsp; ?{%Roll|20%|50%} &nbsp;= '20%'} [[1d100&gt;20f&lt;20]]{&amp;elseif&nbsp; ?{%Roll} = '50%'} [[1d100&gt;50f&lt;50]]{&amp;end} )}&nbsp; {{name=Miss Chance}} {{Chance= ?{%Roll}}} {{Roll=theRoll}}&nbsp; {{Result={\&amp;if theRoll.value = 1}Success!{\&amp;else}Failure!{\&amp;end}}}{&amp;simple} And the output: A couple of notes, though... your roll can produce 3 different values: -1, 0, or 1. If you just need it to roll over a certain number to know if it is a success, you can drop the "failure" portion of the roll... so the 20% roll would become: [[1d100&gt;20]] Also, structuring your query options to include the % symbol means that you can't use them in a roll equation. If you remove it (and include it in the template where you need to report the Chance percentage), your command line gets a whole lot simpler. Because inline rolls are processed after roll queries, you'd have a single roll to worry about. Provided you'd already supplied the answer for the ?{%Roll} query in your command line prior to this point (see my example, below), your roll would be either: [[1d100&gt;?{%Roll}f&lt;?{%Roll}]] or [[1d100&gt;?{%Roll}]] ...depending on your answer to whether you need the "failure" number to provide a potential -1 value to the roll. That would let your new command line become: ! &amp;{template:default} &nbsp; {{name=Miss Chance}} {{Chance= ?{%Roll|20|50}%}} {{Roll=[[1d100&gt;?{%Roll}]]}}&nbsp; {{Result={&amp;if $[[0]] = 1}Success!{\&amp;else}Failure!{\&amp;end}}}{&amp;simple} ...and it would produce the same sort of output as pictured, above. Required Scripts ZeroFrame, APILogic This is helpful but testing it, it seems to say 'Success!' regardless instead of 'Failure!'
1683165434
timmaugh
Roll20 Production Team
API Scripter
Ah... that is my fault. In converting the first version to the second version, I inadvertently left part of the IF block deferred (the ELSE and the END both had a backslash in them). This version will fail: ! &amp;{template:default} &nbsp; {{name=Miss Chance}} {{Chance= ?{%Roll|20|50}%}} {{Roll=[[1d100&gt;?{%Roll}]]}}&nbsp; {{Result={&amp;if $[[0]] = 1}Success!{&amp;else}Failure!{&amp;end}}}{&amp;simple} I will edit my post, above.
timmaugh said: Ah... that is my fault. In converting the first version to the second version, I inadvertently left part of the IF block deferred (the ELSE and the END both had a backslash in them). This version will fail: ! &amp;{template:default} &nbsp; {{name=Miss Chance}} {{Chance= ?{%Roll|20|50}%}} {{Roll=[[1d100&gt;?{%Roll}]]}}&nbsp; {{Result={&amp;if $[[0]] = 1}Success!{&amp;else}Failure!{&amp;end}}}{&amp;simple} I will edit my post, above. THANK YOU, now this will be easy to learn from and do for other things but this will be helpful now