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 .
×
Create a free account

Struggling with Custom Sheet Workers Grabbing Inputs in Repeatings sections

1637963238

Edited 1637963365
I have a repeating section on my custom character sheets for spells, and no matter what I try I can't figure out how to get the value of the spellname input. Here's the code in question: (Written in PUG, though I am happy to post the HTML is that's preferable)  .magick   h1 .skillHeading Magick   fieldset .repeating_spell     .flex-row       .column.fit-size         button .spell_button ( type = 'action' name = 'act_magick-roll' title = '@{spellname}' )       .column.removeSides         .label           input .input.min-input.shaded-input.font-2 ( type = 'text' name = 'attr_spellname' placeholder = 'Spell Name' )       .column.removeSides         + dropdown ( 'spellcost' , 'Cost' , [           {option: 'Raw' , text: 'Raw' },           {option: 1 , text: '1st Level' },           {option: 2 , text: '2nd Level' },           {option: 3 , text: '3rd Level' },           {option: 4 , text: '4th Level' },           {option: 5 , text: '5th Level' },           {option: 6 , text: '6th Level' },           {option: 7 , text: '7th Level' },           {option: 8 , text: '8th Level' },           {option: 9 , text: '9th Level' },           {option: 10 , text: '10th Level' },         ]) ( class =[ 'shaded-input' , 'mini-drop' ] )       .column.removeSides         .label           input .input.min-input.shaded-input.font-2 ( type = 'text' name = 'attr_spelltype' placeholder = 'Type' )       .column.removeSides         .label           input .input.min-input.shaded-input.font-2 ( type = 'text' name = 'attr_spelldamage' placeholder = 'Damage' ) Now the issue is I can't seem to pick up the attr_spellname. As you can see even tried passing it in as a title, to see if that was possible, but no dice.  My rollworker: on ( 'clicked:repeating_spell:magick-roll' , async ( info ) => {   console . log ({ info });   const template = '&{template:skilledCompRoll}' ;   const name = '{{name=@{character_name}}}' ;   const spell = info . htmlAttributes . title ;   const skillValue = `{{skillvalue=[[(@{Unsanity})]]}}` ;   const fumble = `{{fumble=[[ceil(95+([[(@{Unsanity})]])/20))]]}}` ;   const crit = `{{crit=[[ceil(([[(@{Unsanity})]])/20)+1]]}}` ;   const extreme = `{{extreme=[[ceil(([[(@{Unsanity})]])/5)+1]]}}` ;   const hard = `{{hard=[[ceil(([[(@{Unsanity})]])/2)+1]]}}` ;   const success = `{{success=[[(@{Unsanity})+(@{ILuck})[ILuck]]]}}` ;   const roll = '{{Roll=[[(1d100)[Roll]+(@{willpower})[Willpower]+(@{bonus})[Bonus]]]}}' ;   const bonus = `{{bonus=[[@{bonus}]]}}` ;   const innateLuck = `{{innateLuck=[[@{ILuck}]]}}` ;   const skillName = `{{skillname=@{ ${ spell } }}}`   const { results , rollId } = await startRoll ( ` ${ template } ${ name } ${ skillValue } ${ fumble } ${ crit } ${ extreme } ${ hard } ${ success } ${ roll } ${ skillName } ${ bonus } ${ innateLuck } ` )   console . log ({ results , rollId });   let computedRoll = results . Roll . result ;   if ( computedRoll > 100 ) computedRoll = 100 ;   if ( computedRoll < 1 ) computedRoll = 1 ;   let computedSuccess = results . success . result ;   if ( computedSuccess > 100 ) computedSuccess = 100 ;   console . log ({ results , bonus: results . bonus . result , computed: {roll: computedRoll , success: computedSuccess }});   finishRoll ( rollId , { Roll: computedRoll , success: computedSuccess }); })
For others struggling with this, you need the row ID. Adjustments below. on ( 'clicked:repeating_spell:magick-roll' , async ( info ) => {   const rowAttributes = info . sourceAttribute . split ( '_' );   rowAttributes . pop ();   const rowPrefix = rowAttributes . join ( '_' );   const template = '&{template:skilledCompRoll}' ;   const name = '{{name=@{character_name}}}' ;   const spell = info . htmlAttributes . title ;   const skillValue = `{{skillvalue=[[(@{Unsanity})]]}}` ;   const fumble = `{{fumble=[[ceil(95+([[(@{Unsanity})]])/20))]]}}` ;   const crit = `{{crit=[[ceil(([[(@{Unsanity})]])/20)+1]]}}` ;   const extreme = `{{extreme=[[ceil(([[(@{Unsanity})]])/5)+1]]}}` ;   const hard = `{{hard=[[ceil(([[(@{Unsanity})]])/2)+1]]}}` ;   const success = `{{success=[[(@{Unsanity})+(@{ILuck})[ILuck]]]}}` ;   const roll = '{{Roll=[[(1d100)[Roll]+(@{willpower})[Willpower]+(@{bonus})[Bonus]]]}}' ;   const bonus = `{{bonus=[[@{bonus}]]}}` ;   const innateLuck = `{{innateLuck=[[@{ILuck}]]}}` ;   const skillName = `{{skillname=@{ ${ rowPrefix } _spellName}}}`   const { results , rollId } = await startRoll ( ` ${ template } ${ name } ${ skillValue } ${ fumble } ${ crit } ${ extreme } ${ hard } ${ success } ${ roll } ${ skillName } ${ bonus } ${ innateLuck } ` )   console . log ({ results , rollId });   let computedRoll = results . Roll . result ;   if ( computedRoll > 100 ) computedRoll = 100 ;   if ( computedRoll < 1 ) computedRoll = 1 ;   let computedSuccess = results . success . result ;   if ( computedSuccess > 100 ) computedSuccess = 100 ;   console . log ({ results , bonus: results . bonus . result , computed: {roll: computedRoll , success: computedSuccess }});   finishRoll ( rollId , { Roll: computedRoll , success: computedSuccess }); })