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

Re-use die rolls in macros, treated as numbers rather than just text

Score + 61
1599612825
David M.
Pro
API Scripter
We can currently re-use dice rolls (sort of) in macros/abilities using the $[[0]] syntax described here , but currently can only return the text of the roll. It would often be very convenient to be able to perform mathematical operations or otherwise treat these die rolls as actual numbers, like [[$0]] + 4, or [[ $[[0]]d6 ]]. If this has been suggested before, point me in the right direction and I will delete this and upvote it!
1600227209
Oosh
Sheet Author
Turns out I had a spare vote, so +1. It feels like setting the macro difficulty slider down to "Easiest", though :)
1600228690
vÍnce
Pro
Sheet Author
Everyone pile on!  This has been such a requested feature on the forums over the years.  How is this not already a suggestion?
1600246083
Ziechael
Forum Champion
Sheet Author
API Scripter
... And my Axe! We've hit that magic 10 votes at least!
1600260750
Andreas J.
Forum Champion
Sheet Author
Translator
Had to move a vote form elsewhere to this one, good suggestion. Currently the Reusing Rolls page just copes/list the prominent forum posts on the subject, but it would be great if someone where to organize it a bit. I created the page, but haven't had the time to get more familiar with the stuff to be able to make the documentation more clear. I added a link to this thread on the page, and posted about this in the Reusing Rolls - Megathread .
1600262268
David M.
Pro
API Scripter
Thanks for spreading the word, Andreas! Oosh & Ziechael: HAHA!
1600277086
Oosh
Sheet Author
David, maybe you should cherry-pick some of the cleverer uses and edit them into the top post? There's been some crackers, but trimming them down to "I just clicked on this suggestion thread" level will probably take some work.
This would definitely be one of the best improvements to roll20
For now, whatever that is parsed to $[[#]] does carry with it the roll data, but it would be very useful if I could write functions with it. For example... [[ 10d6 ]] [[$[[0]]=6]] [[$[[0]]=1]] (Roll 10 D6s and tell me how many 6s and how many 1s there are in the same roll. )
Whilst manipulating the parser to give us the plain numeric result of a roll is possible and, with certain limits, even duplicate that result to perform additional calculations ( more info ); having a direct means to get the numeric result would make Macros that rely on access to it much more accessible. Also with the introduction of Computed values, the syntax used to reference rolls was expanded ($[[0.computed]]). So I'd recommend expanding the syntax in a similar way using something like $[[0.value]] that would be replaced by plaintext rather than HTML and thus suitable for further calculation. It would also have the advantage of not affecting existing usage.