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 .
×
Advertisement Create a free account

Variables and Queries inside the Default Template

1587674628
I am trying to use the default template provided by roll20.net &{template:default} {{name=Test Attack}} {{attack=[[1d20]]}} {{damage=[[2d6]]}} And I would like to fit this into it. &{template:default} {{ name=?{Skill|Skill} }} {{I rolled=?{Advantage| No, [[d20]] | Yes, [[2d20k1]]} + ?{Inspired|No, 0|Yes, [[D4]]} +?{Modifier|0}}} For the most part it works, it will roll 1 Die 20 or 2 Die 20 based off of Advantage, It will Roll a D4 if you answer Yes and it will ask for the Modifier. What it won't do is sum them into a total. What I end up with is this. If every thing was working like I'm trying to get it to work it would look similar to this. Except it would include the modifier and the result on the D4 in the total. It works if I don't put it into the Roll Template /roll ?{Advantage| No, [[d20]] | Yes, [[2d20k1]]} + ?{Inspired|No, 0|Yes, [[D4]]} +?{Modifier|0} Thank you in advance for any help you are able to provide.
1587676895

Edited 1587676998
GiGs
Pro
Sheet Author
API Scripter
You need to wrap the whole calculation in inline roll brackets. &{template:default}{{name=?{Skill|Skill}}}{{I rolled=[[?{Advantage|No,[[d20]]|Yes,[[2d20k1]]}+?{Inspired|No,0|Yes,[[D4]]}+?{Modifier|0}]]}} Edit: I removed a bunch of spaces you can see it all. This will probably make the name line work properly too.
1587754861
So that works great! Now just a aesthetics question, When selecting roll with advantage and inspired using the 3D dice it only rolls the D4. If you select advantage and not inspired it will roll 2d20. If possible if your bored :) I'd like to see it throw all three die when selecting Advantage and Inspired?
1587758588
GiGs
Pro
Sheet Author
API Scripter
I dont think there's any way to do that without nesting queries, which get very tricky . But the reason you 3d dice dont work properly, is because there are too many inline roll brackets. Here's one with them cut down &{template:default}{{name=?{Skill|Skill}}}{{I rolled=[[?{Advantage|No,1d20|Yes,2d20k1}+?{Inspired|No,0|Yes,D4}+?{Modifier|0}]]}}
1587829638
That worked perfectly! Thanks so much for your time and assistance.
1587829897
GiGs
Pro
Sheet Author
API Scripter
Great :)