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

'Tricking' the default roll template into not displaying lines

Okay, this might be found under Stupid Tricks or somewhere else, but my search-fu has failed me, and I would swear I managed to do this before, but now I can't figure out how. I'm using the default roll template &{template:default} and trying to figure out how to nest queries to make lines disappear. When the template is parsed and posted, every instance of {{property=something}} must be unique for the property name, even if the result isn't. In this way, I'm looking to setup a multiple-hit ability/macro for the notoriously unfriendly-to-code 40kRPG system, where I can use a query of some type on the property side of the = to trick the template into not displaying unneeded lines. I can use a simple query on the small scale, such as the first property being: {{Hit #1=__DAMAGEFORMULA__}} While the second property is: {{?{Second hit?|No,Hit #1|Yes,Hit #2}=__DAMAGEFORMULA__}} And it will proc correctly - choosing no will use "Hit #1" which is the same property value as the previous line, and when the table is posted that line will disappear because it isn't a unique property name, while choosing yes will give it a different entry and cause the line to display. However, I want to avoid having the player answer yes, yes, yes, yes, no, no, no, no, no to a series of 20 queries, since the table needs to be able to handle up to that many hits in a batched roll. I think this can be done with a carry-through query. I tried using something like this: {{Hit [[{?{Number of hits (1 to 20)?|1},1}kl1]]=__DAMAGEFORMULA}} {{Hit [[{?{Number of hits (1 to 20)?|1},2}kl1]]=__DAMAGEFORMULA}} {{Hit [[{?{Number of hits (1 to 20)?|1},3}kl1]]=__DAMAGEFORMULA}} {{Hit [[{?{Number of hits (1 to 20)?|1},4}kl1]]=__DAMAGEFORMULA}} In the hopes that setting, say, 3 (because answering a query carries that answer through to all identical copies of that query elsewhere in the template) would mean that lines 4 and beyond would all default to {{Hit 3=__}} due to the keep-lower logic and refuse to display due to being duplicate entries, but it seems that the roll engine is counting it as a unique entry due to there being a dice roll even when it's deliberately identical and no dice roll included. I think this may be on purpose, since you wouldn't want a line to be hidden due to a random chance that made it non-unique, but if there's no random element at all, does that still need to trigger?. I would swear that I tripped over this logic previously, but now I can't figure out how I did it. Or I could be wrong and I'm misremembering it. I'm a plus but not pro user, and I don't know enough about HTML or CSS or Java to even consider coding via the API, but I really think there's a way to make the template behave the way that I intend without the API, I'm just missing the right bit of syntax. Thoughts?
First thought is, check to see if you need to do any character substitutions for the code inside your queries.
Where would there be substitutions for this? Greatly simplified example, but illustrates the point with the property name: &{template:default}{{name=Damage against target}}{{Hit [[{?{Number of hits? (1 to 4)|1},1}kl1]]=Head [[1d10]]}}{{Hit [[{?{Number of hits? (1 to 4)|1},2}kl1]]=Head [[1d10]]}}{{Hit [[{?{Number of hits? (1 to 4)|1},3}kl1]]=Right Arm [[1d10]]}}{{Hit [[{?{Number of hits? (1 to 4)|1},4}kl1]]=Torso [[1d10]]}} The only query should ask "Number of hits? (1 to 4)" with 1 as the default answer. If you select 2, it should carry through that answer to every line. Resulting properties should be "Hit 1" "Hit 2" "Hit 2"and "Hit 2" and the duplicates shouldn't display, so the output should yield only 2 lines. Instead, it shows all 4 lines regardless of selection (I suspect because it's treating it as a dice roll, and assuming there's a random element when there isn't).
1539569298

Edited 1539570179
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
You can't use rolls to differentiate (or rather not differentiate) between the rows. This is probably because each roll is unique rather than being the same even if it has the same result. You can however do this (will be quite a few queries unforunately): Change your queries to be have {{ in the answer that causes the line to be displayed instead of what you are currently using: {{Hit #1=__DAMAGEFORMULA__}}  ?{Second hit?|No, |Yes,{{}Hit #2=__DAMAGEFORMULA__}} The incomplete fields simply won't be displayed. Your other option of course is to go through the hell of roll query html replacement and put the entirety of each row in the roll template result. (This is NOT recommended) EDIT: And, just realized I misread the first half of your post. I think your only options here are a custom sheet with a very comprehensive custom roll template or an API script. EDIT the Second: Actually, a trick I've used for some other non standard uses of rolls will work here. There is however a large caveat, which is that you won't be able to hover and see details of any rolls in the macro after the point at which you insert this stupid trick. With that aside here's the stupid trick: You can force rolls to be plain text by adding an extra opening set of inline roll brackets before the roll. Any roll results after that point in the same line (roll templates are a single line for this purpose) will look exactly like the surrounding text, including any markdown formatting. &{template:default}{{name=Damage against target}} [[ {{Hit [[{?{Number of hits? (1 to 4)|1},1}kl1]]=Head [[1d10]]}}{{Hit [[{?{Number of hits? (1 to 4)|1},2}kl1]]=Head [[1d10]]}}{{Hit [[{?{Number of hits? (1 to 4)|1},3}kl1]]=Right Arm [[1d10]]}}{{Hit [[{?{Number of hits? (1 to 4)|1},4}kl1]]=Torso [[1d10]]}} Will give output like this: Something important to keep in mind when hiding fields in this way is that the field that is displayed is the last  field with the same name, not the first.
Wow, that... works exactly as described, but doesn't work for this purpose (need to be able to see critical and fumble results for righteous fury and field burnout chances. Sounds like I'm down to API or finding another way to rework the presentation. Back to the drawing board. Thanks for digging up something at least.
Figured out a less elegant way of doing it, by using a query ?{How many hits?|1} that's slightly different on each hit to force the extras to zero themselves out. &{template:default}{{name=Final damage values for __WEAPONNAME__ against target @{Target|Character_Name}.}}{{Head hits:=[[[[((ceil({0d1+?{How many hits?|1}-3,0d1}kh1/100))*1)]]d10]]}}{{Right Arm Hits:=[[[[((ceil({0d1+?{How many hits?|1}-2,0d1}kh1/100))*1)]]d10]], [[[[((ceil({0d1+?{How many hits?|1}-4,0d1}kh1/100))*1)]]d10]]}}{{Torso Hits:=[[[[((ceil({0d1+?{How many hits?|1},0d1}kh1/100))*1)]]d10]], [[[[((ceil({0d1+?{How many hits?|1}-1,0d1}kh1/100))*1)]]d10]], [[[[((ceil({0d1+?{How many hits?|1}-5,0d1}kh1/100))*1)]]d10]], [[[[((ceil({0d1+?{How many hits?|1}-6,0d1}kh1/100))*1)]]d10]], [[[[((ceil({0d1+?{How many hits?|1}-7,0d1}kh1/100))*1)]]d10]]}} It's going to be ugly coding such a huge number of abilities, given the hit locations, rates of fire, etc, but I think I've got all of the tools I need for it. The mad science experiment should eventually mean that you can click on your token, click an ability button to fire a weapon, answer a few prompts like "Are you aiming?" and "Misc modifier" while pulling the target's size, movement rate, etc from attributes to auto-calc everything, plus having a whispered table with hit locations using [Head](~DamageHead) as the format. Then , the damage buttons in whisper should prompt how many hits, any special triggers, and automatically factor things like the Tank Hunter target and whether the target is a vehicle, which armour facing is struck, how much pen against that armour, felling versus unnatural toughness, sanctified versus daemonic toughness, passive field saves with overload chances, etc and batch those all to a list that gives your final totals - exactly how much damage is suffered to a given location after all of the other math is done invisibly, so that the only thing you need to worry about is adjusting HP and ammo totals. Given the sheer number of hit location patterns and different armour facings, it's going to end up being something stupid like 2000 instances of the base damage formula for each weapon with minor tweaks for armour facing so that the patterns turn out in the correct order, but it should streamline things soooo much during play. ...Or I'll have a psychotic episode. That could be fun too.
Yay for funs !  Then you can actually play the games !