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

Looking for Macro help

Hi All, I'm hoping to modify a Macro like this: @{selected|token_name} rolls a check. ?{Roll:| Normal, /gr 1d20| Advantage, /gr 2d20kh1| Disadvantage, /gr 2d20kl1} In such a way that the output value will also state the character's name and if it was rolled with advantage.  I've tried a few different settings and searching the forums has not been very fruitful. What I want to see is after the player selects if it is a normal roll or roll with advantage or disadvantage that the output says the person's name and which roll they used. I plan to use the character sheet macros for most checks, but I thought it would be handy to have a quick button available to all the players that allows them to do this, but I'd like to see in the output if they chose adv / disadv / or normal. I find some of the documentation around the templates a bit confusing as well.  If anyone has a link to pages that simply list all the functions, or maybe some more examples of how to use them, that would be awesome as well.  I find looking over what I do see in the wiki or forums just a bit difficult to interpret. Thanks much!
Hmm On further test, that macro above is not working either. I thought I had it work earlier - I must have changed something to break it! 
1599368839
GiGs
Pro
Sheet Author
API Scripter
Everything after the comma gets sent to chat, and /roll style commands need to be right at the start of the line. You you need to remove the spaces after the comma, like so: @{selected|token_name} rolls a check. ?{Roll:| Normal,/gr 1d20| Advantage,/gr 2d20kh1| Disadvantage,/gr 2d20kl1}
1599369337
GiGs
Pro
Sheet Author
API Scripter
If you want to show text for the type of roll made, you can put extra stuff after the comma. Using a rolltemplate has two issues: You cant show the actual dice rolled, just the result If combined with a query, you might have to deal with html replacements, as described here:&nbsp; <a href="https://wiki.roll20.net/Macros#Advanced_Usage_for_Roll_Queries" rel="nofollow">https://wiki.roll20.net/Macros#Advanced_Usage_for_Roll_Queries</a> You can avoid using a rolltemplate by tagging the roll, like so @{selected|token_name} rolls a check. ?{Roll:| Normal,/gr 1d20 [Normal]| Advantage,/gr 2d20kh1 [Advantage]| Disadvantage,/gr 2d20kl1 [Disadvantage]} If you want to use a template, put the query inside the {{ }} brackets, like so: &amp;{template:default} {{name=@{selected|token_name}}} {{ ?{Roll:| Normal,Normal Roll=[[1d20]]| Advantage,Roll With Advantage=[[2d20kh1]]| Disadvantage,Roll With&nbsp; Disadvantage=[[ 2d20kl1]]} }}
Thank you so much!
1599376358
GiGs
Pro
Sheet Author
API Scripter
you're welcome :)
I'm playing around with it some more and arrived at this so far: &amp;{template:default} {{name=@{selected|token_name}}} {{ ?{Roll:| Normal,Normal Roll=[[1d20]]| Advantage,Roll With Advantage=[[2d20kh1]]| Disadvantage,Roll With Disadvantage=[[2d20kl1]]}&nbsp; + ?{Bonus|0} }} So not only can they roll a d20 with adv / disadv but they can input a bonus number as well if they feel like it. Works well, except it does not add the numbers together.&nbsp; I don't suppose you'd have a suggestion that could offer a total of the two number or just output the total (while keeping the template coloring of nat 20s or nat 1s)?
1599427153

Edited 1599427684
vÍnce
Pro
Sheet Author
You should be able to use this (BUT it requires a few html character substitutions for the nested bonu query, otherwise it will break.&nbsp; more info on the wiki: here ) &amp;{template:default} {{name=@{selected|token_name}}} {{ ?{Roll:|Normal,Normal Roll=[[1d20 + ?{Bonus&amp;#124; 0&amp;#125; ]]|Advantage,Roll With Advantage=[[2d20kh1 + ?{Bonus&amp;#124; 0&amp;#125; ]]|Disadvantage,Roll With Disadvantage=[[2d20kl1 + ?{Bonus&amp;#124; 0&amp;#125; ]]} }} Caution; one BIG disadvantage of using nested queries in your ability macros is that if you later open your macro to edit it further, the VTT will convert those character substitutions which will break the macro. ;-(&nbsp; You'll need to substitute them back in your macro before you save it.&nbsp; Couple of options is to use a " macro character " that stores your macros or use chat menus instead. Hope this helps.
1599430226
Ziechael
Forum Champion
Sheet Author
API Scripter
To avoid html you can just ensure that you only put the bits that need to be different in the query and add the bonus (a constant) after the query ends but within the inline calculation: &amp;{template:default} {{name=@{selected|token_name}}} {{ ?{Roll:| Normal,Normal Roll=[[1d20| Advantage,Roll With Advantage=[[2d20kh1| Disadvantage,Roll With Disadvantage=[[2d20kl1} + ?{Bonus|0} ]] }} Note how the bonus and the closing brackets of the inline roll sit outside of the query, as GiGs mentioned earlier, a query is replaced by the result as if typed out so you can use half of the standard syntax inside the query and half outside of it without it breaking :D
Thanks to all, you've been a big help!&nbsp; I love how responsive you've all been.
1599432781
vÍnce
Pro
Sheet Author
Ziechael said: To avoid html you can just ensure that you only put the bits that need to be different in the query and add the bonus (a constant) after the query ends but within the inline calculation: &amp;{template:default} {{name=@{selected|token_name}}} {{ ?{Roll:| Normal,Normal Roll=[[1d20| Advantage,Roll With Advantage=[[2d20kh1| Disadvantage,Roll With Disadvantage=[[2d20kl1} + ?{Bonus|0} ]] }} Note how the bonus and the closing brackets of the inline roll sit outside of the query, as GiGs mentioned earlier, a query is replaced by the result as if typed out so you can use half of the standard syntax inside the query and half outside of it without it breaking :D Nice.&nbsp; I always forget about keeping the [constants] outside the query.&nbsp; Thanks
1599453331

Edited 1599453497
Oosh
Sheet Author
API Scripter
You can also make use of the 5e roll templates, assuming you're using the R20 5e sheet: &amp;{template:simple} {{rname=**CUSTOM ROLL**}} {{mod=[[?{Bonus?|0}[CUSTOM]]]}} {{r1=[[@{selected|d20}+?{Bonus?}[CUSTOM]]]}} {{query=1}} ?{Advantage?|Normal Roll,&amp;#123&amp;#123normal=1&amp;#125&amp;#125 &amp;#123&amp;#123r2=[[0d20|Advantage,&amp;#123&amp;#123advantage=1&amp;#125&amp;#125 &amp;#123&amp;#123r2=[[@{selected|d20}|Disadvantage,&amp;#123&amp;#123disadvantage=1&amp;#125&amp;#125 &amp;#123&amp;#123r2=[[@{selected|d20}}+?{Bonus?}[CUSTOM]]]}} {{global=@{selected|global_skill_mod}}} {{charname=@{selected|token_name}}} This one calls the selected @{d20} (if they have halfling luck or another modded d20 roll) and includes the global skill mod field. Presumably most of the custom rolls would be ability checks - if it needed to be used for combat for any reason, you'd have to make another one with @{global_attack_mod} called instead of @{global_skill_mod}. Bear in mind this one does have HTML replacement, so you'd want to save it on a macro character sheet. Also, if you wanted to use it for NPCs with GM rolls, you'd want to add @{selected|wtype} to the beginning of the macro. It also forces character name output, ignoring the sheet setting.
That's very pretty, I like.&nbsp; Looks just like what you get from clicking the rolls from the sheet.
I've already created my Macro character.
Were you expecting this in the dialogue? @oosh
Pasting pictures here didn't work for some reason
1599457184
GiGs
Pro
Sheet Author
API Scripter
I always upload pictures to imgur first, and then copy the link from imgur and paste it here using the picture button on the toolbar. I have found the forum is flaky with uploaded pics.