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

Repeating section's action button loses its row when called by row index

This is an annoying behavior I have discovered. Maybe someone has a workaround? My custom sheet has been working perfectly with custom roll parsing, but if it is called by a macro row index shortcut, it fails. The problem is that when I getAttrs() other values from the row, it oddly gets the default values instead of the ones for the row. Here's a cut down bit of the code. on("clicked:repeating_weapons:attack", (eventInfo) => { getAttrs("repeating_weapons_damage", (x) => { }); }); <fieldset class="repeating_weapons"> <button type="action" class="roll_button" name="act_attack">🎲</button>   <h4 class="head_label">Damage</h4>   <input type="text" placeholder="none" class="pb_input" spellcheck="false" name="attr_damage" value="0"> </fieldset> If called with the actual row ID, even from a macro, it reads @damage from the row (for example: 1d10). If called with $0 (like a player using a macro would do), it returns the default value for @damage (for example: 0). eventInfo has sourceAttribute="repeating_weapons_$0_attack", triggerName ="clicked:repeating_weapons_$0_attack", and  htmlAttributes is an empty object. Short of gathering the rowid list and reorder list, and working out the ID each time, I'm not sure how to fix this behavior.
1758504051
vÍnce
Pro
Sheet Author
For some reason I thought action buttons could be triggered using a macro... not sure. You might need to grab the id of the repeating row clicked with something like; on("clicked:repeating_weapons:attack", (eventInfo) => {     const id = eventInfo.sourceAttribute.split('_')[2]; // use id to ensure you are working with the correct row     getAttrs(`repeating_weapons_${id}_damage`, (x) => { //...     }); }); Use 'id' similarly for any setAttrs
1758504774

Edited 1758504924
sourceAttribute just has the row index, like $0. That's how i did it before, but it should really work either way without. I tested, and the roll20 5e sheet doesn't have my problem Maybe it has a hidden attribute with the rowID? They do populate the IDs around the sheet.