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 .
×
May your rolls be merry + bright! 🎄
Create a free account

dnd 5e macro to roll abilities

Hi !   I just discovered this swet one callers for rols in the 5e sheet, like: @{Hitomi Tetsu|athletics_roll}  it works like a charm. I was trying to make a macro that ask what ability to rol, then roll it for you. Somehting like  ?{check | atheltics, @{selectedTetsu|athletics_roll} | other, @{selected|other_roll}, etc, etc etc}} But this thing don't seam to work .. somehow the syntaxis get all mixed... What's the proper way to call the athletics_roll from the macro ??
1622747313

Edited 1622747353
Andreas J.
Forum Champion
Sheet Author
Translator
when making more complex queries, you need to start doing html replacements for them to work <a href="https://wiki.roll20.net/Macro_Guide#HTML_replacement" rel="nofollow">https://wiki.roll20.net/Macro_Guide#HTML_replacement</a> Using %{selected| } you could activate rolls directly <a href="https://wiki.roll20.net/D%26D_5E_by_Roll20#Target_Roll_Buttons" rel="nofollow">https://wiki.roll20.net/D%26D_5E_by_Roll20#Target_Roll_Buttons</a>
1622749947
Kraynic
Pro
Sheet Author
If you use a chat menu (possibly with a macro character sheet ) instead of a query, you don't need to use html replacements.
You won't be able to (easily) call rolls from a query, because of the&nbsp; Roll20 Order of Operations . It's much easier to use a chat menu . For a PC, you can modify the NPC chat menu here for the PC stats. You have to modify all the skills to remove 'npc_' before the name to get the correct attribute roll for a PC. I believe the abilities section uses all of the same attribute calls for NPCs and PCs.&nbsp; Here's an example: /w gm &amp;{template:npcaction} &amp;{noerror}{{rname=@{selected|npc_name}}}{{name=Ability Rolls, Saves, &amp; Skill Checks}}{{description=**Abilities** [**Str @{selected|strength}** *(@{selected|strength_mod})*](~selected|npc_str" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [save](~selected|npc_str_save" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) [**Dex @{selected|dexterity}** *(@{selected|dexterity_mod})*](~selected|npc_dex" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [save](~selected|npc_dex_save" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) [**Con @{selected|constitution}** *(@{selected|constitution_mod})*](~selected|npc_con" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [save](~selected|npc_con_save" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) [**Int @{selected|intelligence}** *(@{selected|intelligence_mod})*](~selected|npc_int" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [save](~selected|npc_int_save" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) [**Wis @{selected|wisdom}** *(@{selected|wisdom_mod})*](~selected|npc_wis" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [save](~selected|npc_wis_save" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) [**Cha @{selected|charisma}** *(@{selected|charisma_mod})*](~selected|npc_cha" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [save](~selected|npc_cha_save" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) **Skills** [Acrobatics](~selected|Acrobatics" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [Animal Handling](~selected|Animal_Handling" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [Arcana](~selected|Arcana" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [Athletics](~selected|Athletics" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [Deception](~selected|Deception" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [History](~selected|History" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [Insight](~selected|Insight" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [Intimidation](~selected|Intimidation" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [Investigation](~selected|Investigation" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [Medicine](~selected|Medicine" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [Nature](~selected|Nature" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [Perception](~selected|Perception" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [Performance](~selected|Performance" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [Persuasion](~selected|Persuasion" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [Religion](~selected|Religion" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [Sleight of Hand](~selected|Sleight_of_Hand" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [Stealth](~selected|stealth" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;) | [Survival](~selected|survival" style="background: none; background-color: transparent; border: none; padding: 0px; text-decoration: none; color: #ce0f69;)}} Also, if you were going to go through the hassle of creating a macro with all the html replacements, you have to make sure you don't include any extraneous spaces in the macro.&nbsp; If the macro you had above was a good macro (it's not), you'd still need to remove spaces and make sure there are no spelling errors so it would look like this: ?{check|athletics,@{selected|athletics_roll}|other,@{selected|other_roll}}
Thank you so much for your replies. Specially to @Jarren K.&nbsp; your example is pretty much what I was looking for. On the other hands, all those chat based buttons are a bit of a burden. Player hast to select their token, then click a button in the top left of their screen, then click in the chat button in the bottom right, So basically is the worse workflow one can possible design in a computer screen. Two clicks literarily cannot be further away from each other :( Andreas J. said: when making more complex queries, you need to start doing html replacements for them to work <a href="https://wiki.roll20.net/Macro_Guide#HTML_replacement" rel="nofollow">https://wiki.roll20.net/Macro_Guide#HTML_replacement</a> Using %{selected| } you could activate rolls directly <a href="https://wiki.roll20.net/D%26D_5E_by_Roll20#Target_Roll_Buttons" rel="nofollow">https://wiki.roll20.net/D%26D_5E_by_Roll20#Target_Roll_Buttons</a> I spent some time on this but I cannot figure out what should be escaped. I even tried creating macros for each ability roll and then calling the #macro from the query, it doesn't work. Could you please elaborate on the solution?? Once again, Thank you all for your kindness and your time !
1622812921
timmaugh
Forum Champion
API Scripter
I wanted to mention that there is a Google Sheet someone put together to help with HTML substitutions (unfortunately I've lost that link, but you can search for it). Also, if/when you're ready to go to a Pro membership, an API can help with this, too. InsertArg has a nest command line function where it will handle the html replacements of sub elements of a query. In fact, it has functions to dynamically go get the things you want to include in the query, which it will then nest for you. Alternately, meta-scripts can handle a query without the need for html replacement.
Javi R. said: Thank you so much for your replies. Specially to @Jarren K.&nbsp; your example is pretty much what I was looking for. On the other hands, all those chat based buttons are a bit of a burden. Player hast to select their token, then click a button in the top left of their screen, then click in the chat button in the bottom right, So basically is the worse workflow one can possible design in a computer screen. Two clicks literarily cannot be further away from each other :( You're welcome! I'll just make the argument that using a drop-down query is not going to save you any clicks. You still have to click on the token, click on the token action button, then click on the drop-down menu in the middle of the screen (or use your keyboard for a shortcut).&nbsp; But a query would keep the chat from getting filled up with menus, which would definitely be a nice benefit.&nbsp; You could also change the chat menu I posted to be listed in Macrobar, and change all of the '@{selected' to each individual character's names, which means that you wouldn't need to click on the token first to put it into chat, which would save a click and mean that the buttons could be clicked from the chat menu without first selecting the token. Andreas J. &nbsp;said: when making more complex queries, you need to start doing html replacements for them to work&nbsp; <a href="https://wiki.roll20.net/Macro_Guide#HTML_replacement" rel="nofollow">https://wiki.roll20.net/Macro_Guide#HTML_replacement</a> Using&nbsp; %{selected| } &nbsp;you could activate rolls directly <a href="https://wiki.roll20.net/D%26D_5E_by_Roll20#Target_Roll_Buttons" rel="nofollow">https://wiki.roll20.net/D%26D_5E_by_Roll20#Target_Roll_Buttons</a> I spent some time on this but I cannot figure out what should be escaped. I even tried creating macros for each ability roll and then calling the #macro from the query, it doesn't work. Could you please elaborate on the solution?? Once again, Thank you all for your kindness and your time ! You won't find much on escaping queries because it's such a PITA.&nbsp; It's quite tricky to set up correctly, and it's easy to accidentally 'erase' all your work if you have escaped characters in a collection macro by reopening the macro. Basically what happens is anytime there is a @, %, or # call in a macro, whatever is being called is fully replaced into the macro.&nbsp; E.g., if you have a few macros with this code: #BigBite /em Johnny Boy takes a big bite out of his enemy! #SmallBite /em Johnny Boy takes a small bite out of his enemy! #Kick /em Johnny Boy kicks his enemy! And you want to put it in a query like this: ?{Which attack?|Big Bite,#BigBite|Small Bite,#SmallBite|Kick,#Kick} When the 'Which Attack' query is called, it becomes this: ?{Which attack?|Big Bite,/em Johnny Boy takes a big bite out of his enemy!|Small Bite,/em Johnny Boy takes a small bite out of his enemy!|Kick,/em Johnny Boy kicks his enemy!} Which would actually work just fine. What doesn't work is if the called macro/ability/attribute has any commas, vertical pipes, or ending braces in it, because the 'Which Attack' query assumes that they are part of that query, not an internal part of the output of the query. E.g. if you want to use a roll template #BigBite &amp;{template:npcaction} &amp;{noerror} {{rname=@{selected|npc_name}}}{{name=Attack}}{{description=Johnny Boy takes a big bite out of his enemy!}} #SmallBite &amp;{template:npcaction} &amp;{noerror} {{rname=@{selected|npc_name}}}{{name=Attack}}{{description=Johnny Boy takes a small bite out of his enemy!}} #Kick &amp;{template:npcaction} &amp;{noerror} {{rname=@{selected|npc_name}}}{{name=Attack}}{{description=Johnny Boy kicks his enemy!}} It'll become this: ?{Which attack?|Big Bite,&amp;{template:npcaction} &amp;{noerror} {{rname=@{selected|npc_name}}}{{name=Attack}}{{description=Johnny Boy takes a big bite out of his enemy!}}|Small Bite,&amp;{template:npcaction} &amp;{noerror} {{rname=@{selected|npc_name}}}{{name=Attack}}{{description=Johnny Boy takes a small bite out of his enemy!}}|Kick,&amp;{template:npcaction} &amp;{noerror} {{rname=@{selected|npc_name}}}{{name=Attack}}{{description=Johnny Boy kicks his enemy!}}} As soon as it gets to the closing brace after npcaction, the query closes.&nbsp; Unfortunately the only way to fix this to allow for nested macros would require rewriting the code to use different symbols for queries versus abilities and attributes.&nbsp; So the workaround is to use html replacements , but they have to be nested in just the right way. Each vertical pipe '|' is replaced with '&amp;#124;' Each comma ',' is replaced with '&amp;#44;' Each ending brace '}' is replaced with '&amp;#125;' Doing all of that and setting it up just right is a lot of work to get it just perfect.
1622867846
timmaugh
Forum Champion
API Scripter
I found the link to that Google Sheet... it was posted by Scott: <a href="https://app.roll20.net/forum/post/5899495/stupid-roll20-tricks-and-some-clever-ones/?pageforid=6582632#post-6582632" rel="nofollow">https://app.roll20.net/forum/post/5899495/stupid-roll20-tricks-and-some-clever-ones/?pageforid=6582632#post-6582632</a>