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

[Sheetworker Help] Adding values in repeating sections that also use checkboxes

I'm trying to learn how all of this sheetworker stuff works and I'm diving in with trying to turn my armor page into repeating sections instead of called out rows to help save space. There are four values added together - Total AC, Total UnArmored AC, Total Armor Penalty and Total Speed Reduction.  Within each current row, the player can select via checkbox if a piece of Armor adds to AC or UnArmored AC (or both), they also use a checkbox to indicate if a Penalty or a Speed Reduction should be active.  How do I go about doing this?
1487891422

Edited 1487998907
Amanda the Amazon
Sheet Author
I got some stuff adding, but everything broke when I tried to do the IFs - I don't know that I've put them in the right place or named them the right thing because I haven't been able to find anything about someone trying to do this stuff within repeating sheets.  I do have the TAS installed.  Here is a snippet: on('change:repeating_armor', function(){ TAS.repeating('armor') .attrs('AC_CalcZero','AC_Unarmored_CalcZero','ArmorCheckZero','ArmorSpeedZero','AGI','ArmorClassLuckyRoll') .fields('ArmorACBase','ArmorMagicBonus','ArmorCheck','ArmorSpeed','ArmorActive','ArmorActiveUnarmored') if (row.ArmorActive===1 && row.ArmorActiveUnarmored===0) { .reduce(function(m,r){ m.ac+=(r.I.ArmorACBase+r.I.ArmorMagicBonus); r.D[0].totalac=(r.I.ArmorACBase*r.I.ArmorMagicBonus); m.accheck+=(r.I.ArmorCheck); r.D[0].runningcheck=m.accheck; m.acspeed+=(r.I.ArmorSpeed); r.D[0].runningspeed=m.acspeed; return m; },{ac:0,accheck:0, acspeed:0},function(m,r,a){ a.D[0].AC_CalcZero=(10 + attrSet.ArmorClassLuckyRoll + m.ac); a.D[0].AC_Unarmored_CalcZero=(10); a.D[0].ArmorCheckZero=m.accheck; a.D[0].ArmorSpeedZero=m.acspeed; }) }
1488340954
chris b.
Pro
Sheet Author
API Scripter
moved the "if (row.ArmorActive===1 && row.ArmorActiveUnarmored===0) {"   to inside the reduce function: ... .reduce(function(m,r){ if (r.I.ArmorActive===1 && r.I.ArmorActiveUnarmored===0) { //do stuff } else { //other stuff } return m; },{ac:0, accheck:0, acspeed:0},function(m,r,a){ ...