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

Automatically generating a roll-button inside a repeating section?

I have a repeating section, approximately like so <fieldset class="repeating_A">     <span name="attr_X"></span>     <span name="attr_Y"></span> </fieldset> I would like a roll button, which puts the values X and Y to the chat. <fieldset class="repeating_A">     <span name="attr_X"></span>     <span name="attr_Y"></span> <button type="roll" name="roll_B" value="&{template:default} {{X=@{X}}} {{Y=@{Y}}}">say</button> </fieldset> This above doesn't seem to work. I can do value="&{template:default} {{X=@{repeating_A_$0_X}}} {{Y=@{repeating_A_$0_Y}}}" But now every section item outputs the value of the first item. Can I make the roll buttons pick out their own section item values correctly?
1648157501

Edited 1648157543
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Attribute backed spans in a repeating sections are a little funky. You need to put a duplicate of the attribute backed span that is an actual input. I recommend using a hidden input for this. Also, remember that you need to set these via sheetworker. This looks like so: <fieldset class="repeating_A"> <input name="attr_X" type='hidden'> <span name="attr_X"></span> <input name="attr_Y" type='hidden'> <span name="attr_Y"></span> <button type="roll" name="roll_B" value="&{template:default} {{X=@{X}}} {{Y=@{Y}}}">say</button> </fieldset>
Wow, this is black magic! But it worked, thanks a bunch!