Whew, here's a sheet worker that might do what you need if I have written it correctly. It's complicated by the fact you have multiple repeating sections to check, which creates problems for putting it all in one sheet worker (there is an easier way to write this that depends on having multiple intermediate hidden inputs). But here goes: This absolutely requires that every attribute listed in the dicepool_attributes variable near the top has a matching '_flag' checkbox. I think your sheet does have that. It also requires that you have an input or span to recieve the output if the sheet worker, named dice_pool . <input type="text" name="attr_dice_pool" value='' readonly> The sheet worker will generate results that look like this: 0 '1d4' '1d6 + 1d8' '1d10 + 1d4 + 1d6' and so on. The worker will read all of the attributes, and repeating sections, check which ones have their flags checked, and get the dice value for all of the checked stats and store them as above. To use that stat, you can have a button with a value something like value="/roll {@{dice_pool}kh2" Since I dont know the format of your roll, i had to guess what output would work. If some of your dice work differently (like the conditions, afraid, injured etc) you havent told me, so i couldnt incorporate that. Here's the sheet worker. const int = ( value , error = 0 ) => parseInt ( value ) || error ; const dicepool_attributes = [ 'afraid' , 'angry' , 'exhausted' , 'insecure' , 'injured' , 'duty' , 'glory' , 'justice' , 'love' , 'power' , 'truth' ]; const dicepool_sections = [ 'relationship' , 'asset' , 'resources:extra' , 'resources:location' ]; const dicepool_changes = ` ${ dicepool_attributes . reduce (( result , stat ) => ` ${ result } change: ${ stat } change: ${ stat } _flag` , '' ) } ${ dicepool_sections . reduce (( result , stat ) => ` ${ result } ${ stat . includes ( ':' ) ? `change:repeating_ ${ stat . split ( ':' )[ 0 ] } : ${ stat . split ( ':' )[ 1 ] } change:repeating_ ${ stat . split ( ':' )[ 0 ] } : ${ stat . split ( ':' )[ 1 ] } _flag` : `change:repeating_ ${ stat } : ${ stat } change:repeating_ ${ stat } : ${ stat } _flag` } ` , '' ) } ` ; on ( dicepool_changes , () => { console . log ( dicepool_changes ); getSectionIDs ( 'repeating_relationship' , id_relationships => { getSectionIDs ( 'repeating_asset' , id_assets => { getSectionIDs ( 'repeating_resources' , id_extras => { getSectionIDs ( 'repeating_resources' , id_locations => { const fieldnames = []; id_relationships . forEach ( id => fieldnames . push ( `repeating_relationship_ ${ id } _relationship` , `repeating_relationship_ ${ id } _relationship_flag` )); id_assets . forEach ( id => fieldnames . push ( `repeating_asset_ ${ id } _asset` , `repeating_asset_ ${ id } _asset_flag` )); id_extras . forEach ( id => fieldnames . push ( `repeating_resources_ ${ id } _extra` , `repeating_resources_ ${ id } _extra_flag` )); id_locations . forEach ( id => fieldnames . push ( `repeating_resources_ ${ id } _location` , `repeating_resources_ ${ id } _location_flag` )); dicepool_attributes . forEach ( stat => fieldnames . push ( stat , ` ${ stat } _flag` )); getAttrs ( fieldnames , values => { let diceout = []; dicepool_attributes . forEach ( stat => { const flag = int ( values [ ` ${ stat } _flag` ]); if ( flag ) diceout . push ( values [ stat ]); }); const getDiceFromSection = ( section , stat , ids ) => { const output = []; ids . forEach ( id => { const flag = int ( values [ `repeating_ ${ section } _ ${ id } _ ${ stat } _flag` ]); if ( flag ) output . push ( values [ `repeating_ ${ section } _ ${ id } _ ${ stat } ` ]); }); return output ; }; const relationships = getDiceFromSection ( 'relationship' , 'relationship' , id_relationships ); const assets = getDiceFromSection ( 'asset' , 'asset' , id_assets ); const extras = getDiceFromSection ( 'resources' , 'extra' , id_extras ); const locations = getDiceFromSection ( 'resources' , 'location' , id_locations ); diceout = [... diceout , ... relationships , ... assets , ... extras , ... locations ]; setAttrs ({ dice_pool : diceout . length === 0 ? '0' : diceout . join ( ' + ' ) }); }); }); }); }); }); });