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 macro that give the result miss on specific result

1723158690
Nylo
Pro
Marketplace Creator
have this macro  &{template:default} {{name=🎲 attack🎲}} {{Result [[1d4!+1d4+?{Bonus Damage|0}+?{sneak|} ]] {Reason|Attack}}} as you can see the first d4 explode on a 4 but i also need it to write miss if its a 1 . how can i do this  
1723158756
Nylo
Pro
Marketplace Creator
and maybe write hit on any result above 1   
1723161857

Edited 1723162141
Gauss
Forum Champion
Due to the second 1d4 you are probably in Mod (API Script) territory. Does the game owner have a Pro account? Without that second 1d4 I would do something like:  &{template:default} {{name= attack}}  [[1t[[[{[[1d4!+?{Bonus Damage|0}+?{sneak}]],0}>[[2+?{Bonus Damage}+?{sneak}]]]]HitMiss]]]  {{Result $[[0]] $[[2]] {Reason|Attack}}} Then the Rollable tables would be set up like this:  table 1 name: 1HitMiss table 1 first item name: Hit Table 2 name: 0HitMiss Table 2 first item name: Miss Unfortunately, that second 1d4 makes that not possible. 
1723162123
Nylo
Pro
Marketplace Creator
or this one but where it also add it all together  &{template:default} {{name=🎲 attack🎲}} {{Result [[1d4!]][[1d4]][[+?{Bonus Damage|0}]][[+?{sneak|} ]] {Reason|Attack}}}
1723162228
Gauss
Forum Champion
To clarify, the only auto-fail is that first d4? The "1d4!"? C1 said: or this one but where it also add it all together  &{template:default} {{name= attack}} {{Result [[1d4!]][[1d4]][[+?{Bonus Damage|0}]][[+?{sneak|} ]] {Reason|Attack}}}
If all you need is to show an alternate text result if the first roll is a 1, that's simple enough - you'll just have to cheat a little. &{template:default} {{name= attack}} [[[[[[1d4!rr1]]]]+[[1d4]]+[[?{Bonus Damage|0}]]+[[?{sneak|0}]]]] {{[0](#)= $[[1]]+$[[2]]+$[[3]]+$[[4]]=$[[5]] ?{Reason|Attack}}} {{[[[1d4>2]]](#)=Miss!}} {{[1](#)= Free space}} A d4 is rolled, and if that d4 lands on a 1, a miss is displayed - if not, the full roll is displayed, which cannot result in the first roll being a 1. The end result is the same, on a 1, a miss is displayed, else, the roll is shown and totaled. You can use the free space for whatever you like, it's just there to hide the miss row when it's not needed. EDIT: You could probably do the same with roll tables, but I just couldn't be bothered to set any up. It might look cleaner with tables, though.
Tuo; you're on the right track but your exploding d4 isn't correct. 1d4!rr1 will always reroll 1's preventing certain outcomes. Switching it to 1d4!ro1 also doesn't help since that can still result in 1 when it shouldn't. A more complex expression is required. { {1d4r1=4}*(4+1d4!), 1d3cs4r1}k1 That will correctly mimic 1d4! whilst excluding an initial 1. Also just because I prefer Toggleable template fields for conditionals here is a macro using that $[[$[[0]]]] [[[ [[1d4=1*2 + 1]] ]]] &{template:default} [[[0 [[0]] {{Hit}} {{Result $[[4]] {Reason|Attack} }} ]]] [[[0 [[0]] {{Miss}} }} ]]] [[ { {1d4r1=4}*(4+1d4!), 1d3cs4r1}k1 + 1d4 + ?{Bonus Damage|0}+?{sneak|} ]] {{name= attack}}
1723208442
timmaugh
Forum Champion
API Scripter
If you have scripts available to you in your game, you can do this fairly easily with the MetascriptToolbox. Modifying your first example: !&{template:default} {{name= attack}} {{Result [[[[1d4!]]+1d4+?{Bonus Damage|0}+?{sneak|} ]] {Reason|Attack}  {&if $[[0]].value = 1}***Miss!***{&end} }} {&simple} REQUIRED SCRIPTS MetaScriptToolbox
RainbowEncoder said: Tuo; you're on the right track but your exploding d4 isn't correct. 1d4!rr1 will always reroll 1's preventing certain outcomes. Switching it to 1d4!ro1 also doesn't help since that can still result in 1 when it shouldn't. A more complex expression is required. { {1d4r1=4}*(4+1d4!), 1d3cs4r1}k1 That will correctly mimic 1d4! whilst excluding an initial 1. Also just because I prefer Toggleable template fields for conditionals here is a macro using that $[[$[[0]]]] [[[ [[1d4=1*2 + 1]] ]]] &{template:default} [[[0 [[0]] {{Hit}} {{Result $[[4]] {Reason|Attack} }} ]]] [[[0 [[0]] {{Miss}} }} ]]] [[ { {1d4r1=4}*(4+1d4!), 1d3cs4r1}k1 + 1d4 + ?{Bonus Damage|0}+?{sneak|} ]] {{name= attack}} I must admit, I haven't used exploding dice, so I didn't think of that. The expression you gave is very clever, thanks for pitching in where my solution fell short! And yeah, toggleable template fields do have neater output, but frankly, the setup is a little intimidating.
Here's a corrected version of my approach, with some row CSS bleed trickery to hide the numbers and the extra row, for extra compact output: &{template:default} {{name= attack[tech](#" style=" display: none; class="showtip" title=)}} [[[[[[{ {1d4r1=4}*(4+1d4!), 1d3cs4r1}k1]]]]+[[1d4]]+[[?{Bonus Damage|0}]]+[[?{sneak|0}]]]] {{[0](#)= $[[1]]+$[[2]]+$[[3]]+$[[4]]=$[[5]] ?{Reason|Attack}[tech](#" style=" display: none; class="showtip" title=)}} {{[[[1d4>2]]](#)=Miss![tech](#" style=" display: none; class="showtip" title=)}} {{[1](#)=}}
1723224108
Gauss
Forum Champion
Tuo said: If all you need is to show an alternate text result if the first roll is a 1, that's simple enough - you'll just have to cheat a little. Just a note, what you and RainbowEncoder are doing is not "simple enough". Very few people understand what RainbowEncoder is doing. 
1723236724

Edited 1723236843
GiGs
Pro
Sheet Author
API Scripter
Getting back to the original question: you cant have a roll that gives text output (like "miss" or "hit"). There is no  way to do that with a standard roll20 roll. You can do it in ther ways (like a roll table, mod script, custom roll template if you have acces sto the character sheet, or faking it with CSS as Tuo demonstrates). If you are okay with showing a miss as "0", things get a lot easier.
1723286093
Nylo
Pro
Marketplace Creator
Thanks for replying all of you found a simple solution with my macro