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

Another nested query question (5e)

1508961235

Edited 1508961918
Hi all, I suspect this is a common problem but could not find why this wouldn't work properly. I am attempting to create a simple dice macro with a nested query on a 5e character. I've successfully made multiple nested queries in other macros before (on a 3.5 sheet) but for some reason cannot seem to get this one to function properly once the "Custom" option is selected. No syntax error is thrown. I've placed spaces in the html code for the closed brackets just in case they get converted when I post this. &{template:npc} {{?{Roll Type?|Normal,always|Advantage,advantage|Disadvantage,disadvantage}=1}} {{rname=?{D?|4,D4|6,D6|8,D8|10,D10|12,D12|20,D20|100,D100|Custom,Rolling...?{How many& # 125;d?{Die type& # 125;}}} {{r1=[[?{D?|4,1d4|6,1d6|8,1d8|10,1d10|12,1d12|20,1d20|100,1d100|Custom,?{How many& # 125;d?{Die type& # 125;}]]}} {{r2=[[?{D?|4,1d4|6,1d6|8,1d8|10,1d10|12,1d12|20,1d20|100,1d100|Custom,?{How many& # 125;d?{Die type& # 125;}]]}} Any suggestions? The stand alone version works just fine: &{template:npc} {{?{Roll Type?|Normal,always|Advantage,advantage|Disadvantage,disadvantage}=1}} {{rname=Rolling...?{How many}d?{Die type} }} {{r1=[[?{How many}d?{Die type}]]}} {{r2=[[?{How many}d?{Die type}]]}}
When you Submit a Roll Query (i.e. assign it a value), every following Roll Query that shares the same name is parsed to the value of the first. e.g. If you Submit the default value of ?{One|1}, all future Roll Queries named 'One' will be parsed to '1'. [[ ?{One|1|1} + ?{One} + ?{One|2d6} ]] equals three So, when the "Custom" option is selected, your inline rolls are broken (e.g. [[Rolling...]] will break your macro). Here's my suggestion: &{template:npc} {{?{Roll Type?|Normal,always|Advantage,advantage|Disadvantage,disadvantage}=1}} {{rname=?{D?|d4|d6|d8|d10|d12|d20|d100|Custom,?{How many|1}d?{Die type|2}}}} {{mod=}} {{r1=[[?{D?}]]}} {{r2=[[?{D?}]]}}
Doh, wow. Thanks. I'll leave this up as a testament to my doofusness.
1508962221

Edited 1508962247
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
So, the issue with the macro is this: Roll queries will only resolve to a single value, so your two versions of the ?{D?} macro do not give two different results. This probably hasn't shown as a problem because simply doing dX is a valid alternate syntax for 1dX, and the dice engine is probably not case sensitive for that. This means that when your macro resolves, it is attempting to do an inline roll of [[Rolling...XdY]] , which is not a valid roll. Not sure why it doesn't give you a roll error, but I've seen queries bypass the roll error detection before. Change your macro to this: &{template:npc} {{?{Roll Type?|Normal,always|Advantage,advantage|Disadvantage,disadvantage}=1}} {{rname=Rolling...?{D?|4,1D4|6,1D6|8,1D8|10,1D10|12,1D12|20,1D20|100,1D100|Custom,?{How many}d?{Die type}}}} {{mod=}} {{r1=[[?{D?}]]}} {{r2=[[?{D?}]]}} Ninja'd by Silvyre ;)
Thanks to you both. They're elegant solutions.