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

Looking for Examples of How Sheet Workers Access Repeating Section Fields

I found this on&nbsp; <a href="https://wiki.roll20.net/Sheet_Worker_Scripts" rel="nofollow">https://wiki.roll20.net/Sheet_Worker_Scripts</a> : For attributes in repeating fields, all of the following would be triggered when the "repeating_spells_SpellName" attribute is updated: "change:repeating_spells:spellname", "change:repeating_spells", "change:spellname", "change:spellname_max". This gives you maximum flexibility in choosing what "level" of change event you want to bind your function to. Can someone please supply some examples? I'm new to Roll20 and struggling with how I access parents/children/etc in the repeating section model - there's little documentation for more advanced usage and, event with the sheet sandbox, little diagnostics without literally creating my own debugging fields and conducting lots of refreshes.&nbsp;
1587516086
GiGs
Pro
Sheet Author
API Scripter
The quoted section is just telling you what will trigger change events. What do you need explaining about that? I have a lot of examples of using repeating sections in my previous posts, but it would be hard to find them. Can you give a specific example (including basic html) of something you'd like to do with roll20, and we can show you how to do it and explain any area of confusion. I'm not entirely show what you mean by parent/children in this context. Making you're own debugging is something we all have to do, sadly.
1587552824
Andreas J.
Forum Champion
Sheet Author
Translator
RepeatSum describes how to make a sheetworker that sums the weight of all items in a repeating section. That might help.
1587562600
GiGs
Pro
Sheet Author
API Scripter
I wouldnt recommend that script to people learning how to code in roll20, it includes some pretty advanced and likely incomprehensible bits.
1587650659

Edited 1587650732
Coincidentally, the&nbsp; RepeatSums &nbsp;was exactly what I needed. Looking at the repeatingSum helper, I agree with GiGs - its a bit abstract and complex and not worth toying with. I'm just glad it works. :D Thank you, both!
1587651215
GiGs
Pro
Sheet Author
API Scripter
haha, well that's a lucky accident then.&nbsp;
Follow-up question: I've got three repeating item sources of encumbrance - armor, weapons, and equipment. Each section has its own unique additional meta-data needed for play (armor has AC, weapons have damage, etc.), so I assume building three separate repeating lists makes sense. The repeatingSum sheet helper function examples show working with a single repeating section to sum totals. What's the most efficient way to sum up all my encumbrance totals?&nbsp; Sum each repeating sections enc. total to a hidden field, then sum the hidden fields? Or some other approach?
1587652380
GiGs
Pro
Sheet Author
API Scripter
What's the most efficient way to sum up all my encumbrance totals?&nbsp; Sum each repeating sections enc. total to a hidden field, then sum the hidden fields?&nbsp; Yes this is the only way to do it with repeatingSum. You could create a single sheet worker with nested getSectionIDs inside here, to get the total in one sheet worker. That would be more efficient, but if your sheet isnt too heavy (massive numbers of spells and other attributes), the inefficiency of the three hidden fields wont be noticeable.