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

Is there a way to format the result of a value expression in a drop down macro?

1452031226

Edited 1452032323
So I'm using this macro ?{Current BS?| Normal, [[d6+3>7]] |-1,[[d6+2>7]] |-2,[[d6+1>7]]} as an easy way to roll for hits for a unit with a Ballistic Skill of 3 that fires one shot. [s] The problem is that the output in the chat box is just a "0" or a "1", indicating the number of successful rolls.  I'd like to be able to output a text string with the result, so that it will say "1 Hit(s)".  Is this possible? [/s]   EDIT: Sooo... I'm an idiot. Any text after the ]] but before the | just gets output in the chat box. Hopefully this post will help someone else, lol. Additionally, I'd like to be able to set the output to "0 Hits" if the result of the d6 is a 1, regardless of the modifiers applied to the expression. I'm just trying to pretty up the output so that the flow of the game is really clear, but if this isn't possible, it's not a big deal.
1452032273

Edited 1452032620
Silvyre
Forum Champion
Within your inline rolls, you're missing the curly braces necessary to format a Grouped Roll with a success check . I would append the "Hit(s)" outside of your Roll Query.
Silvyre said: Within your inline rolls, you're missing the curly braces necessary to format a Grouped Roll with a success check . I would append the "Hit(s)" outside of your Roll Query. I just figured this out at the same time, haha.  Thanks for the quick response!
1452032644

Edited 1452032908
Silvyre
Forum Champion
Great! Completely optionally, you could factor out the elements common to each value field in the Roll Query. e.g. ?{Q|A, [[1d20 + 1]]|B, [[1d20 + 2]]|C, [[1d20 + 3]]} → [[ 1d20 + 1 + ?{Q|A, 0|B, 1|C, 2} ]] This would save the pain of dealing with HTML entities— the use of which is necessitated by the syntax of Grouped Roll .
1452033172

Edited 1452034095
Silvyre said: Great! Completely optionally, you could factor out the elements common to each value field in the Roll Query. e.g. ?{Q|A, [[1d20 + 1]]|B, [[1d20 + 2]]|C, [[1d20 + 3]]} → [[ 1d20 + 1 + ?{Q|A, 0|B, 1|C, 2} ]] This would save the pain of dealing with HTML entities, as necessitated by the syntax of Grouped Roll . I just did this and it's soooo much cleaner looking.  Thanks! Is there any way to cause the success check to automatically fail if the result of d6 is a 1, regardless of what the Grouped Roll evaluates to?  Roll20 already lets you know by putting a red outline around the output if the d6 was a 1, but it still outputs 1 success if the Grouped Roll evaluates to a value greater than or equal to the check. EDIT:  So what I have now is (I made it use the unit's attribute now):  [[d6+@{Ballistic Skill} + ?{Any change in BS?|0, 0|-1, -1|-2, -2|+1, 1} ]] hits Where do I put the ">7" to make the check?  The above macro just adds the result of d6 to the prompt and outputs that.
1452034523
Silvyre
Forum Champion
Nic said: EDIT:  So what I have now is (I made it use the unit's attribute now):  [[d6+@{Ballistic Skill} + ?{Any change in BS?|0, 0|-1, -1|-2, -2|+1, 1} ]] hits Where do I put the ">7" to make the check? You'd place it essentially right before the closing brackets of the inline roll, after wrapping everything in the inline roll in curly braces (to group the roll). Also, optionally; ?{Any change in BS?|0, 0|-1, -1|-2, -2|+1, 1} = ?{Any change in BS?|0|-1|-2|(+1)}
Silvyre said: Nic said: EDIT:  So what I have now is (I made it use the unit's attribute now):  [[d6+@{Ballistic Skill} + ?{Any change in BS?|0, 0|-1, -1|-2, -2|+1, 1} ]] hits Where do I put the ">7" to make the check? You'd place it essentially right before the closing brackets of the inline roll, after wrapping everything in the inline roll in curly braces (to group the roll). Also, optionally; ?{Any change in BS?|0, 0|-1, -1|-2, -2|+1, 1} = ?{Any change in BS?|0|-1|-2|(+1)} Roger.  One last question.  Is this [[{3d6 + @{Ballistic Skill} + ?{Any change in BS?|0|-1|-2|(+1)}}>7]] hits Actually rolling 3 d6 and adding the attribute and selected modifier to each roll, or something else entirely?  The stuff that shows up when you mouseover the output is kinda ambiguous, it says (the Ballistic Skill attribute is 3 and I am selecting 0 from the drop down): Rolling {3d6 + 3 + 0}>7 = {(4+3+4)+3+0}  and the output says "2 hits", which is what I would expect if the math is working the way I wanted it to, but the mouseover part looks to me like it's trying to add the 3d6 together before adding Ballistic Skill and the selected modifier.  Probably because I don't understand the syntax, so is there documentation for syntax somewhere? Also, if I put a space in between the }} and then >7, it gives me a bunch of bizarre results.  Is this a bug or something I would understand if I understood the syntax better?
1452050282

Edited 1452050957
Silvyre
Forum Champion
Nic said: One last question.  Is this [[{3d6 + @{Ballistic Skill} + ?{Any change in BS?|0|-1|-2|(+1)}}>7]] hits Actually rolling 3 d6 and adding the attribute and selected modifier to each roll It is indeed (although this is one of the instances in which the inline roll's tooltip can be a bit confusing/misleading). Nic said: Also, if I put a space in between the }} and then >7, it gives me a bunch of bizarre results.  Is this a bug or something I would understand if I understood the syntax better? Not a bug; the parser is just a bit sensitive in regards to syntax, here. Unfortunately, there's not currently much documentation on the tooltips of inline rolls. Nic said: Is there any way to cause the success check to automatically fail if the result of d6 is a 1, regardless of what the Grouped Roll evaluates to? Note how the following two inline rolls are mathematically equivalent: [[ {3d6 + ?{Q}}>[[7 + 0]] ]] [[ {3d6 - 0}>[[7 - ?{Q}]] ]], which can be simplified to [[ 3d6>[[7 - ?{Q}]] ]] Since rolling a 1 on one of the d6's will only count as a success when [[7 - ?{Q}]] ≤ 1, we can wrap this target number within a keep/drop function to ensure that 1's rolled are never considered successes: [[7 - ?{Q}]] → [[ { 7 - ?{Q} , 2}kh1 ]]