Hello, I have the following setup and I'm trying to get it to work.... Goal: Determine the dice to be rolled based on an attribute. The attribute is determined based on some math including two other attributes. attr_sub_skill_attack_dice_cost (How many points it takes to increase dice by 1) attr_sub_skill_attack_dice_paid (how many points have been paid into the cost). attr_sub_skill_attack_dice_total (this should be *.cost / *.paid) Based on the Total, java script should read the number from the total and pick the dice from the array. This is the code I am starting with.... < input type =" number " name =" attr_sub_skill_attack " value =" 10 "> < input name =" attr_sub_skill_attack_dice " value ="" readonly > < button type =" roll " value =" [[@{sub_skill_attack_dice}]] " name =" roll_sub_skill_attack_dice "> Test Roll </ button > < script type =" text/worker "> on ( ' change:sub_skill_attack_dice_paid ' ) , function ( eventInfo ) { getAttrs ([ ' sub_skill_attack_dice_cost ' , ' sub_skill_attack_dice_paid ' ] , function ( values ) { setAttrs ( { sub_skill_attack_dice_total : Math . floor ( values . sub_skill_attack_dice_cost / sub_skill_attack_dice_paid ) } ) ; } ) ; } ) ; const dice_values = [ ' 1 ' , ' 1D2 ' , ' 1D4 ' , ' 1D6 ' , ' 1D8 ' , ' 1D10 ' , ' 1D12 ' , ' 2D6 ' , ' 2D8 ' , ' 3d6 ' , ' 2D10 ' , ' 2D12 ' , ' 3d8 ' , ' 4D6 ' , ' 3d10 ' , ' 5d6 ' , ' 4D8 ' , ' 3d12 ' , ' 6dd ' , ' 4D10 ' , ' 7d6 ' , ' 4d12 ' , ' 6D8 ' , ' 8D6 ' , ' 5d10 ' , ' 7d8 ' , ' 5D12 ' , ' 6d10 ' , ' 8D8 ' , ' 7D10 ' , ' 6D12 ' , ' 8d10 ' , ' 7d12 ' , ' 9D10 ' , ' 8d12 ' , ' 10d10 ' , ' 9d12 ' , ' 11D10 ' , ' 10D12 ' , ' 12D10 ' , ' 12d12 ' , ' 8d20 ' , ' 10d20 ' , ' 12d20 ' , ' 20d20 ' ] ; const stat_names = [ ' sub_skill_attack ' ] ; const name_end = ' dice ' ; //if you want to use a different name end, change it here. stat_names . forEach (stat => { on ( ` change: ${ stat }` , () => { getAttrs ([ stat ] , v => { const score = + v [ stat ] || 0 ; const dice = dice_values [ Math . max ( 0 , Math . min ( dice_values . length - 1 , score ))] ; setAttrs ( { [ `${ stat } _ ${ name_end }` ] : dice } ) ; } ) ; } ) ; } ) ; </ script > And this is what I have now. </ td > < td class =" skill-input ">< input class =" inputfield text " style =" width: 50px; " type =" number " default =" 0 " name =" attr_skillPoints " min =" 0 " max =" 999 "/></ td > </ tr > < tr > < td colspan =" 8 " ; class =" subheading " style =' line-height: 40px; position: centered; '> Ability Sub-Skills </ td > </ tr > < tr > < td class =" ability-subSkillProperty "> SubSkill Rolls </ td > < td >< button type =" roll " value =" [[@{sub_skill_attack_dice_total}]] " name =" roll_sub_skill_attack_dice_total "> Test Roll </ button ></ td > < td ></ td > </ tr > < tr > < td > Dice Cost </ td > < td >< input type =" number " name =" attr_sub_skill_attack_dice_cost " value =" 5 "></ td > </ tr > < tr > < td > Dice Paid </ td > < td >< input type =" number " name =" attr_sub_skill_attack_dice_paid " value =" 10 "></ td > </ tr > < tr > < td > Dmg Dice </ td > < input name =" attr_sub_skill_attack_dice_total " value ="" readonly > </ tr > on ( ' change:sub_skill_dice_cost change:sub_skill_attack_dice_paid ' , function ( eventInfo ) { getAttrs ([ ' sub_skill_attack_dice_cost ' , ' sub_skill_attack_dice_paid ' ] , function ( values ) { let cost = parseInt ( values . sub_skill_attack_dice_cost ) let paid = parseInt ( values . sub_skill_attack_dice_paid ) setAttrs ( { sub_skill_attack_dice_total : Math . floor ( cost / paid ) } ) ; } ) ; } ) ; const dice_values = [ ' 1 ' , ' 1D2 ' , ' 1D4 ' , ' 1D6 ' , ' 1D8 ' , ' 1D10 ' , ' 1D12 ' , ' 2D6 ' , ' 2D8 ' , ' 3d6 ' , ' 2D10 ' , ' 2D12 ' , ' 3d8 ' , ' 4D6 ' , ' 3d10 ' , ' 5d6 ' , ' 4D8 ' , ' 3d12 ' , ' 6dd ' , ' 4D10 ' , ' 7d6 ' , ' 4d12 ' , ' 6D8 ' , ' 8D6 ' , ' 5d10 ' , ' 7d8 ' , ' 5D12 ' , ' 6d10 ' , ' 8D8 ' , ' 7D10 ' , ' 6D12 ' , ' 8d10 ' , ' 7d12 ' , ' 9D10 ' , ' 8d12 ' , ' 10d10 ' , ' 9d12 ' , ' 11D10 ' , ' 10D12 ' , ' 12D10 ' , ' 12d12 ' , ' 8d20 ' , ' 10d20 ' , ' 12d20 ' , ' 20d20 ' ] ; let cost = parseInt (values . sub_skill_attack_dice_cost) || 0 ; let paid = parseInt (values . sub_skill_attack_dice_paid) || 0 ; let total = cost / paid const stat_names = [ ' sub_skill_attack_dice_total ' ] ; const name_end = ' total ' ; //if you want to use a different name end, change it here. stat_names . forEach (stat => { on ( ` change: ${ stat }` , () => { getAttrs ([ ' stat ' , ' sub_skill_dice_cost ' , ' sub_skill_dice_paid ' ] , v => { const score = + v [ stat ] || 0 ; const dice = dice_values [ Math . max ( 0 , Math . min ( dice_values . length - 1 , score ))] ; setAttrs ( { [ `${ stat } _ ${ name_end }` ] : dice } ) ; } ) ; } ) ; } ) ; I don't know where to modify the above so it all references correctly. :(