I'm working on a custom character sheet and I want to streamline some of the button pressing for attacks. Right now I have one button for determining a hit, and then another button to calculate damage, but I want to combine those. I also have a bunch of pop-ups that ask for information you can already find on the character sheet. I most of the work done, by brute force, I don't really know javascript. But basically I just want to pass a bunch of values to the startRoll function so I can do a calculation and spit out an answer. <rolltemplate class="sheet-rolltemplate-atkhit"> <div class="sheet-template-container"> <div class="sheet-template-header">{{name}}</div> <div class="sheet-template-row">Target: {{target}}</div> <div class="sheet-template-row">{{keys}}</div> <div class="sheet-template-row">Range: {{range}}</div> <div class="sheet-template-row">Accuracy: {{accr}}</div> <div class="sheet-template-row">Crit: {{critr}}</div> <div class="sheet-template-row">{{pwr}}{{atype}}{{type1}}{{type2}}{{mod}}{{cat}}{{atk}}{{satk}}{{def}}{{sdef}}</div> <div class="sheet-template-row">Damage: [[{{computed::dmg}}]]</div> <div class="sheet-template-row">Effect: {{effect}}</div> </div> </rolltemplate> on('clicked:atk1test', (info) => { startRoll("&{template:atkhit} {{name=@{atk1_name}}} {{target=@{target|character_name}}} {{keys=@{atk1_type} @{atk1_cat} @{atk1_con}}} {{range=@{atk1_range}}} {{accr=[[1d100cs<[[@{Atk1_Acc}+@{Acc}*10-@{target|Evas}*10]]]]}} {{critr=[[1d100cs<[[@{Crit}]]]]}} {{pwr=[[@{atk1_pwr_tot}]]}} {{atype=@{atk1_type}}} {{type1=@{target|type1}}} {{type2=@{target|type2}}} {{mod=[[?{Modifiers|1}]]}} {{cat=@{atk1_cat}}} {{atk=[[@{atk}]]}} {{satk=[[@{satk}]]}} {{def=[[@{target|def}]]}} {{sdef=[[@{target|sdef}]]}} {{effect=[[@{atk1_effect}]]}}", (results) => { const pwr = results.results.pwr.result const atype = results.results.atype.result; const type1 = results.results.type1.result; const type2 = results.results.type2.result; const mod = results.results.mod.result; const cat = results.results.cat.result; const atk = results.results.atk.result; const satk = results.results.satk.result; const def = results.results.def.result; const sdef = results.results.sdef.result; const efftable = { none: {normal: 1, fire: 1, water: 1, electric: 1, grass: 1, ice: 1, fighting: 1, poison: 1, ground: 1, flying: 1, psychic: 1, bug: 1, rock: 1, ghost: 1, dragon: 1, dark: 1, steel: 1, fairy: 1}, normal: {normal: 1, fire: 1, water: 1, electric: 1, grass: 1, ice: 1, fighting: 1, poison: 1, ground: 1, flying: 1, psychic: 1, bug: 1, rock: 0.5, ghost: 0, dragon: 1, dark: 1, steel: 0.5, fairy: 1}, fire: {normal: 1, fire: 0.5, water: 0.5, electric: 1, grass: 2, ice: 2, fighting: 1, poison: 1, ground: 1, flying: 1, psychic: 1, bug: 2, rock: 0.5, ghost: 1, dragon: 0.5, dark: 1, steel: 2, fairy: 1}, water: {normal: 1, fire: 2, water: 0.5, electric: 1, grass: 0.5, ice: 1, fighting: 1, poison: 1, ground: 2, flying: 1, psychic: 1, bug: 1, rock: 2, ghost: 1, dragon: 0.5, dark: 1, steel: 1, fairy: 1}, electric: {normal: 1, fire: 1, water: 2, electric: 0.5, grass: 0.5, ice: 1, fighting: 1, poison: 1, ground: 0, flying: 2, psychic: 1, bug: 1, rock: 1, ghost: 1, dragon: 0.5, dark: 1, steel: 1, fairy: 1}, grass: {normal: 1, fire: 0.5, water: 2, electric: 1, grass: 0.5, ice: 1, fighting: 1, poison: 0.5, ground: 2, flying: 0.5, psychic: 1, bug: 0.5, rock: 2, ghost: 1, dragon: 0.5, dark: 1, steel: 0.5, fairy: 1}, ice: {normal: 1, fire: 0.5, water: 0.5, electric: 1, grass: 2, ice: 0.5, fighting: 1, poison: 1, ground: 2, flying: 2, psychic: 1, bug: 1, rock: 1, ghost: 1, dragon: 2, dark: 1, steel: 0.5, fairy: 1}, fighting: {normal: 2, fire: 1, water: 1, electric: 1, grass: 1, ice: 2, fighting: 1, poison: 0.5, ground: 1, flying: 0.5, psychic: 0.5, bug: 0.5, rock: 2, ghost: 0, dragon: 1, dark: 2, steel: 2, fairy: 0.5}, poison: {normal: 1, fire: 1, water: 1, electric: 1, grass: 2, ice: 1, fighting: 1, poison: 0.5, ground: 0.5, flying: 1, psychic: 1, bug: 1, rock: 0.5, ghost: 0.5, dragon: 1, dark: 1, steel: 0, fairy: 0.5}, ground: {normal: 1, fire: 2, water: 1, electric: 2, grass: 0.5, ice: 1, fighting: 1, poison: 2, ground: 1, flying: 0, psychic: 1, bug: 0.5, rock: 2, ghost: 1, dragon: 1, dark: 1, steel: 2, fairy: 1}, flying: {normal: 1, fire: 1, water: 1, electric: 0.5, grass: 2, ice: 1, fighting: 2, poison: 1, ground: 1, flying: 1, psychic: 1, bug: 2, rock: 0.5, ghost: 1, dragon: 1, dark: 1, steel: 1, fairy: 1}, psychic: {normal: 1, fire: 1, water: 1, electric: 1, grass: 1, ice: 1, fighting: 1, poison: 1, ground: 1, flying: 1, psychic: 1, bug: 1, rock: 1, ghost: 1, dragon: 1, dark: 1, steel: 0.5, fairy: 1}, bug: {normal: 1, fire: 0.5, water: 1, electric: 1, grass: 2, ice: 1, fighting: 0.5, poison: 0.5, ground: 1, flying: 0.5, psychic: 2, bug: 1, rock: 1, ghost: 0.5, dragon: 1, dark: 2, steel: 0.5, fairy: 0.5}, rock: {normal: 1, fire: 2, water: 1, electric: 1, grass: 1, ice: 2, fighting: 0.5, poison: 1, ground: 0.5, flying: 2, psychic: 1, bug: 1, rock: 1, ghost: 1, dragon: 1, dark: 1, steel: 0.5, fairy: 1}, ghost: {normal: 0, fire: 1, water: 1, electric: 1, grass: 1, ice: 1, fighting: 1, poison: 1, ground: 1, flying: 1, psychic: 2, bug: 1, rock: 1, ghost: 2, dragon: 1, dark: 0.5, steel: 1, fairy: 1}, dragon: {normal: 1, fire: 1, water: 1, electric: 1, grass: 1, ice: 1, fighting: 1, poison: 1, ground: 1, flying: 1, psychic: 1, bug: 1, rock: 1, ghost: 1, dragon: 2, dark: 1, steel: 0.5, fairy: 0}, dark: {normal: 1, fire: 1, water: 1, electric: 1, grass: 1, ice: 1, fighting: 0.5, poison: 1, ground: 1, flying: 1, psychic: 2, bug: 1, rock: 1, ghost: 2, dragon: 1, dark: 0.5, steel: 1, fairy: 0.5}, steel: {normal: 1, fire: 0.5, water: 0.5, electric: 0.5, grass: 1, ice: 2, fighting: 1, poison: 1, ground: 1, flying: 1, psychic: 1, bug: 1, rock: 2, ghost: 1, dragon: 1, dark: 1, steel: 0.5, fairy: 2}, fairy: {normal: 1, fire: 0.5, water: 1, electric: 1, grass: 1, ice: 1, fighting: 2, poison: 0.5, ground: 1, flying: 1, psychic: 1, bug: 1, rock: 1, ghost: 1, dragon: 2, dark: 2, steel: 0.5, fairy: 1} }; const eff = efftable[atype[type1]] * efftable[atype[type2]]; console.log(eff); if (cat = "Physical") { const bonus = atk-def; } else { const bonus = satk-sdef; } console.log(bonus); const final = pwr * eff * mod + bonus; console.log(final); const computed = Math.round(final); finishRoll( results.rollId, { dmg: computed, } ); }); }); The rolltemplate works fine up until the Damage line, and that's where all the startRolling code comes in. Some more details pwr is the base power of the attack atype is the type of the attack, type1 and type2 are the types of the target, this is for Pokemon, so these 3 are used to determine the attacks effectiveness (4x, 2x, 1x, 0.5x, 0.25x, 0x) efftable is supposed to be a look up table for effectiveness mod is any other temporary modifiers for the attack cat determines if you use atk vs def or satk vs sdef