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

Trigger Macro with dice roll

Hi community, sorry if this is a silly question. I'm somewhat new and not necessarily great at coding. Is it possible to trigger specific macros, determined by dice roll? Case in point my character in game has a set of six playing cards, each of which i've created a macro for #1, #2...#6 all with an image posting [x](imagelink.png). These are all working fine. So far the only thing i've come up with is rolling seperately and then manually choosing in a dropdown query ?{roll|1, #1|2, #2...#6}, but not how to connect the two. In theory it seems simple enough, but so far i've at best only had my character say #3 :P Thanks for any help :)
Macros need a space after the name for them to expand. It also happens before the choice from the Roll Query so there cannot be any | } or commas in the macro, but for only an image link is probably fine. Actually triggering the macro isn't directly supported but you may be able to Reuse the roll to create an ability button for the appropriate card. So it'll be one click and use the roll value. Note due to naming restrictions you'll need to use abilities on your Character Sheet rather than macros
Thanks for the tip with the ability buttons, i'll have a look into those :) do ability buttons without character sheets? (we're not using any in the current game). Also thanks for the tip with reuseable rolls, that way I finally got automatic crit damage working :) Cheers!
1606217771

Edited 1606217967
Oosh
Sheet Author
API Scripter
So you can do this: [Button Label](~bob|macro[[[1d6]]]) Which would create a button to roll from the macros macro[1] ==> macro[6] stored on the character sheet "bob". Note that you don't need an actual character sheet to be in use - you still have the Attributes & Abilities tab available if you create a character to store macros on. You can do it just with Collections macros, but they're more of a pain - you'll need to use HTML replacement which will be lost if you ever reopen the macro: [Button Label](!
#macro[[[1d6]]]) Hopefully that was kind of what you were asking about... edit - and if you want to report the roll itself, it will need to go after the button. You can use the default template sort trick if you want the roll to be reported first: &{template:default} {{name=Macro Selector}} {{2=[Click Me](!
#macro[[[1d6]]])}} {{1=1d6 roll is: $[[0]]}}
Thanks for the tips! The trick with the button indeed is very nifty :) I'll also try to get the mechanic going, using the integrated card decks, but this is working mighty fine already! thanks a lot!