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

Action buttons in repeating groups

It looks like when I put an action button in a repeating group, the only way I can put a listener for it is to have a listener for the group. For example, my action was 'act_use_power' and my test function was on( 'clicked:repeating_actions', function( eventInfo ) ) {     console.log('clicked: '+JSON.stringify( eventInfo )); });    the actual logged output was clicked: {"sourceAttribute":"repeating_actions_-MfZxhYOFcBYRkVcTvzB","triggerName":"clicked:repeating_actions_-mfzxhyofcbyrkvctvzb","htmlAttributes":{"type":"action","name":"act_use_power"}} While I can parse that easily enough, it seems like relying on eventInfo.htmlAttributes.name might be a fragile way of coding. I found a prior thread about the subject here but either I'm misreading or it isn't working for me.
1629613879

Edited 1629613895
Nic B.
Roll20 Team
Hi Anthony, This isn't documented particularly well (or possibly at all), but you can listen directly for the action button, provided that it does not have underscores in the name. i.e. on( 'clicked:repeating_actions:use-power', eventInfo => { ... }) The eventInfo should also be much more useful to you at that point.
aha, underscores are what was breaking things. I think I vaguely recall seeing something about underscores in repeating groups and forgot about it.
1629616371
Oosh
Sheet Author
API Scripter
Nic B. said: This isn't documented particularly well (or possibly at all), but you can listen directly for the action button, provided that it does not have underscores in the name. Well.... maybe not officially , but Andreas is all over it, as usual. Well.... it may have been someone else, but I'll go with the percentages and say it was Andreas. :) It's documented in the Action Button section of the Wiki, and again in Known Bugs.
1629630836
GiGs
Pro
Sheet Author
API Scripter
Oosh said: Nic B. said: This isn't documented particularly well (or possibly at all), but you can listen directly for the action button, provided that it does not have underscores in the name. Well.... maybe not officially , but Andreas is all over it, as usual. Well.... it may have been someone else, but I'll go with the percentages and say it was Andreas. :) It's documented in the Action Button section of the Wiki, and again in Known Bugs. Andreas is great at documenting things. I believe I was the first to report the problem with underscores in action button names and repeating sections, but Andreas will have been the one who added it to the wiki.