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

Perception Macro with conditiional modifiers

1594228791

Edited 1594228805
This is the macro I'm currently using to secretly roll a character's perception. /w gm &{template:default} {{name=Perception}} {{Bobus=[[1d20+@{Bobus|perception}]] +[[{[[floor(@{Bobus|class2_level}/3)]],[[1]]}kh1]] vs Surprise +[[{[[floor(@{Bobus|class2_level}/2)]],[[1]]}kh1]] vs Traps}} I'm looking to update my macro so that it automatically adds the modifiers for Surprise and Traps, providing a final result instead of doing math in the middle of the session. Is this possible? Thanks.
1594244476
GiGs
Pro
Sheet Author
API Scripter
Do you need the surprise and traps modifiers to be displayed like that, or are you happy with just a single total displayed?
I was hoping to have the display return the results as total results. For example. Bobus 29, 30 vs Surprise, 32 vs Traps
1594245130
GiGs
Pro
Sheet Author
API Scripter
Are surprise and traps completely separate? Or does the traps total include the surprise total as well?
Surprise and traps are separate modifiers to Perception. Surprise increase +1 per 3 levels, where Traps increase +1 per 2 levels. The character Bobus in the example is only 3rd level so the bonus is the same for both for now.
No. You’d need API to accomplish this, as one die roll cannot currently be displayed twice.
1594246179

Edited 1594246572
GiGs
Pro
Sheet Author
API Scripter
You cant easily do the calculation you want: You can't have roll report two independent totals from the same base value, like perception + surprise, and perception + traps. But you can fake it in a slightly convoluted by way, by doing surprise as perception + surprise, and traps as perception + surprise + traps - surprise.&nbsp; So here's a solution: /w gm &amp;{template:default} {{name=Perception}} [[ [[ [[1d20+@{Bobus|perception}]] + {floor(@{Bobus|class2_level}/3),1}kh1 ]] + ({floor(@{Bobus|class2_level}/2),1}kh1 - {floor(@{Bobus|class2_level}/3),1}kh1) ]] {{Bobus=$[[0]], $[[1]] vs Surprise, $[[2]] vs Traps}} This uses an the undocumented trick of being able to refer to an inline roll's value using $[[0]], $[[1]] etc. This trick:&nbsp; <a href="https://app.roll20.net/forum/permalink/8747581/" rel="nofollow">https://app.roll20.net/forum/permalink/8747581/</a>
1594246312
GiGs
Pro
Sheet Author
API Scripter
And here's a version that makes the mouse-over text more readable /w gm &amp;{template:default} {{name=Perception}} [[ [[ [[1d20+@{Bobus|perception}]] + [[{floor(@{Bobus|class2_level}/3),1}kh1]] ]] + [[{floor(@{Bobus|class2_level}/2),1}kh1 - {floor(@{Bobus|class2_level}/3),1}kh1]] ]] {{Bobus=$[[0]], $[[2]] vs Surprise, $[[4]] vs Traps}}
Thank you for your help.