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

Roll Template - Drop-Down Prompts for Roll Queries and Formatting

Hi all I have a couple of questions for a Roll Template Im constructing Its probably best explained with pics so Ill attempt to get them below In essence, when a Player Shoots a gun with their character, there are 2 Questions that are asked: - Are they are Short or Long Range? (2 different values that are attributes taken from the Character Sheet, usually a value from -5 to 5, player chooses one) - Are there any additional shooting modifiers (Reduced Visibility, etc)? (Drop down list with values from -5 to 5) I have a lovely template that has been utterly ripped off the the Stargate RPG sheet, (Just like the building Character Sheets, Roll Templates section suggests) So onto questions #1 Can I get the 2 Drop-Down Prompts to be added together and just show the result? Im using {{subtitle=with their @{selected|Weapon01_name} with a ?{Range|Short,@{selected|Weapon01_AccS}|Long,@{selected|Weapon01_AccL}}+?{Additional To Hit Modifiers|No, 0|+1,1|+2,2|+3,3|+4,4|+5,5|-1,-1|-2,-2|-3,-3|-4,-4|-5,-5} range modifier}} as my code. When it gets to the template, its showing up as follows Sorry if its a basic question! #2 My second question is about Light Mode and Dark Mode Dice Highlights In Light mode when you roll a dice, tha background of the dice is Yellow, and in Dark Mode its Purple. Can I change that colour?
Also, is it possible to get a '+' symbol in front of any positive number? Just like when its a negative number it automatically puts in a '-'? Its just formatting wise, a "+1 modifier" reads better than a "1 modifier"
For question 1, you can place the queries together after the template row in an inline roll adding them together, in doubled double brackets, and then reuse that result within the visible row to have it unpacked: {{subtitle=with their @{selected|Weapon01_name} with a $[[0]] range modifier}} [[ [[?{Range|Short,@{selected|Weapon01_AccS}|Long,@{selected|Weapon01_AccL}}+?{Additional To Hit Modifiers|No, 0|+1,1|+2,2|+3,3|+4,4|+5,5|-1,-1|-2,-2|-3,-3|-4,-4|-5,-5}]] ]] For 2, there's no straightforward way, but you can turn that inline roll into a link, and then style it to your liking: [[[1d10]]](#"style=" color: white; background-color: black; font-weight: bold; padding: 2px 4px) For the third question, it is technically doable without API scripting or custom roll parsing - you'll need to make two one-item roll tables, one with a + as the only item, one with a space as the only item - naming these tables "table1" and "table0" respectively (or whatever you want to use in place of table). Then, you check if the modifier is greater than 1, via [[ [[{0, [[?{Range|Short,@{selected|Weapon01_AccS}|Long,@{selected|Weapon01_AccL}}+?{Additional To Hit Modifiers|No, 0|+1,1|+2,2|+3,3|+4,4|+5,5|-1,-1|-2,-2|-3,-3|-4,-4|-5,-5}]]}>1]] ]] after the template row, and call the result into 1t[table$[[X]]], where X is whatever that roll index is by that time in the macro. Honestly, not worth it, if you ask me.
1726242074

Edited 1726246244
timmaugh
Pro
API Scripter
Hey, Gingerwerewolf... Here is some information that will hopefully help. 1. Can you add the modifiers together? Yes. Inline rolls resolve after queries, so just put those values in an inline roll: [[?{Range|Short,-2|Long,3}+(?{Additional To Hit Modifiers|No,0|+1,1|+2,2|+3,3|+4,4|+5,5|-1,-1|-2,-2|-3,-3|-4,-4|-5,-5})]] Now, that's going to show up as an inline roll -- with all of the formatting you referenced in your second post. If you want to change that, see the answer to question 2... 2. Inline Roll formatting You can't change the way Roll20 wants to format the inline rolls, nor can you detect whether someone is on light/dark mode... nor would that help you if yoiu could because there just isn't that granularity to how Roll20 sends messages (different players could have different settings, but only a single message is sent from Roll20 when something hits the chat). You might be able to use something like Stylus... but that would only affect your display; not the display of anyone else in the game. However... I'm not sure if this post offers a solution that will work with inline rolls or not. I haven't tried, but I figured I would point it out. Also, if you use the Metascript Toolbox, you can remove all that formatting of an inline roll (that is, just extract the value of the roll and ditch the rest). Using the toolbox would mean a) starting the line with a bang, 2) including a {&simple} at some point in the roll to output your message when processing was finished, and 3) using metascript constructions within it. For instance, by appending: .value to the end of an inline roll (or roll marker), you can extract the value of the roll and ditch the inline roll formatting. Using that with the inline roll example I included, above, that would be: [[?{Range|Short,-2|Long,3}+(?{Additional To Hit Modifiers|No,0|+1,1|+2,2|+3,3|+4,4|+5,5|-1,-1|-2,-2|-3,-3|-4,-4|-5,-5})]].value Metascripts might be helpful, because they allow you to accomplish your third question fairly easily... 3) Include a "+" if a number is positive So, once we've engaged the Metascript Toolbox, we can use conditionals in our command line. If we want to include a "+" before the result of a roll if the roll is positive, here's how you can do that (assuming we're looking at roll 0 -- e.g., the first roll in the command line): {&if $[[0]] > 0}+{&end}$[[0]] You could append that roll marker ( $[[0]] ) with the  .value  syntax, again, to have it be not-formatted like an inline roll. Example So, with all of that said, here's an example. I don't have your template, so I'm just going to use your "subtitle" field in the default template... and since I'm using the default template I'll include rows to demonstrate the modifiers that you pick from the queries. You can, of course, extract the parts you need: !&{template:default}{{name=Demonstration}} [[?{Range|Short,@{selected|Weapon01_AccS}|Long,@{selected|Weapon01_AccL}}+(?{Additional To Hit Modifiers|No,0|+1,1|+2,2|+3,3|+4,4|+5,5|-1,-1|-2,-2|-3,-3|-4,-4|-5,-5})]] {{Range=?{Range} }} {{Other Mods=?{Additional To Hit Modifiers} }} {{subtitle=with their @{selected|Weapon01_name} with a {&if $[[0]] > 0}+{&end}$[[0]].value range modifier}} {&simple} And an example output:
Thank you so much guys! Im going to give these a try!
So I just want to say, thank you for the replies, they have been very helpful I had no idea about the Metascript Toolbox - Ill take a look at a later point if thats ok timmaugh I followed both of your ideas to do the Sum, thank you so much for pointing it out! With regards to this section in your post Tuo hyow do I get this to work in a macro? [[[1d10]]](#"style=" color: white; background-color: black; font-weight: bold; padding: 2px 4px)
Gingerwerewolf said: With regards to this section in your post Tuo hyow do I get this to work in a macro? [[[1d10]]](#"style=" color: white; background-color: black; font-weight: bold; padding: 2px 4px) It should work as is, just put whatever inline roll you want in place of [[1d10]]. Just don't try to put multiple separate inline rolls inside a single link styling (nested inline rolls are fine), you'll have to make them links individually - the square brackets involved will break the link if you have multiple separate inline rolls within the link label.