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

Can I parse a roll macro to output the number of dice rolled?

I have an effect that required me to know how many dice are rolled, but the number of dice is variable. The macro is ?{Is leveled?|No, [[ceil((@{caster1_level}+1)/2)]]|Yes, @{caster1_level}+1]}d4. Can I pull the number of dice post query response? I was thinking of parsing @{repeating_attacks_$id_dmgbase} (where the macro is), but I don't know how.
1714254043

Edited 1714254119
vÍnce
Pro
Sheet Author
Are you just wanting to show the number of dice as determined in the query or...? If you just want to use/show the #of dice used, you should be able to call the query twice.  Once for the actual roll and the other to show the # of dice. example; Damage: ?{Is leveled?|No, [[ceil((@{caster1_level}+1)/2)]]|Yes, @{caster1_level}+1]}d4 Dice Rolled: [[ ?{Is leveled?} ]] Both calls need to be done in the same roll. Not sure if this applies depending on your actual use-case.
1714254596

Edited 1714254710
GiGs
Pro
Sheet Author
API Scripter
There's no good way to do this, You might be able to use a Reusing Rolls method, something like &{template:default} {{name=Whatever name you want to display}} [[ [[?{Is leveled?| No, [[ceil((@{caster1_level}+1)/2)]]| Yes, [[@{caster1_level}+1]]}]]d4]] {{roll=$[[2]]}} {{parsed=$[[1]]}} Edit: I like Vince's method, too. That's a much better way to get the number of dice rolled.
1714261771

Edited 1714261901
@ vÍnce , that was it. Thanks. Actual use case is additional bleed damage based on how many dice were rolled for damage.
1714271683
timmaugh
Pro
API Scripter
Are scripts available? This is fairly trivial to do with the Metascript Toolbox.
Jared said: @ vÍnce , that was it. Thanks. Actual use case is additional bleed damage based on how many dice were rolled for damage. RainbowEncoder helped me with something very similar to that, where depending on a d4, you got 1-4 different bleed outputs. Here's what I have thanks to 'em: &{template:dmg} {{attack=1}} {{dmg1flag=1}} {{dmg1=[[(1d6 + (@{class_resource}*4)) *2[CRIT]]]}} {{dmg1type=Slashing, Piercing}} &{template:dmgaction} $[[$[[1]]]] [[[ [[ ([[1d4]]-1)*2 ]] ]]] {{rname=Bleed for $[[0]] round(s)}} {{dmg1flag=1}} {{dmg1=$[[9.computed]]}} [[[0 [[0]] {{dmg1=$[[8]] $[[10]]}} ]]] [[[0 [[0]] {{dmg1=$[[8]] $[[10]] $[[12]] }} ]]] [[[0 [[0]] {{dmg1=$[[8]] $[[10]] $[[12]] $[[14]]}} ]]] [[ [[@{class_resource}+1]]d8]][[[[@{class_resource}+1]]d8]][[[[@{class_resource}+1]]d8]][[[[@{class_resource}+1]]d8]] The bottom line is the bleed macro depending on the die result rolled