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 Help

I am looking for some guidance working with a repeating section. I want to calculate a carried weight total from an equipment list. My initial thought was to have an on change script fire when someone made an edit to the list. Every item in the list will have a checkbox to toggle whether the item is being carried or not. Every item will have a weight. If the item is being carried, then add the weight to the total carried weight. So psuedo code wise: for each(repeating_equipment) {     if (repeating_equipment_carried == 1) totalweight = totalweight + repeating_equipment_weight } I am just not sure how to cycle through my repeating section. Any guidance would be greatly appreciated!
1620111208

Edited 1620146226
vÍnce
Pro
Sheet Author
I normally bash scripts with a hammer and brick to make them work, so I'm not one to give sheetworker advice, but you should be able to use TAS (The Aaron Script) to handle summing repeating attributes.&nbsp; Here's a recent post that might help:&nbsp; <a href="https://app.roll20.net/forum/permalink/9992186/" rel="nofollow">https://app.roll20.net/forum/permalink/9992186/</a>
Thanks vÍnce , I will take a look! Yeah I am a square peg round hole kind of programmer too...
1620513025
Martin P.
Pro
Sheet Author
YaktheMad said: I am looking for some guidance working with a repeating section. I want to calculate a carried weight total from an equipment list. My initial thought was to have an on change script fire when someone made an edit to the list. Every item in the list will have a checkbox to toggle whether the item is being carried or not. Every item will have a weight. If the item is being carried, then add the weight to the total carried weight. In case it helps, the Mongoose Traveller 2e sheet has this exact behaviour. It may be a bit crusty though, as it was implemented using the aforementioned hammer/brick programming method... <a href="https://github.com/Roll20/roll20-character-sheets/tree/master/Mongoose_Traveller2e" rel="nofollow">https://github.com/Roll20/roll20-character-sheets/tree/master/Mongoose_Traveller2e</a>
Thanks Martin! I will take a look. I am a real basic programmer (and I can program in BASIC!) so all guidance is welcome. I don't care if it is elegant, as long as it works!&nbsp;
1622536581
GiGs
Pro
Sheet Author
API Scripter
As an alternative to TAS, there's also my RepeatingSum: <a href="https://wiki.roll20.net/RepeatingSum" rel="nofollow">https://wiki.roll20.net/RepeatingSum</a> Its not as elegant as TAS, but I think it's a lot easier to use.
1622559195
Andreas J.
Forum Champion
Sheet Author
Translator
Yeah, RepeatSum is simple and nice, it's what I used when adding Tracking/history page for XP &amp; Money on the Star Wars D6 sheet. link to relevant code section
Awesome, thanks guys, I will delve.
RepeatingSum FTW! Thank you for the assistance! I have achieved success.