
Hello, I have a dice progression chart that I would like to autopopulate based on another field. The field is always a number, but is different skills or attributes. Here is the current code, which I do not understand how to use. This dice progression is based on attr_pistol_tech_level (as an example). If the attri_pistol_tech_level = 16 , it would be = (2D20+1D10) on the dice progression chart, and the attr_pistol_damage field should then populate as (2D20+1D10) Here is the code I currently have. const dice_values = [ ' 1d4 ' , ' 1d6 ' , ' 1d8 ' , ' 1d10 ' , ' 1d12 ' , ' 1d20 ' , ' 1D20+1D4 ' , ' 1D20+1D6 ' , ' 1D20+1D8 ' , ' 1D20+1D10 ' , ' 1D20+1D12 ' , ' 1D20+1D20 ' , ' 2D20+1D4 ' , ' 2D20+1D6 ' , ' 2D20+1D8 ' , ' 2D20+1D10 ' , ' 2D20+1D12 ' , ' 2D20+2D20 ' , ' 3D20+1D4 ' , ' 3D20+1D6 ' , ' 3D20+1D8 ' , ' 3D20+1D10 ' , ' 3D20+1D12 ' , ' 3D20+3D20 ' , ' 4D20+1D4 ' , ' 4D20+1D6 ' , ' 4D20+1D8 ' , ' 4D20+1D10 ' , ' 4D20+1D12 ' , ' 4D20+4D20 ' , ' 5D20+1D4 ' , ' 5D20+1D6 ' , ' 5D20+1D8 ' , ' 5D20+1D10 ' , ' 5D20+1D12 ' , ' 5D20+5D20 ' , ' 6D20+1D4 ' , ' 6D20+1D6 ' , ' 6D20+1D8 ' , ' 6D20+1D10 ' , ' 6D20+1D12 ' , ' 6D20+6D20 ' , ' 7D20+1D4 ' , ' 7D20+1D6 ' , ' 7D20+1D8 ' , ' 7D20+1D10 ' , ' 7D20+1D12 ' , ' 7D20+7D20 ' , ' 8D20+1D4 ' , ' 8D20+1D6 ' , ' 8D20+1D8 ' , ' 8D20+1D10 ' , ' 8D20+1D12 ' , ' 8D20+8D20 ' , ' 9D20+1D4 ' , ' 9D20+1D6 ' , ' 9D20+1D8 ' , ' 9D20+1D10 ' , ' 9D20+1D12 ' , ' 9D20+9D20 ' , ' 10D20+1D4 ' , ' 10D20+1D6 ' , ' 10D20+1D8 ' , ' 10D20+1D10 ' , ' 10D20+1D12 ' , ' 10D20+10D20 ' , ] ; const stat_names = [ ' dice_progression_chart ' ] ; 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 ' , ' sub_skill_attack_dice_total ' ] , v => { let cost = parseInt ( values . sub_skill_attack_dice_cost ) || 0 ; let paid = parseInt ( values . sub_skill_attack_dice_paid ) || 0 ; let dice_level = cost / paid ; const score = + v [ stat ] || 0 ; const dice = dice_values [ Math . max ( 0 , Math . min ( dice_values . length - 1 , score ))] ; setAttrs ( { [ `${ stat } _ ${ name_end }` ] : dice } ) ; } ) ; } ) ; } ) ;