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

Return Values for Roll-Queries?

Hello, I'm trying to create a conditional statement using (math only), with the return value of a roll-query ( i.e.,1d20 standard, 2d20kh1 advantange, 2d20kl1 disadvantage ).  I've placed the roll query logic into an ability that I'm referencing inside the conditional.  Nothing is being returned and I believe it's due to the return value of the roll-query  (12 + 17)  for advantage, or  (2 + 7)  for disadvantage.  Is my assumptions right?  Here's the code for the math conditional (which I'm using to determine if I rolled a critical or not) [[{ [[%{Aydon Keel|Attack-Type}]] , 16}>17 *([[1d6]]) ]] (note: I've Italicized the area I believe is the issue) Here's the code for the Attack-Type/roll-query &{template:default} ?{Attack Type|Standard, 1d20cs>17|Advantage, 2d20kh1cs>17|Disadvantage, 2d20kl1cs>17}{{[[?{Attack Type}]]}} This does work when I reference the ability from another one that's not using the mathimatical conditional for example: %{Aydon Keel|Attack-Type}
1677776016
The Aaron
Roll20 Production Team
API Scripter
I've not tried it, but just looking at it, it's likely because the ability results in a template, not a number. &{template:default} ?{Attack Type|Standard, 1d20cs>17|Advantage, 2d20kh1cs>17|Disadvantage, 2d20kl1cs>17}{{[[?{Attack Type}]]}} should probably just be: ?{Attack Type|Standard, 1d20cs>17|Advantage, 2d20kh1cs>17|Disadvantage, 2d20kl1cs>17} You could put that in an attribute, and then reference it in the ability and in the conditional. &{template:default} {{[[@{Aydon Keel|Attack-Type-Attr}]]}} [[{ [[@{Aydon Keel|Attack-Type-Attr}]] , 16}>17 *([[1d6]]) ]] (note: I've Italicized the area I believe is the issue) And I'm guessing it would work...
1677776556

Edited 1677776577
Hey Aaron, just tried removing the &{template:default} and it didn't work.  Will try adding it as an attribute.  Thanks
1677777314

Edited 1677777447
Just tried adding it as an attribute and I noticed that the return value from the roll-query is always the same.  The modifier value (i.e., '4' in this case changes but the x value is always '2').
1677778980

Edited 1677779027
GiGs
Pro
Sheet Author
API Scripter
The syntax for this isn't right: &{template:default} ?{Attack Type|Standard, 1d20cs>17|Advantage, 2d20kh1cs>17|Disadvantage, 2d20kl1cs>17}{{[[?{Attack Type}]]}} If you want to make an attack roll in the middle, you need to surround it with a label and inline roll brackets, like {{Attack=[[ your roll goes here ]]}}, like &{template:default} {{attack=[[?{Attack Type|Standard, 1d20cs>17|Advantage, 2d20kh1cs>17|Disadvantage, 2d20kl1cs>17}]]}} {{[[?{Attack Type}]]}} The attackType at the end also seems not to fit. What is that supposed to do?
1677781297

Edited 1677781498
Hey Gigs, {{[[?{Attack Type}]]}} returns the value back to the chat window.   Also, I'm trying to construct an ability roll by referencing partial abilities/scripts so I'm not trying to create a roll in this specific ability.
1677781375
timmaugh
Forum Champion
API Scripter
Given... ...a character of that name, and ...that character having an ability named "Attack-Type", and ...the Attack-Type ability consisting of this text: ?{Attack Type|Standard, 1d20cs>17|Advantage, 2d20kh1cs>17|Disadvantage, 2d20kl1cs>17} This works for me: &{template:default}}{{name=Attack (%{Aydon Keel|Attack-Type})}}[[{[[%{Aydon Keel|Attack-Type}]],16}>17*[[1d6]]]]{{Roll=$[[0]]}}{{Final=$[[2]]}} It also works if I move the roll query to an attribute named "Attack-Type-Attr" and modify the command line accordingly.
1677781869

Edited 1677781955
timmaugh
Forum Champion
API Scripter
Also, be aware that if you put that same roll query in a series of inline rolls, they will produce different/independent results. This is because your supply the equation for an inline roll. Every time you put an equation in the double brackets of an inline roll, you ask Roll20 to evaluate the equation and generate the random results of the dice, as needed. Consider: &{template:default}}{{name=Unique Rolls}}{{Roll 1=[[%{Aydon Keel|Attack-Type}]]}}{{Roll 2=[[%{Aydon Keel|Attack-Type}]]}}{{Roll 3=[[%{Aydon Keel|Attack-Type}]]}}{{Roll 4=[[%{Aydon Keel|Attack-Type}]]}}{{Roll 5=[[%{Aydon Keel|Attack-Type}]]}} So the only way to get the actual numbers from the roll you made that was involved in the conditional... is to reference the roll index of THAT roll. That's what I did in my previous example, pointing the Roll section at the d20 component and the Final section at the whole roll (including the conditional). In your original setup, returning the Attack Type to the command line as you said to GiGs, you were not presenting the correct result of the roll evaluation as was used for the conditional evaluation. You were presenting a new evaluation of the expression.
Ah!  Thank you Tim Maugh.  I truly appreciate the help!