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

Assign dice roll result to variable?

Is there a way to make a dice roll and have its result assigned to a variable, so that in the macro you can access that result multiple times at later stages?
1413565636

Edited 1413565649
The Aaron
Roll20 Production Team
API Scripter
No. Sorry. It's a much requested feature. The best you can do is to use ?{roll|1} and have them type the roll in, or get the API and write in Javascript.
Too bad... the macro function especially with the character sheets is really nice... I just thought instead of making three macros for saving throws in dnd 3.5, I just put them in one... but right now it rolls for each saving throw seperately.... so I kinda of want to circumvent that and use the base roll result for each of the saving throws. Anyway, really great tool though :)
1413634048
The Aaron
Roll20 Production Team
API Scripter
Yep. It would be nice. I think many people just make their macro have all three in a compact form: Saves: F: [[1d20+@{selected|fort-bonus}]] | R: [[1d20+@{selected|ref-bonus}]] | W: [[1d20+@{selected|will-bonus}]]
1413644084

Edited 1413644106
I've used [quote] Fortitude check: [[1d20 + @{selected|fortitude}]] Reflex check: [[1d20 + @{selected|reflex}]] Will check: [[1d20 + @{selected|will}]] [/quote] What's the different so the -bonus ones?
My usual go-to for saves and defenses: (take a look at Macros - Pathfinder Examples for more examples.) /me defends himself from the assault! CMD:[[19]] AC[[18]] ♦ Flat[[18]] ♦ Touch[[13]] Fort[[1d20 + 3]] ♦ Ref[[1d20+7]] ♦ Will[[1d20+1]] Evasion, +2 vs. Aberrations
1413648684
The Aaron
Roll20 Production Team
API Scripter
Just different attribute names. The takeaway is putting them on the same line for compactness.
Absolutely. Writing macros in such a way so that they fit (cleanly) within the same 5 lines of text you're given (before it inserts your character name again) is crucial to writing clean, smooth macros. Though I've kinda taken it to extremes on occasion :) Over the top example. Multishot+Rapidshot with crit rolls, confirms, and damage /me draws his bow and peppers his enemies with arrows! [Rapid/Multi] H1[[1d20 + 15 -2]](![[20 + 15 -2]]•[[1d20 + 15 -2]])=[[ { 1d8 + 3 , 1d8 + 3 } ]]+![[ { 1d8 + 3 , 1d8 + 3} ]]! H2[[1d20 + 15 -2]](![[20 + 15 -2]]!•[[1d20 + 15 -2]])=[[ 1d8 + 3 ]]+![[ { 1d8 + 3 , 1d8 + 3 } ]]! H3[[1d20 + 10 -2]](![[20 + 10 -2]]!•[[1d20 + 10 -2]])=[[ 1d8 + 3 ]]+![[ { 1d8 + 3 , 1d8 + 3 } ]]! H4[[1d20 + 5 -2]](![[20 + 15 -2]]!•[[1d20 + 5 -2]])=[[ 1d8 + 3 ]]+![[ { 1d8 + 3 , 1d8 + 3 } ]]! Output: Read left-to-right : "Hit #1 rolled a 20, needs a 23 to crit, rolled a 17 to confirm. Normal attack did 20 damage, if crit add an additional 41 Edit: Corrected some of the numbers in the example to be consistent with Pathfinder rules. (Main attack with Multishot, Rapidshot extra attack, second attack from BAB , and third attack from BAB)
1413660352
Gen Kitty
Forum Champion
Being able to trap the die-roll would open up room for a lot of new macros. I so very very much want to be able to write a macro that spits out something like: Damage: 4 normal, 5 precision, 6 fire, for 19 total. Mark, why so cramped in the output? Trying to guarantee no one has to make their chatpane wider?
Precisely. I write my macros (as convoluted as this extreme example may be) to fit in the chat bar without having to expand it nor go past the point where your character name is re-posted. I also use Roll20 on occasion in physical games, for myself as a custom roller. This rapid/multi shot for example is a huge time saver at the table instead of rolling four times, adding damage, re-rolling for crit confirms, etc. Mostly just providing an example here.
Some nice ideas in here, thx :)