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

DND 5e Adding Proficiency Query and Modifier query to Ability Score Check macro (Dropdown in Dropdown)

November 13 (5 years ago)

Edited November 13 (5 years ago)

I have a macro that works for querying ability checks, except for character name output.  I often use or allow checks of a stat that is not paired with a usual skill, and I want to add to the end another drop down for a query to see if is a person is proficient or has expertise:

+?{Proficient|None, 0|Skilled, [[@{PB}]] |Expertise, [[@{PB}]]*2 }

Then I want a text box that is also a query.

+?{Additional Modifier|0}


I have tried to add it to the r1 line but it is not working.   I think it is because of the { [ ] } wrapping is getting jumbled in my head.


My code is as follows:

@{selected|wtype}&{template:simple} @{selected|rtype}?{Stat

|Strength,+[[@{selected|strength_mod}]][STR] ]]}} {{rname=^{strength-u}}} {{mod=[[ [[@{selected|strength_mod}]][STR] ]]}} {{r1=[[@{selected|d20}+[[@{selected|strength_mod}]][STR] ]]

|Dexterity,+[[@{selected|dexterity_mod}]][DEX] ]]}} {{rname=^{dexterity-u}}} {{mod=[[ [[@{selected|dexterity_mod}]][DEX] ]]}} {{r1=[[@{selected|d20}+[[@{selected|dexterity_mod}]][DEX] ]]

|Constitution,+[[@{selected|constitution_mod}]][CON] ]]}} {{rname=^{constitution-u}}} {{mod=[[ [[@{selected|constitution_mod}]][CON] ]]}} {{r1=[[@{selected|d20}+[[@{selected|constitution_mod}]][CON] ]]

|Intelligence,+[[@{selected|intelligence_mod}]][INT] ]]}} {{rname=^{intelligence-u}}} {{mod=[[ [[@{selected|intelligence_mod}]][INT] ]]}} {{r1=[[@{selected|d20}+[[@{selected|intelligence_mod}]][INT] ]]

|Wisdom,+[[@{selected|wisdom_mod}]][WIS] ]]}} {{rname=^{wisdom-u}}} {{mod=[[ [[@{selected|wisdom_mod}]][WIS] ]]}} {{r1=[[@{selected|d20}+[[@{selected|wisdom_mod}]][WIS] ]]

|Charisma,+[[@{selected|charisma_mod}]][CHA] ]]}} {{rname=^{charisma-u}}} {{mod=[[ [[@{selected|charisma_mod}]][CHA] ]]}} {{r1=[[@{selected|d20}+[[@{selected|charisma_mod}]][CHA] ]]

}}} @{selected|global_skill_mod} @{selected|charname_output}

November 13 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

It's most likely because of this: https://wiki.roll20.net/Macros#Advanced_Usage_for_Roll_Queries

When nesting macros, any } will be interpreted as the end of the query, causing issues, requiring you to replace the nested } characters with the html substitution. The same occurs with commas and pipes "|". 

November 13 (5 years ago)

Thanks GiGis.  I was wondering about that.   I tried to fix it with those but got no closer to a solution.  In fact, it stopped working altogether.

I was trying to add it to each of the dropdown ability scores, like this Strength example:


|Strength,+[[@{selected|strength_mod}]][STR] ]]}} {{rname=^{strength-u}}} {{mod=[[ [[@{selected|strength_mod}]][STR] ]]}} {{r1=[[@{selected|d20}+[[@{selected|strength_mod}+?{Proficient|None, 0|Skilled, [[@{PB}]] |Expertise, [[@{PB}]]*2 &#125+?{Additional Modifier|0&#125]][STR] ]]


Can you steer me in the right direction to getting this to work?


November 13 (5 years ago)

Edited November 13 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

I prefer to avoid using nested macros where roll templates are concerned, I use Chat Menus because they are much simpler (no html nonsense to deal with).

But as a clue, on this line

|Strength,+[[@{selected|strength_mod}]][STR] ]]}} {{rname=^{strength-u}}} {{mod=[[ [[@{selected|strength_mod}]][STR] ]]}} {{r1=[[@{selected|d20}+[[@{selected|strength_mod}]][STR] ]]

i see a LOT of characters that would need to be altered. After the comma, every } character would need to be changed with its entity, except for ones at the end of @{selected|d20} and @{selected|strength_mod}. I dont know if the one at the end of ^{strength-u} needs changing. 


As a Pro user you might look into a script to generate menus for you, like my Universal Chat Menus, or Scott's Menu Maker. Though if you are making custom macros, they wont be much help.

November 13 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

For your addition, 

?{Proficient|None, 0|Skilled, [[@{PB}]] |Expertise, [[@{PB}]]*2 &#125+?{Additional Modifier|0&#125]][STR] ]]

if those are inside a row of the first query, you'll also need to change each | (not inside stat calls) and commas. And some of them you might have to nest twice (see the last section from the wiki i linked). This gets extremely complex.

November 14 (5 years ago)

So, I went right back to the wiki, and came up with a script that works, no character mismatch errors, and does everything mechanically i want

[[?{Ability Check?|Strength, @{selected|strength_mod}|Dexterity, @{selected|dexterity_mod}|Constitution, @{selected|constitution_mod}|Intelligence, @{selected|intelligence_mod}|Wisdom, @{selected|wisdom_mod}|Charisma, 1@{selected|charisma_mod}} + ?{Advantage?|None, 1d20|Advantage, 2d20kh1|Disadvantage, 2d20kl1} + ?{Proficiency?|None, 0|Skilled, @{selected|pb}|Expertise, @{selected|pb} + @{selected|pb}} + ?{Additional Modifier?|0}  ]]

November 14 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

Thats great. Always try to avoid nesting, if you can. It's a minefield :)