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 Tables in Roll Templates or failing that Hiding Sections in a Template

Hi all I'm struggling with some things in the Roll Template - specifically with a way to show more information from a Roll Table.&nbsp; I'm designing my own Roll Template and Character sheet for a transfer of a game from Tabletop to Roll20. Ive got 2 Questions, and if there is no positive answer to question 1, then its onto Question 2 1) I'm pretty sure I know the answer - but is there a way to display the Images from a Roll Table in a Roll Template? The Images would solve this issue immediately. If no, then #2 2) This needs more explanation: Each Weapon has a characteristic, called Firepower, and its a number that ranges from 1 to 3 {Weapon01_RF} - This is the number of Firepower Dice you should roll. Firepower dice have 6 sides, but a strange layout of results 1 = Jam but counts as 1 Shot 2 &amp; 3 = 1 Shot 4 &amp; 5 = 2 Shots 6 = 3 Shots So, this is what Ive put into a Roll Table called Firepower with lovely pictures of the Dice face which make it obvious. Explanation: When a player shoots their gun, they roll a number of firepower dice, and this decides how many shots they get. If they have a Firepower of 2 or 3, then they add the dice results together leading to a result from Jam +1 to 9 Shots depending upon the weapon. So, because the pictures and the way that Tables in Roll Templates work 2 things happen which I do not want. a) They convert the tables to numbers, and display those numbers b) When they add them, they "hide" the Jams So, Ive created a Roll Template which is blatantly stolen from the Stargate one. Im aware that you can have sections that are hidden, and that the Stargate one uses that fact. If there is no Text put into desc for example it wont show the description field. &lt;rolltemplate class="sheet-rolltemplate-necRanged"&gt; &nbsp; &lt;div class="sheet-container sheet-color-{{color}}"&gt; &nbsp;&nbsp;&nbsp; &lt;div class="sheet-header"&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {{#title}}&lt;div class="sheet-title"&gt;&lt;img class="sheet-NecroLogo" src="<a href="https://i.imgur.com/K7Jd5kc.png" rel="nofollow">https://i.imgur.com/K7Jd5kc.png</a>" alt="Necromunda"&gt; &lt;/div&gt;{{/title}} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {{#title}}&lt;div class="sheet-title"&gt;{{title}}&lt;img class="sheet-phoenix" src="<a href="https://i.imgur.com/kSNiWz9.png" rel="nofollow">https://i.imgur.com/kSNiWz9.png</a>" alt="Ranged Shot"&gt; &lt;/div&gt;{{/title}} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {{#subtitle}}&lt;div class="sheet-subtitle"&gt;{{subtitle}}&lt;/div&gt;{{/subtitle}} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {{#RapidFire}}&lt;div class="sheet-RapidFire"&gt;{{RapidFire}}&lt;/div&gt;{{/RapidFire}} &nbsp;&nbsp;&nbsp; &lt;/div&gt; &nbsp;&nbsp;&nbsp; &lt;div class="sheet-content"&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {{#allprops() title subtitle desc color}} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;div class="sheet-key"&gt;{{key}}&lt;/div&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;div class="sheet-value"&gt;{{value}}&lt;/div&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {{/allprops() title subtitle desc color}} &nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {{#desc}}&lt;div class="sheet-desc"&gt;{{desc}}&lt;/div&gt;{{/desc}} &nbsp;&nbsp;&nbsp; &lt;/div&gt; &nbsp; &lt;/div&gt; &lt;/rolltemplate&gt; So, I have made a RapidFire section (Named something else so as not to confuse the Firepower key word Ive used elsewhere) What I would like to do, is have RapidFire section (or line) display a number of times = the Firepower of the Weapon. Below is my Macro that does not do what I want it to &amp;{template:necRanged}} {{title=@{selected|character_name}&amp;#39;s @{selected|Weapon01_name}}} {{subtitle=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}]] to hit modifier}} {{Short Range=0'' -&gt; @{selected|Weapon01_RngS}'' with a @{selected|Weapon01_AccS} modifier}} {{Long Range=@{selected|Weapon01_RngS}'' -&gt; @{selected|Weapon01_RngL}'' with a @{selected|Weapon01_AccL} modifier}} {{Attack Roll= [[1D6+@{selected|BS_bonus}+?{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}]] v&amp;#39;s a BS of @{selected|BS}+ }} {{Weapon Strength= @{selected|Weapon01_Str}}} {{RapidFire=[[1t[Firepower] ]]}} {{RapidFire=[[[[@{selected|Weapon01_RF}-1]] t[Firepower] ]]}} {{RapidFire=[[[[@{selected|Weapon01_RF}-2]]t[Firepower] ]]}} {{desc= @{selected|Weapon01_Traits} }} Below is an easier to read version &amp;{template:necRanged}} {{title=@{selected|character_name}&amp;#39;s @{selected|Weapon01_name}}} {{subtitle=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}]] to hit modifier}} {{Short Range=0'' -&gt; @{selected|Weapon01_RngS}'' with a @{selected|Weapon01_AccS} modifier}} {{Long Range=@{selected|Weapon01_RngS}'' -&gt; @{selected|Weapon01_RngL}'' with a @{selected|Weapon01_AccL} modifier}} {{Attack Roll= [[1D6+@{selected|BS_bonus}+?{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}]] v&amp;#39;s a BS of @{selected|BS}+ }} {{Weapon Strength= @{selected|Weapon01_Str}}} {{RapidFire=[[1t[Firepower] ]]}} {{RapidFire=[[[[@{selected|Weapon01_RF}-1]] t[Firepower] ]]}} {{RapidFire=[[[[@{selected|Weapon01_RF}-2]]t[Firepower] ]]}} {{desc= @{selected|Weapon01_Traits} }} Simply put, how do I get my Roll Template to put in a line for each Firepower Roll? I hope this makes sense
1727696795

Edited 1727697943
If multiple fields in the same template have the same name (the string left of the equation mark), the bottommost field overwrites all the fields with the same name. This is why you can't have multiple RapidFire= fields display - you'll need to give them unique names. (This is actually useful for hiding sections with a few tricks, by making the name dynamic.) EDIT: Oh, and you can use line breaks in the macro if you make sure none of them are outside braces - like this: &amp;{template:necRanged} {{title=@{selected|character_name}&amp;#39;s @{selected|Weapon01_name} }} {{subtitle=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}]] to hit modifier }} {{Short Range=0'' -&gt; @{selected|Weapon01_RngS}'' with a @{selected|Weapon01_AccS} modifier }} {{Long Range=@{selected|Weapon01_RngS}'' -&gt; @{selected|Weapon01_RngL}'' with a @{selected|Weapon01_AccL} modifier }} {{Attack Roll= [[1D6+@{selected|BS_bonus}+?{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}]] v&amp;#39;s a BS of @{selected|BS}+ }} {{Weapon Strength= @{selected|Weapon01_Str} }} {{RapidFire=[[1t[Firepower] ]] }} {{RapidFire=[[[[@{selected|Weapon01_RF}-1]] t[Firepower] ]] }} {{RapidFire=[[[[@{selected|Weapon01_RF}-2]]t[Firepower] ]] }} {{desc= @{selected|Weapon01_Traits} }}
Well thats awesome! Thank you for the info! Ill try using RapidFire01,&nbsp;RapidFire02, RapidFire03, Thanks!
1727702890

Edited 1727702993
timmaugh
Pro
API Scripter
BTW, you can display the image from a rollable table using the MetaScript Toolbox. A simple demonstration: !&amp;{template:default}{{name=Proof}} {{Image=@(table.Firepower.1dW.img)}} {&amp;simple} Variations of the formation: a fixed number:&nbsp; @(table.Firepower.1.img) a roll against the total weight of the table: @(table.Firepower.1dW.img) an inline roll: @(table.Firepower.[[1d10]].value.img) Alternately, you can include the results of multiple attacks of unknown number using a trick discussed here . In that case, a necromancer had a skeleton horde attacking, and each Skeleton had a new entry in the template, numbered as to their position (so rows wouldn't overwrite. That example used the default template so I could have new template fields for each skeleton. That said, you could put all of the results in a single template field in your necRanged template and separate them using the {&amp;nl} tag. That would format the output to be on different lines within the field. The {&amp;nl} tag is&nbsp; discussed here .
Thank you so much Timmaugh for the advice of your MetaScript Toolbox! Its great! A couple of questions, if its not too much trouble I noted that the [[calculated]] colours have now changed from (in dark mode) Purple to Yellow How can I turn it back, or to permanently Purple as my game is designed to be Green on Black Writing even in Dark Mode. Secondly How would you advise I go about rolling a number of "Tables" equal to each Weapons characteristic, called Firepower, and its a number that ranges from 1 to 3 {Weapon0X_RF} Originally I did it by just using {{desc= [[1t[Firepower] ]] &amp;#38; [[[[@{selected|Weapon02_RF}-1]]t[Firepower] ]] &amp;#38; [[[[@{selected|Weapon02_RF}-2]]t[Firepower] ]]}} That allowed when I rolled on a Table values of 0 or -1 as the number of times, the result was 0 but now, it rolls the lowest value of the Roll Table.
I see you have a IF ELSEIF and ELSE logic, but Im not sure as to how you implement the code (Ive checked the Roll20 Wiki, if there is another location please let me know!)
1727961873
GiGs
Pro
Sheet Author
API Scripter
Tuo said: EDIT: Oh, and you can use line breaks in the macro if you make sure none of them are outside braces - like this: &amp;{template:necRanged} {{title=@{selected|character_name}&amp;#39;s @{selected|Weapon01_name} }} {{subtitle=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}]] to hit modifier That's probably a tip for the Useful Tricks thread. I was aware of it but had never thought of using it as advice, and it is a really handy trick to know.
1727962767
timmaugh
Pro
API Scripter
Hi Gingerwerewolf... Unfortunately, the colors of inline rolls comes from Roll20, and the only way to change it after the fact is to implement a browser extension like Stylus -- but that will only change it for you. Each of your players would have to implement the same ruleset in order for them to see the same thing. If you end up using the Metascript Toolbox and render inline rolls from there, that uses a script library to build the format of the presented result. The script library, called libInline, was written before dark mode was a thing on Roll20, so it was built to simply mimic the original presentation of the rolls. Since I'm the one that released libInline, I could potentially open up a way to format the rolls with a custom color. Obviously, if that worked, it would only work for times when that script library was used for rendering the rolls -- like when the Metascript Toolbox outputs the result. I will put it on my list to take a look at that code to see if there is a way to smartly open up a configurable option. Regarding rolling from a series of tables equal to a weapon attribute value, I *think* I would probably end up using IF/ELSE conditional logic (though there might be other options available, like the sort of loop I used in that necromancer example I linked to). I'm not sure I *completely* understand your setup completely, but if I have the general sense of it that a "1" in the Weapon0X_RF attribute would mean a single result drawn from the Firepower table, a "2" would mean two results from the same table, etc... then you should be able to use conditionals like this: {{RapidFire=[[1t[Firepower]]] {&amp;if @{selected|Weapon02_RF} &gt; 1 }{&amp;nl}[[1t[Firepower]]]{&amp;end} {&amp;if @{selected|Weapon02_RF} &gt; 2}{&amp;nl}[[1t[Firepower]]]({&amp;end})}} (note that I wrapped the last END tag in parentheses -- an option of the APILogic conditional syntax -- because it would otherwise abut the double closing braces of the template part and could interact with the way the message is presented.) That would be one way to present it, with all (potentially) 3 returns being in the same field in the template (I haven't&nbsp; used that template so I'm not sure how the new line characters will render). In any case, that's just an example of using the IF/THEN logic -- if it doesn't present cleanly, post back with more information and we can pound it into shape. Remember that for the metascripts to work, you have to prepend your line with a bang and include {&amp;simple} somewhere in the command line (somewhere that survives -- so it can't be in the FALSE outcome of a conditional check if you want it to work at the end of the metascript processing). More information about using this bang + {&amp;simple} syntax is discussed in this video I released discussing how the metascripts work. Also, if you're looking for the IF/THEN conditional syntax you can look at the original forum thread for APILogic (this was before it was rolled into the Metascript Toolbox), or the wiki article for it. Again, those sources are a bit dated, so if you run into something that doesn't work, post back and I can let you know if something has changed or if there's a better way to do what you're trying to do.
Ignore me, I think Ive found it! <a href="https://wiki.roll20.net/APILogic" rel="nofollow">https://wiki.roll20.net/APILogic</a>
1727968838
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Since you are building your own sheet for this, you can do all of this within the sheet, no API needed. Instead of a rollable table, put the data in the sheet Use startRoll to handle the dice logic Roll template styling to control inline roll look and color&nbsp;
Sorry timmaugh I didnt see your reply! Thank you so much!