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 .
×

Help Needed: Almost figured out check/save macro, but "rname" is giving me trouble

1613958808

Edited 1613959158
I've been bashing my head against Roll20 macros for a few hours now and I've managed to put together an   almost   perfect Ability Check macro (I have a very similar one for saving throws, and it has all the same issues). I have two questions: I'd really love to be able to have the Roll Name   {{rname=Check}} dynamically match the selected Check, e.g.   {{rname=STR}} . I was able to get the Modifier value to display by copying my   ?{Check...   query into   {{mod=...   but doing the same for   rname   just causes it to return the modifier value (-1) instead of the selected roll (STR). Is there any way to do this? I've saved both my Check and Save macros as   Token Actions . Is there a way to clean up my macro using the selected token name to avoid having my character's name everywhere (since I know he's "Selected")? That is, instead of having to use   STR,@{Zeckl the Last|strength_mod} ,   CON,@{Zeckl the Last|constitution_mod} , etc. can I use   STR,@{strength_mod} ,   CON,@{constitution_mod}   etc. since it's a lot shorter? I did try this and got an error. FWIW, I've also tried   STR,@{Selected|strength_mod} and that didn't work either but I'm probably using it wrong. Basically, I'm trying not to have to repeat myself. I'd also like to be able to share this macro with my party, and it would be easier for them to not have to replace my character's name in a million places and insert theirs. Any help is appreciated! Sorry for the long post! Here is my macro code: &{template:simple} {{?{Roll Type|Normal,normal|Advantage,advantage|Disadvantage,disadvantage}=1}} {{r1=[[1d20 + ?{Check|STR,@{Zeckl the Last|strength_mod}|DEX,@{Zeckl the Last|dexterity_mod}|CON,@{Zeckl the Last|constitution_mod}|INT,@{Zeckl the Last|intelligence_mod}|WIS,@{Zeckl the Last|wisdom_mod}|CHA,@{Zeckl the Last|charisma_mod}}]]}} {{r2=[[1d20 + ?{Save|STR,@{Zeckl the Last|strength_mod}|DEX,@{Zeckl the Last|dexterity_mod}|CON,@{Zeckl the Last|constitution_mod}|INT,@{Zeckl the Last|intelligence_mod}|WIS,@{Zeckl the Last|wisdom_mod}|CHA,@{Zeckl the Last|charisma_mod}}]]}} {{rname=Check}} {{mod=?{Check|STR,DEX,CON,INT,WIS,CHA}}} {{charname=Zeckl the Last}} Edit: typo!
1613965038
GiGs
Pro
Sheet Author
API Scripter
Both of your questions have solutions. For the second, instead of&nbsp; STR,@{Zeckl the Last|strength_mod} you can use&nbsp; STR,@{selected|strength_mod} .&nbsp; Sadly the solution to the first one is very complex, and needs nested queries. Basically you need to rebuild you macro to nest everything based on the stat under one option, like &amp;{template:simple} {{?{Roll Type|Normal,normal|Advantage,advantage|Disadvantage,disadvantage}=1}} ?{Check| STR,{{r1=[[1d20 + @{selected|strength_mod}]]}} {{r2=[[1d20 + @{selected|strength_mod}]]}} {{rname=Strength}} {{mod=STR}}| DEX,{{r1=[[1d20 + @{selected|dexterity_mod}]]}} {{r2=[[1d20 + @{selected|dexterity_mod}]]}} {{rname=Dexterity}} {{mod=DEX}}| ... and so on for the rest of the stats, until ending the query -&gt; } {{charname=Zeckl the Last}} The problem is, a nested query like this will break. Because roll20 will stop at the first } after the query begins, treating that as the end of the query. To solve this requires the madness of html substitutions. See 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> So each of your roll queries end with }} and they need to be replaced with &amp;#125;&amp;#125; like so &amp;{template:simple} {{?{Roll Type|Normal,normal|Advantage,advantage|Disadvantage,disadvantage}=1}} ?{Check| STR,{{r1=[[1d20 + @{selected|strength_mod}]]&amp;#125;&amp;#125; {{r2=[[1d20 + @{selected|strength_mod}]]&amp;#125;&amp;#125; {{rname=Strength&amp;#125;&amp;#125; {{mod=STR&amp;#125;&amp;#125;| DEX,{{r1=[[1d20 + @{selected|dexterity_mod}]]&amp;#125;&amp;#125; {{r2=[[1d20 + @{selected|dexterity_mod}]]&amp;#125;&amp;#125; {{rname=Dexterity&amp;#125;&amp;#125; {{mod=DEX&amp;#125;&amp;#125;| ... and so on for the rest of the stats, until ending the query -&gt; } {{charname=Zeckl the Last}} Luckily you can put a linebreak after the | in a query, making this look a little more readable than it would be otherwise. Important: if you save this in a macro, you must never open that macro again, or the html strings (&amp;#125;&amp;#125;) will turn back to }} breaking the macro. So if you use something like, save a copy somewhere safe. If you put it in an ability on a character sheet, this parsing doesnt happen so you can use a blank characterto store such macros for safety.
@GiGs - Thanks for the input! I’ll play around with the nested queries when I get a chance. FWIW, I’m pretty sure I’ve tried ` @{selected|whatever_mod}` before to no avail. And I’ve already fallen into the trap of HTML reformatting! All of my macros (especially the longer ones) are now safe in a text doc - hahaha.