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 .
×

Formulas instead of a values are shown in a resulting roll template window

Hi guys, I need your help once again( I have a following roll template with an idea to have an option to switch between damage types based on value in {{ dmgtype }} - <rolltemplate class="sheet-rolltemplate-FNP35vulnerability"> <div class="container"> <div><h1>{{name}}</h1></div> <div><span class="subheader">{{subtags}}</span></div> <div class="arrow-container"><div class="arrow-right"></div></div> {{#dmgtype}} <div class="rowcolor"><span class="tcat">Incoming Damage: </span>**{{recdmg}}**</div> {{#rollTotal() dmgtype 1}} <div class="rowcolor"><span class="tcat">Damage Type - **Normal**</span></div> <div class="rowcolor"><span class="tcat">Received DMG - </span>{{receiveddmg_1}}</div> {{/rollTotal() dmgtype 1}} {{#rollTotal() dmgtype 2}} <div class="rowcolor"><span class="tcat">Damage Type - **Explosion**</span></div> <div class="rowcolor"><span class="tcat">Received DMG - </span>{{receiveddmg_2}}</div> {{/rollTotal() dmgtype 2}} {{#rollTotal() dmgtype 3}}               <div class="rowcolor"><span class="tcat">Damage Type - **Laser**</span></div>               <div class="rowcolor"><span class="tcat">Received DMG - </span>{{receiveddmg_3}}</div> {{/rollTotal() dmgtype 3}} {{#rollTotal() dmgtype 4}}               <div class="rowcolor"><span class="tcat">Damage Type - **Plasma**</span></div>               <div class="rowcolor"><span class="tcat">Received DMG - </span>{{receiveddmg_4}}</div> {{/rollTotal() dmgtype 4}} {{#rollTotal() dmgtype 5}}               <div class="rowcolor"><span class="tcat">Damage Type - **Fire**</span></div>               <div class="rowcolor"><span class="tcat">Received DMG - </span>{{receiveddmg_5}}</div> {{/rollTotal() dmgtype 5}} {{#rollTotal() dmgtype 6}} <div class="rowcolor"><span class="tcat">Damage Type - **Poison**</span></div> <div class="rowcolor"><span class="tcat">Received DMG - </span>{{receiveddmg_6}}</div> {{/rollTotal() dmgtype 6}} {{#rollTotal() dmgtype 7}} <div class="rowcolor"><span class="tcat">Damage Type - **Radiation**</span></div> <div class="rowcolor"><span class="tcat">Received DMG - </span>{{receiveddmg_7}}</div> {{/rollTotal() dmgtype 7}} {{#rollTotal() dmgtype 8}} <div class="rowcolor"><span class="tcat">Damage Type - **Gas**</span></div> <div class="rowcolor"><span class="tcat">Received DMG - </span>{{receiveddmg_8}}</div> {{/rollTotal() dmgtype 8}} {{#rollTotal() dmgtype 9}} <div class="rowcolor"><span class="tcat">Damage Type - **Electrical**</span></div> <div class="rowcolor"><span class="tcat">Received DMG - </span>{{receiveddmg_9}}</div> {{/rollTotal() dmgtype 9}} {{#rollTotal() dmgtype 10}} <div class="rowcolor"><span class="tcat">Damage Type - **EMP**</span></div> <div class="rowcolor"><span class="tcat">Received DMG - </span>{{receiveddmg_10}}</div> {{/rollTotal() dmgtype 10}} {{/dmgtype}} {{#bonus_description}} <div><span class="tcat">Bonus Description - </span>{{bonus_description}}</div> {{/bonus_description}} </div> </rolltemplate> This template is used in this roll macro (linespacing added for better clarity) -  &{template:FNP35vulnerability} {{name=**Armor absorption**}} {{subtags=**@{character_name}** tries not to die!}} {{recdmg=@{incoming_dmg}}} {{dmgtype= [[ ?{Damage Type|Normal, 1|Explosion, 2|Laser, 3|Plasma, 4|Fire, 5|Poison, 6|Radiation, 7|Gas, 8|Electrical, 9|EMP, 10} ]]}} {{receiveddmg_1=@{armor_normal_absorb_calc}}} {{receiveddmg_2=@{armor_explosion_absorb_calc}}} {{receiveddmg_3=@{armor_laser_absorb_calc}}} {{receiveddmg_4=@{armor_plasma_absorb_calc}}} {{receiveddmg_5=@{armor_fire_absorb_calc}}} {{receiveddmg_6=@{poison_absorb_calc}}} {{receiveddmg_7=@{radiation_absorb_calc}}} {{receiveddmg_8=@{gas_absorb_calc}}} {{receiveddmg_9=@{electrical_absorb_calc}}} {{receiveddmg_10=@{emp_absorb_calc}}} {{bonus_description=?{Bonus description|None}}} For every absorbtion time I have some hidden calculation in a sheet because I have to insure that values are not below zero <input type="hidden" name="attr_armor_normal_dt_calc" title="@{armor_normal_dt_calc}" value="[[ { [[ floor([[@{armor_normal_dt}]]*((100+[[@{armor_condition_current}]])/100)) + @{misc_dt_modifier}+@{ammo_dt_modifier} ]] + 0d0,{0}}d1 ]]" /> <input type="hidden" name="attr_armor_normal_absorb_calc" title="@{armor_normal_absorb_calc}" value="[[ { [[ floor( (@{incoming_dmg} - [[@{armor_normal_dt_calc}]]*@{ammo_dt_multiplier}*@{incoming_bullets})*(100 - @{common_dr} - @{armor_dr}*( 1+[[@{armor_condition_current}]]/100) )/100 ) ]] + 0d0, {0}}d1 ]] " /> And here is a problem - If I use a macro for a first dmg type - it is working fine If I chose the 2nd dmgtype or any other - the result is like this   I tested all separate calculations in a form of a simple macro ( like @{selected| armor_normal_absorb_calc } ) - and they are all work as expected. I'm getting a calculated value as a result. Also I tried to substitute "}" and "," for html codes - does not help. It seems it is a problem in a template design. Could someone advise what am I doing wrong?
1625442211

Edited 1625442236
vÍnce
Pro
Sheet Author
I would start troubleshooting by just entering a flat number in your damage macro. example; <input type="hidden" name="attr_armor_normal_absorb_calc" title="@{armor_normal_absorb_calc}" value="[[ 99 ]] " /> See if that evaluates.  If a flat number works, there must be something wrong with the macro and/or individual attributes.
1625473432

Edited 1625474545
Oosh
Sheet Author
API Scripter
It's probably this bit at the end of the absorb_calc: ...0d0, {0}}d1 ]] A double }} brace will close the current template field before it gets to the closing ]] roll brackets. I'm not sure why the "normal" dmgtype is working, though - it should also be broken. Either way, you can rewrite it a couple of ways. Since you're already turning your main calculation into an integer with an [[ inner roll ]], you can just do { [[ floor( <big calculation> ) ]], 0 }d1. You should only need the 0d0 trick if you have an exposed die roll, like: { 2d20 - 50, 0d0 }d1 Or... you can just leave it as is, but throw a space in between the braces to stop it closing out the template property: ...0d0, {0} }d1 ]]
Thx guys for all your advices, I've tried to change the formulas but in the end I found a crude solution. It seems that this is working - [[ @{armor_explosion_absorb_calc}]] &{template:FNP35vulnerability} {{name=**Resistance roll**}} {{subtags=**@{character_name}** tries not to die!}} {{recdmg=@{incoming_dmg}}} {{dmgtype= [[ ?{Damage Type|Poison, 6|Radiation, 7|Gas, 8|Electrical, 9|EMP, 10} ]]}} {{receiveddmg_6=[[@{poison_absorb_calc}]]}} {{receiveddmg_7=[[@{radiation_absorb_calc}]]}} {{receiveddmg_8=[[@{gas_absorb_calc}]]}} {{receiveddmg_9=[[@{electrical_absorb_calc}]]}} {{receiveddmg_10=[[@{emp_absorb_calc}]]}} {{bonus_description=?{Bonus description|None}}}" /> This short version now working well.