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

Sheet Worker

So, I've been looking at past posts and the wiki on this topic but it's not clicking... I tried many variations I've come across to calculate and add up a repeating field. I don't know if it's me or the fact that I'm using complex examples for a simple calculation or what. Anyways I'm going to continue trying, may even restructure the entire character sheet to make this work. If anyone can help me figure it out before I do, it'll be appreciated. I placed in bold the relevant sections that are components of the sheet worker. This is what I'm working with: Default Item & Repeating Field of Said Item  (should I just remove the default section and just use the repeating field and calculate based off that?) <div class="sheet-relative sheet-flex sheet-width-100"> <div class="sheet-center-5"> <img class="sheet-logo" src="ignore"> </div> <div class="sheet-width-50 sheet-margin-bottom-5 sheet-left"> <div class="sheet-header sheet-border-radius-top sheet-width-75"> <button value="@{whisper_toggle} &{template:humanity} {{character=@{character_name}}} {{check=Armor Check}} {{armortype=@{armor_primary_type}}} {{armorac=@{armor_primary_ac}}} {{armortl=@{armor_primary_tl}}} {{armorprice=@{armor_primary_price}}} {{armorcapacity=@{armor_primary_capacity_slot}}} {{armorupgrademax=@{armor_primary_upgrade_slots_max}}} {{armorupgradecurrent=@{armor_primary_upgrade_slots_current}}} {{details=@{armor_primary_notes}}}" type="roll" class="sheet-skill_button btn ui-draggable sheet-secondary sheet-padding-0 sheet-width-100"> Armor </button> </div> <div class="sheet-flex sheet-secondary sheet-width-75"> <span class="sheet-left sheet-primary sheet-input-info"> Type </span> <select name="attr_armor_primary_type" class="sheet-input sheet-padding-5 sheet-width-100 sheet-border-bottom sheet-border-no sheet-border-no-radius" dir="rtl"> <option value="Weave Armor"> Weave Armor </option> <option value="Flex Armor"> Flex Armor </option> <option value="Armored Vesh"> Armored Vesh </option> <option value="Natural Armor"> Natural </option> </select> </div> <div class="sheet-flex sheet-secondary sheet-width-75 sheet-relative"> <span class="sheet-left sheet-primary sheet-input-info"> AC </span> <input name="attr_armor_primary_ac" type="text" value="10" class="sheet-input sheet-border-right sheet-padding-5 sheet-border-bottom sheet-width-50 sheet-border-no sheet-border-no-radius"> <span class="sheet-right sheet-primary sheet-input-info sheet-left-50"> Capacity Slot </span> <select name="attr_armor_primary_capacity_slot" class="sheet-input sheet-padding-5 sheet-width-50 sheet-border-bottom sheet-border-no sheet-border-no-radius" dir="rtl"> <option value="0"> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> </select> </div> <div class="sheet-flex sheet-secondary sheet-width-75 sheet-relative"> <span class="sheet-left sheet-primary sheet-input-info"> Tech Level </span> <select name="attr_armor_primary_tl" class="sheet-input sheet-padding-5 sheet-border-right sheet-width-50 sheet-border-bottom sheet-border-no sheet-border-no-radius" dir="rtl"> <option value="0"> N/A </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> </select> <span class="sheet-right sheet-primary sheet-input-info sheet-left-50"> Price </span> <input name="attr_armor_primary_price" type="text" value="0" class="sheet-input sheet-padding-5 sheet-border-bottom sheet-width-50 sheet-border-no sheet-border-no-radius"> </div> <div class="sheet-flex sheet-secondary sheet-width-75 sheet-relative"> <span class="sheet-left sheet-primary sheet-input-info"> Upgrade Slots </span> <span class="sheet-right-50 sheet-right sheet-primary sheet-input-info-sub"> Max </span> <select name="attr_armor_primary_upgrade_slots_max" class="sheet-input sheet-padding-5 sheet-border-bottom sheet-border-right sheet-width-50 sheet-border-no sheet-border-no-radius" dir="rtl"> <option value="0"> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> </select> <span class="sheet-right sheet-primary sheet-input-info-sub"> Current </span> <select name="attr_armor_primary_upgrade_slots_current" class="sheet-input sheet-padding-5 sheet-border-bottom sheet-border-no sheet-border-no-radius sheet-width-50" dir="rtl"> <option value="0"> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> </select> </div> <div class="sheet-flex sheet-secondary sheet-width-75"> <span class="sheet-left sheet-primary sheet-input-info"> Notes </span> <textarea name="attr_armor_primary_notes" class="sheet-input sheet-left sheet-padding-5 sheet-border-no sheet-border-no-radius sheet-width-100" type="text"> </textarea> </div> </div> <div class="sheet-width-50 sheet-margin-bottom-5 sheet-right"> <div class="sheet-header sheet-border-radius-top sheet-width-75"> <button value="@{whisper_toggle} &{template:humanity} {{character=@{character_name}}} {{check=Armor Check}} {{armortype=@{armor_secondary_type}}} {{armorac=@{armor_secondary_ac}}} {{armortl=@{armor_secondary_tl}}} {{armorprice=@{armor_secondary_price}}} {{armorcapacity=@{armor_secondary_capacity_slot}}} {{armorupgrademax=@{armor_secondary_upgrade_slots_max}}} {{armorupgradecurrent=@{armor_secondary_upgrade_slots_current}}} {{details=@{armor_secondary_notes}}}" type="roll" class="sheet-skill_button btn ui-draggable sheet-secondary sheet-padding-0 sheet-width-100"> Armor </button> </div> <div class="sheet-flex sheet-secondary sheet-width-75"> <span class="sheet-left sheet-primary sheet-input-info"> Type </span> <select name="attr_armor_secondary_type" class="sheet-input sheet-padding-5 sheet-width-100 sheet-border-bottom sheet-border-no sheet-border-no-radius" dir="rtl"> <option value="Weave Armor"> Weave Armor </option> <option value="Flex Armor"> Flex Armor </option> <option value="Armored Vesh"> Armored Vesh </option> <option value="Natural Armor"> Natural </option> </select> </div> <div class="sheet-flex sheet-secondary sheet-width-75 sheet-relative"> <span class="sheet-left sheet-primary sheet-input-info"> AC </span> <input name="attr_armor_secondary_ac" type="text" value="10" class="sheet-input sheet-border-right sheet-padding-5 sheet-border-bottom sheet-width-50 sheet-border-no sheet-border-no-radius"> <span class="sheet-right sheet-primary sheet-input-info sheet-left-50"> Capacity Slot </span> <select name="attr_armor_secondary_capacity_slot" class="sheet-input sheet-padding-5 sheet-width-50 sheet-border-bottom sheet-border-no sheet-border-no-radius" dir="rtl"> <option value="0"> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> </select> </div> <div class="sheet-flex sheet-secondary sheet-width-75 sheet-relative"> <span class="sheet-left sheet-primary sheet-input-info"> Tech Level </span> <select name="attr_armor_secondary_tl" class="sheet-input sheet-padding-5 sheet-border-right sheet-width-50 sheet-border-bottom sheet-border-no sheet-border-no-radius" dir="rtl"> <option value="0"> N/A </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> </select> <span class="sheet-right sheet-primary sheet-input-info sheet-left-50"> Price </span> <input name="attr_armor_secondary_price" type="text" value="0" class="sheet-input sheet-padding-5 sheet-border-bottom sheet-width-50 sheet-border-no sheet-border-no-radius"> </div> <div class="sheet-flex sheet-secondary sheet-width-75 sheet-relative"> <span class="sheet-left sheet-primary sheet-input-info"> Upgrade Slots </span> <span class="sheet-right-50 sheet-right sheet-primary sheet-input-info-sub"> Max </span> <select name="attr_armor_secondary_upgrade_slots_max" class="sheet-input sheet-padding-5 sheet-border-bottom sheet-border-right sheet-width-50 sheet-border-no sheet-border-no-radius" dir="rtl"> <option value="0"> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> </select> <span class="sheet-right sheet-primary sheet-input-info-sub"> Current </span> <select name="attr_armor_secondary_upgrade_slots_current" class="sheet-input sheet-padding-5 sheet-border-bottom sheet-border-no sheet-border-no-radius sheet-width-50" dir="rtl"> <option value="0"> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> </select> </div> <div class="sheet-flex sheet-secondary sheet-width-75"> <span class="sheet-left sheet-primary sheet-input-info"> Notes </span> <textarea name="attr_armor_secondary_notes" class="sheet-input sheet-left sheet-padding-5 sheet-border-no sheet-border-no-radius sheet-width-100" type="text"> </textarea> </div> </div> </div> Repeating Field Segment <div class="sheet-flex sheet-width-100"> <fieldset class="repeating_armor" name="attr_repeat_armor"> <div class="sheet-width-50 sheet-margin-bottom-5 sheet-left"> <div class="sheet-header sheet-border-radius-top sheet-width-75"> <button value="@{whisper_toggle} &{template:humanity} {{character=@{character_name}}} {{check=Armor Check}} {{armortype=@{armor_primary_type}}} {{armorac=@{armor_primary_ac}}} {{armortl=@{armor_primary_tl}}} {{armorprice=@{armor_primary_price}}} {{armorcapacity=@{armor_primary_capacity_slot}}} {{armorupgrademax=@{armor_primary_upgrade_slots_max}}} {{armorupgradecurrent=@{armor_primary_upgrade_slots_current}}} {{details=@{armor_primary_notes}}}" type="roll" class="sheet-skill_button btn ui-draggable sheet-secondary sheet-padding-0 sheet-width-100"> Armor </button> </div> <div class="sheet-flex sheet-secondary sheet-width-75"> <span class="sheet-left sheet-primary sheet-input-info"> Type </span> <select name="attr_armor_primary_type" class="sheet-input sheet-padding-5 sheet-width-100 sheet-border-bottom sheet-border-no sheet-border-no-radius" dir="rtl"> <option value="Weave Armor"> Weave Armor </option> <option value="Flex Armor"> Flex Armor </option> <option value="Armored Vesh"> Armored Vesh </option> <option value="Natural Armor"> Natural </option> </select> </div> <div class="sheet-flex sheet-secondary sheet-width-75 sheet-relative"> <span class="sheet-left sheet-primary sheet-input-info"> AC </span> <input name="attr_armor_primary_ac" type="text" value="10" class="sheet-input sheet-border-right sheet-padding-5 sheet-border-bottom sheet-width-50 sheet-border-no sheet-border-no-radius"> <span class="sheet-right sheet-primary sheet-input-info sheet-left-50"> Capacity Slot </span> <select name="attr_armor_primary_capacity_slot" class="sheet-input sheet-padding-5 sheet-width-50 sheet-border-bottom sheet-border-no sheet-border-no-radius" dir="rtl"> <option value="0"> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> </select> </div> <div class="sheet-flex sheet-secondary sheet-width-75 sheet-relative"> <span class="sheet-left sheet-primary sheet-input-info"> Tech Level </span> <select name="attr_armor_primary_tl" class="sheet-input sheet-padding-5 sheet-border-right sheet-width-50 sheet-border-bottom sheet-border-no sheet-border-no-radius" dir="rtl"> <option value="0"> N/A </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> </select> <span class="sheet-right sheet-primary sheet-input-info sheet-left-50"> Price </span> <input name="attr_armor_primary_price" type="text" value="0" class="sheet-input sheet-padding-5 sheet-border-bottom sheet-width-50 sheet-border-no sheet-border-no-radius"> </div> <div class="sheet-flex sheet-secondary sheet-width-75 sheet-relative"> <span class="sheet-left sheet-primary sheet-input-info"> Upgrade Slots </span> <span class="sheet-right-50 sheet-right sheet-primary sheet-input-info-sub"> Max </span> <select name="attr_armor_primary_upgrade_slots_max" class="sheet-input sheet-padding-5 sheet-border-bottom sheet-border-right sheet-width-50 sheet-border-no sheet-border-no-radius" dir="rtl"> <option value="0"> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> </select> <span class="sheet-right sheet-primary sheet-input-info-sub"> Current </span> <select name="attr_armor_primary_upgrade_slots_current" class="sheet-input sheet-padding-5 sheet-border-bottom sheet-border-no sheet-border-no-radius sheet-width-50" dir="rtl"> <option value="0"> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> </select> </div> <div class="sheet-flex sheet-secondary sheet-width-75"> <span class="sheet-left sheet-primary sheet-input-info"> Notes </span> <textarea name="attr_armor_primary_notes" class="sheet-input sheet-left sheet-padding-5 sheet-border-no sheet-border-no-radius sheet-width-100" type="text"> </textarea> </div> </div> <div class="sheet-width-50 sheet-margin-bottom-5 sheet-right"> <div class="sheet-header sheet-border-radius-top sheet-width-75"> <button value="@{whisper_toggle} &{template:humanity} {{character=@{character_name}}} {{check=Armor Check}} {{armortype=@{armor_secondary_type}}} {{armorac=@{armor_secondary_ac}}} {{armortl=@{armor_secondary_tl}}} {{armorprice=@{armor_secondary_price}}} {{armorcapacity=@{armor_secondary_capacity_slot}}} {{armorupgrademax=@{armor_secondary_upgrade_slots_max}}} {{armorupgradecurrent=@{armor_secondary_upgrade_slots_current}}} {{details=@{armor_secondary_notes}}}" type="roll" class="sheet-skill_button btn ui-draggable sheet-secondary sheet-padding-0 sheet-width-100"> Armor </button> </div> <div class="sheet-flex sheet-secondary sheet-width-75"> <span class="sheet-left sheet-primary sheet-input-info"> Type </span> <select name="attr_armor_secondary_type" class="sheet-input sheet-padding-5 sheet-width-100 sheet-border-bottom sheet-border-no sheet-border-no-radius" dir="rtl"> <option value="Weave Armor"> Weave Armor </option> <option value="Flex Armor"> Flex Armor </option> <option value="Armored Vesh"> Armored Vesh </option> <option value="Natural Armor"> Natural </option> </select> </div> <div class="sheet-flex sheet-secondary sheet-width-75 sheet-relative"> <span class="sheet-left sheet-primary sheet-input-info"> AC </span> <input name="attr_armor_secondary_ac" type="text" value="10" class="sheet-input sheet-border-right sheet-padding-5 sheet-border-bottom sheet-width-50 sheet-border-no sheet-border-no-radius"> <span class="sheet-right sheet-primary sheet-input-info sheet-left-50"> Capacity Slot </span> <select name="attr_armor_secondary_capacity_slot" class="sheet-input sheet-padding-5 sheet-width-50 sheet-border-bottom sheet-border-no sheet-border-no-radius" dir="rtl"> <option value="0"> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> </select> </div> <div class="sheet-flex sheet-secondary sheet-width-75 sheet-relative"> <span class="sheet-left sheet-primary sheet-input-info"> Tech Level </span> <select name="attr_armor_secondary_tl" class="sheet-input sheet-padding-5 sheet-border-right sheet-width-50 sheet-border-bottom sheet-border-no sheet-border-no-radius" dir="rtl"> <option value="0"> N/A </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> </select> <span class="sheet-right sheet-primary sheet-input-info sheet-left-50"> Price </span> <input name="attr_armor_secondary_price" type="text" value="0" class="sheet-input sheet-padding-5 sheet-border-bottom sheet-width-50 sheet-border-no sheet-border-no-radius"> </div> <div class="sheet-flex sheet-secondary sheet-width-75 sheet-relative"> <span class="sheet-left sheet-primary sheet-input-info"> Upgrade Slots </span> <span class="sheet-right-50 sheet-right sheet-primary sheet-input-info-sub"> Max </span> <select name="attr_armor_secondary_upgrade_slots_max" class="sheet-input sheet-padding-5 sheet-border-bottom sheet-border-right sheet-width-50 sheet-border-no sheet-border-no-radius" dir="rtl"> <option value="0"> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> </select> <span class="sheet-right sheet-primary sheet-input-info-sub"> Current </span> <select name="attr_armor_secondary_upgrade_slots_current" class="sheet-input sheet-padding-5 sheet-border-bottom sheet-border-no sheet-border-no-radius sheet-width-50" dir="rtl"> <option value="0"> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option> <option value="4"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> </select> </div> <div class="sheet-flex sheet-secondary sheet-width-75"> <span class="sheet-left sheet-primary sheet-input-info"> Notes </span> <textarea name="attr_armor_secondary_notes" class="sheet-input sheet-left sheet-padding-5 sheet-border-no sheet-border-no-radius sheet-width-100" type="text"> </textarea> </div> </div> </fieldset> </div> Segment I'm Trying to Calculate Capacity Slot Total  (trying to update the Currrent Carrying div class="sheet-flex sheet-secondary sheet-width-75 sheet-relative"> <span class="sheet-left sheet-primary sheet-input-info"> Carrying Capacity </span> <span class="sheet-right-50 sheet-right sheet-primary sheet-input-info-sub"> Max </span> <input name="attr_carrying_capacity_max" value="(@{strength_dice_pool})" disabled="true" class="sheet-input sheet-padding-5 sheet-width-50 sheet-border-right sheet-border-bottom sheet-border-no sheet-border-no-radius"> <span class="sheet-right sheet-primary sheet-input-info-sub"> Current </span> <input name="attr_carrying_capacity_current" class="sheet-input sheet-padding-5 sheet-border-bottom sheet-width-50 sheet-border-no sheet-border-no-radius" type="text"> </div> My Attempts with the Sheet Worker Attempt 1 on("change:armor_primary_capacity_slot change:armor_secondary_capacity_slot", function(eventInfo) { getAttrs(["armor_primary_capacity_slot", "armor_secondary_capacity_slot"], function(values) { setAttrs({ "carrying_capacity_current": parseInt(values["armor_primary_capacity_slot"],10) || 0 + parseInt(values["stat_b"],10) || 0 }); }); }); Attempt 2 on("change:armor_primary_capacity_slot change:armor_secondary_capacity_slot", function(eventInfo) { getAttrs(["armor_primary_capacity_slot", "armor_secondary_capacity_slot"], function(values) { setAttrs({ carrying_capacity_current: Math.floor(values.armor_primary_capacity_slot + values.armor_secondary_capacity_slot) }); }); }); Attempt 3 on("sheet:opened change:armor_primary_capacity_slot change:armor_secondary_capacity_slot", function(eventInfo) { getAttrs(["armor_primary_capacity_slot", "armor_secondary_capacity_slot"], function(values) { var test1 = parseInt(values.armor_primary_capacity_slot); var test2 = parseInt(values.armor_secondary_capacity_slot); repeatingSum("armor_primary_capacity_slot","armor_secondary_capacity_slot") setAttrs({ ({ carrying_capacity_current: test1 + test2 }) }); }); });
I’m not sure if it is related to the problem you are facing, but be aware there is a known bug with sheet workers atm, and it’s too hard for roll20 to fix for a few months now. <a href="https://app.roll20.net/forum/post/7440478/api-no-longer-triggering-sheet-workers/?pageforid=7549256#post-7549256" rel="nofollow">https://app.roll20.net/forum/post/7440478/api-no-longer-triggering-sheet-workers/?pageforid=7549256#post-7549256</a>
1570916508
GiGs
Pro
Sheet Author
API Scripter
It shouldnt be anything to do with that bug, Andrew. As I understand it, the bug related to the API (scripts) and sheet workers. Sheet workers themselves work fine.
1570917664

Edited 1571009703
GiGs
Pro
Sheet Author
API Scripter
It would be a lot easier to parse, zerodaggersz, if you stated exactly what you were tring to do. That's a lot of code to scroll through to try and figure out what&nbsp; is going on. Can you trim out everything unrelated to this issue? (It's okay I think i figured it out). Looking at your sheet workers, it looks like you are trying to sum up the armour primary secondary capacity slots, and save the total to carrying_capacity_current? If I've understood properly, what you should do is add a hidden input in the repeating section, which is the sum of those two, then you can use repeatingSum. The following assumes you are working with the repeating section, not the bit before it that isnt inside a repeating section. So, first, create an input like this within the repeating section : &lt;input&nbsp;name="attr_armor_slot_total"&nbsp;type="hidden"&nbsp;value="0"&nbsp;&gt; Then in sheet worker section, add the repeatingSum script from the wiki. Then add this sheet worker , to add up the primary and secondary slots. The sum will be stored in a hidden column in the repeating section. on("change:repeating_armor:armor_primary_capacity_slot change:repeating_armor:armor_secondary_capacity_slot ", function() { getAttrs(["repeating_armor_armor_primary_capacity_slot", "repeating_armor_armor_secondary_capacity_slot"], function(values) { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const primary = parseInt(values["repeating_armor_armor_primary_capacity_slot"],10) ||0; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const secondary = parseInt(values["repeating_armor_armor_secondary_capacity_slot"],10) ||0; setAttrs({ repeating_armor_armor_slot_total: primary + secondary }); }); }); Do not modify this to put the parseInt lines both inside setAttrs. You had a mistake in your version of the code that would make that fail. Now, finally, you can add this sheet worker , which uses repeatingSum to sum up the hidden armor_slot_total column. on("sheet:opened change:repeating_armor:armor_slot_total remove:repeating_armor", function(eventInfo) { getAttrs(["repeating_armor_armor_slot_total"], function(values) { repeatingSum("carrying_capacity_current", "armor", "armor_slot_total"); }); }); Good luck!
1571006961

Edited 1571006980
I don't know why this is not working... I must be doing something wrong... right? Field to the Changed &lt;input name="attr_carrying_capacity_current" class="sheet-input sheet-padding-5 sheet-border-bottom sheet-width-50 sheet-border-no sheet-border-no-radius" type="text"&gt; Input I Added in the Repeating Field &lt;fieldset class="repeating_armor" name="attr_repeat_armor"&gt; &lt;input name="attr_armor_slot_total" type="hidden" value="0" &gt; Script &lt;script type="text/worker"&gt; /* ===== PARAMETERS ========== destination = the name of the attribute that stores the total quantity section = name of repeating fieldset, without the repeating_ fields = the name of the attribute field to be summed can be a single attribute: 'weight' or an array of attributes: ['weight','number','equipped'] multiplier (optional) = a multiplier to the entire fieldset total. For instance, if summing coins of weight 0.02, might want to multiply the final total by 0.02. */ const repeatingSum = (destination, section, fields, multiplier = 1) =&gt; { if (!Array.isArray(fields)) fields = [fields]; getSectionIDs(`repeating_${section}`, idArray =&gt; { const attrArray = idArray.reduce( (m,id) =&gt; [...m, ...(fields.map(field =&gt; `repeating_${section}_${id}_${field}`))],[]); getAttrs(attrArray, v =&gt; { console.log("===== values of v: "+ JSON.stringify(v) +" ====="); // getValue: if not a number, returns 1 if it is 'on' (checkbox), otherwise returns 0.. const getValue = (section, id,field) =&gt; parseFloat(v[`repeating_${section}_${id}_${field}`], 10) || (v[`repeating_${section}_${id}_${field}`] === 'on' ? 1 : 0); const sumTotal = idArray.reduce((total, id) =&gt; total + fields.reduce((subtotal,field) =&gt; subtotal * getValue(section, id,field),1),0); setAttrs({[destination]: sumTotal * multiplier}); }); }); }; on("change:repeating_armor:armor_primary_capacity_slot change:repeating_armor:armor_secondary_capacity_slot", function() { getAttrs(["repeating_armor_armor_primary_capacity_slot", "repeating_armor_armor_secondary_capacity_slot"], function(values) { const primary = parseInt(values["repeating_armor_armor_primary_capacity_slot"],10) ||; const secondary = parseInt(values["repeating_armor_armor_secondary_capacity_slot"],10) ||; setAttrs({ repeating_armor_armor_slot_total: primary + secondary }); }); }); on("sheet:opened change:repeating_armor:armor_slot_total remove:repeating_armor", function(eventInfo) { getAttrs(["repeating_armor_armor_slot_total"], function(values) { repeatingSum("carrying_capacity_current", "armor", "armor_slot_total"); }); }); &lt;/script&gt;
1571010018

Edited 1571010081
GiGs
Pro
Sheet Author
API Scripter
I just noticed one of my scripts had an error in it, but it shouldnt be breaking anything. (Edit: looking again at your code, this might well be causing the failure.) This &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const primary = parseInt(values["repeating_armor_armor_primary_capacity_slot"],10) ||; const secondary = parseInt(values["repeating_armor_armor_secondary_capacity_slot"],10) ||; should be &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const primary = parseInt(values["repeating_armor_armor_primary_capacity_slot"],10) ||0; const secondary = parseInt(values["repeating_armor_armor_secondary_capacity_slot"],10) ||0; I also just noticed an error in yours, and I have no idea if this would mess things up: &lt;fieldset class="repeating_armor" name="attr_repeat_armor"&gt; You dont use a name on fieldset. That should just be &lt;fieldset class="repeating_armor" &gt; Try those fixes and see if it changes anything.
GiGs, Roll20, this community is lucky to have you. Thank you it works! :D Now I will try to get it to play nice with the items prior to the repeating field.&nbsp;
1571017237
GiGs
Pro
Sheet Author
API Scripter
You're welocme :) What are you trying to do with the section before the repeating section? Do you want to add weights from non-repeating section to the carrying_capacity_current?
Yeah exactly. I was looking at the structure and am even considering just removing it and using only repeating sections and reconstructing everything. Would that be best/less of a hassle?
1571023724
GiGs
Pro
Sheet Author
API Scripter
Yes, I think so. If the bit before the repeating section was storing different information, it would be worth keeping separate, but it looks like it has all the same fields as the repeating section, so no need to have it as well. Just roll it into the repeating section.&nbsp;
Everything is set to be only repeating fields. My next obstacle is calculating the sum of not just one but three repeating fields (last one has an amount multiplier for weight). The other two repeating fields are structured exactly the same way, just that the word "armor" is replaced with "weapon" and "gear". This was my attempt at it: on("change:repeating_armor:armor_primary_capacity_slot change:repeating_weapon:weapon_primary_capacity_slot change:repeating_gear:gear_primary_capacity_slot change:repeating_gear:gear_primary_amount change:repeating_armor:armor_secondary_capacity_slot change:repeating_weapon:weapon_secondary_capacity_slot change:repeating_gear:gear_secondary_capacity_slot change:repeating_gear:gear_secondary_amount", function() { getAttrs(["repeating_armor_armor_primary_capacity_slot", "repeating_weapon_weapon_primary_capacity_slot", "repeating_gear_gear_primary_capacity_slot", "repeating_gear_gear_primary_amount", "repeating_armor_armor_secondary_capacity_slot", "repeating_weapon_weapon_secondary_capacity_slot", "repeating_gear_gear_secondary_capacity_slot", "repeating_gear_gear_secondary_amount"], function(values) { const primaryarmor = parseInt(values["repeating_armor_armor_primary_capacity_slot"],10) ||0; const primaryweapon = parseInt(values["repeating_weapon_weapon_primary_capacity_slot"],10) ||0; const primaryamount = parseInt(values["repeating_gear_gear_primary_capacity_slot"],10) ||0; const primarygear = parseInt(values["repeating_gear_gear_primary_amount"],10) ||0; const secondaryarmor = parseInt(values["repeating_armor_armor_secondary_capacity_slot"],10) ||0; const secondaryweapon = parseInt(values["repeating_weapon_weapon_secondary_capacity_slot"],10) ||0; const secondarygear = parseInt(values["repeating_gear_gear_secondary_capacity_slot"],10) ||0; const secondaryamount = parseInt(values["repeating_gear_gear_secondary_amount"],10) ||0; setAttrs({ repeating_armor_armor_slot_total: primaryarmor + secondaryarmor repeating_weapon_weapon_slot_total: primaryweapon + secondaryweapon repeating_gear_gear_slot_total: primarygear * primaryamount + secondarygear * secondaryamount }); }); }); on("sheet:opened change:repeating_armor:armor_slot_total remove:repeating_armor change:repeating_weapon:weapon_slot_total remove:repeating_weapon change:repeating_gear:gear_slot_total remove:repeating_gear", function(eventInfo) { getAttrs(["repeating_armor_armor_slot_total", "repeating_weapon_weapon_slot_total", "repeating_gear_gear_slot_total"], function(values) { repeatingSum("carrying_capacity_current", "armor", "weapon", "gear", "armor_slot_total", "weapon_slot_total", "gear_slot_total"); }); });
1571064752

Edited 1571064825
GiGs
Pro
Sheet Author
API Scripter
SumRepeating cant do multiple repeating fieldsets (actually, thinking about it now, I could see a way to do that, but it would need a syntax change). The way to do this at present is to have hidden inputs to store each section, then have another sheet worker to add those 3 fields together to add to carrying_capacity_total. Before I show how to do this, a quick mention: in your code you have this: &nbsp;setAttrs({ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;repeating_armor_armor_slot_total:&nbsp;primaryarmor&nbsp;+&nbsp;secondaryarmor &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;repeating_weapon_weapon_slot_total:&nbsp;primaryweapon&nbsp;+&nbsp;secondaryweapon &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;repeating_gear_gear_slot_total:&nbsp;primarygear&nbsp;*&nbsp;primaryamount&nbsp;+&nbsp;secondarygear&nbsp;*&nbsp;secondaryamount &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}); When you have multiple lines in a setAttrs statement, they need to be separated by commas, so sheet worker won't work properly. It would look like &nbsp;setAttrs({ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;repeating_armor_armor_slot_total:&nbsp;primaryarmor&nbsp;+&nbsp;secondaryarmor, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;repeating_weapon_weapon_slot_total:&nbsp;primaryweapon&nbsp;+&nbsp;secondaryweapon, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;repeating_gear_gear_slot_total:&nbsp;primarygear&nbsp;*&nbsp;primaryamount&nbsp;+&nbsp;secondarygear&nbsp;*&nbsp;secondaryamount &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}); The last line never has a comma. Also you shouldnt combine repeating sections like this. When a weapon is changed, roll20 silently registered which row changed, and supplies that so the correct values are used. For example, lets say you have 12 weapon rows. You change the 12th weapon, and this worker runs. It extracts the details for weapons on the 12th row, and then looks for the armor and gear on the 12th row of their&nbsp;sections. If those don't exist, you have a problem. So, first step &nbsp;is to split that into 3 sheet workers, one for each section. Like so: on("change:repeating_armor:armor_primary_capacity_slot&nbsp;change:repeating_armor:armor_secondary_capacity_slot",&nbsp;function()&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;getAttrs(["repeating_armor_armor_primary_capacity_slot",&nbsp;"repeating_armor_armor_secondary_capacity_slot"],&nbsp;function(values)&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;primaryarmor&nbsp;=&nbsp;parseInt(values["repeating_armor_armor_primary_capacity_slot"],10)&nbsp;||0; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;secondaryarmor&nbsp;=&nbsp;parseInt(values["repeating_armor_armor_secondary_capacity_slot"],10)&nbsp;||0; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setAttrs({ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;repeating_armor_armor_slot_total:&nbsp;primaryarmor&nbsp;+&nbsp;secondaryarmor &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp;}); }); on("change:repeating_weapon:weapon_primary_capacity_slot&nbsp;change:repeating_weapon:weapon_secondary_capacity_slot",&nbsp;function()&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;getAttrs(["repeating_weapon_weapon_primary_capacity_slot",&nbsp;"repeating_weapon_weapon_secondary_capacity_slot"],&nbsp;function(values)&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;primaryweapon&nbsp;=&nbsp;parseInt(values["repeating_weapon_weapon_primary_capacity_slot"],10)&nbsp;||0; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;secondaryweapon&nbsp;=&nbsp;parseInt(values["repeating_weapon_weapon_secondary_capacity_slot"],10)&nbsp;||0; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setAttrs({ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;repeating_weapon_weapon_slot_total:&nbsp;primaryweapon&nbsp;+&nbsp;secondaryweapon &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp;}); }); on("change:repeating_gear:gear_primary_capacity_slot&nbsp;change:repeating_gear:gear_primary_amount&nbsp;change:repeating_gear:gear_secondary_capacity_slot&nbsp;change:repeating_gear:gear_secondary_amount",&nbsp;function()&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;getAttrs(["repeating_gear_gear_primary_capacity_slot",&nbsp;"repeating_gear_gear_primary_amount",&nbsp;"repeating_gear_gear_secondary_capacity_slot",&nbsp;"repeating_gear_gear_secondary_amount"],&nbsp;function(values)&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;primaryamount&nbsp;=&nbsp;parseInt(values["repeating_gear_gear_primary_capacity_slot"],10)&nbsp;||0; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;primarygear&nbsp;=&nbsp;parseInt(values["repeating_gear_gear_primary_amount"],10)&nbsp;||0; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;secondarygear&nbsp;=&nbsp;parseInt(values["repeating_gear_gear_secondary_capacity_slot"],10)&nbsp;||0; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;secondaryamount&nbsp;=&nbsp;parseInt(values["repeating_gear_gear_secondary_amount"],10)&nbsp;||0; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setAttrs({ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;repeating_gear_gear_slot_total:&nbsp;primarygear&nbsp;*&nbsp;primaryamount&nbsp;+&nbsp;secondarygear&nbsp;*&nbsp;secondaryamount &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp;}); }); You can test those are working, then go on to the next step. You now need to create three new inputs, to take the results of those sections. I gave them attribute names of&nbsp; carrying_capacity_armor ,&nbsp; carrying_capacity_weapon , and&nbsp; carrying_capacity_gear . You can make the inputs type="hidden", but while testing, making them type"number" is worthwhile so you can see they are being set properly. Now you use these sheet workers to calculate them: on("sheet:opened&nbsp;change:repeating_armor:armor_slot_total&nbsp;remove:repeating_armor&nbsp;",&nbsp;function(eventInfo)&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;getAttrs(["repeating_armor_armor_slot_total"],&nbsp;function(values)&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;repeatingSum("carrying_capacity_armor",&nbsp;"armor",&nbsp;"armor_slot_total"); &nbsp;&nbsp;&nbsp;&nbsp;}); }); on("sheet:opened&nbsp;change:repeating_weapon:weapon_slot_total&nbsp;remove:repeating_weapon&nbsp;",&nbsp;function(eventInfo)&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;getAttrs(["repeating_weapon_weapon_slot_total"],&nbsp;function(values)&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;repeatingSum("carrying_capacity_weapon",&nbsp;"weapon",&nbsp;"weapon_slot_total"); &nbsp;&nbsp;&nbsp;&nbsp;}); }); on("sheet:opened&nbsp;change:repeating_gear:gear_slot_total&nbsp;remove:repeating_gear",&nbsp;function(eventInfo)&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;getAttrs(["repeating_gear_gear_slot_total"],&nbsp;function(values)&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;repeatingSum("carrying_capacity_gear",&nbsp;"gear",&nbsp;"gear_slot_total"); &nbsp;&nbsp;&nbsp;&nbsp;}); }); One they are done, you can now calculate the total, using the original carrying_capacity_current attribute, like so: on("sheet:opened&nbsp;change:carrying_capacity_armor&nbsp;change:carrying_capacity_weapon&nbsp;change:carrying_capacity_gear",&nbsp;function(eventInfo)&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;getAttrs(["carrying_capacity_armor",&nbsp;"carrying_capacity_weapon",&nbsp;"carrying_capacity_gear"],&nbsp;function(values)&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;armor&nbsp;=&nbsp;parseInt(values["carrying_capacity_armor"],10)&nbsp;||0; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;weapon&nbsp;=&nbsp;parseInt(values["carrying_capacity_weapon"],10)&nbsp;||0; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;gear&nbsp;=&nbsp;parseInt(values["carrying_capacity_gear"],10)&nbsp;||0; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setAttrs({ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;carrying_capacity_total:&nbsp;armor&nbsp;+&nbsp;weapon&nbsp;+&nbsp;gear &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}); &nbsp;&nbsp;&nbsp;&nbsp;}); }); And that should do the trick (crosses fingers).
Oh wow, I would not have figured out the comma issue. The final calculation is not processing it seems. I put the armor, weapon and gear total calculation outside of the repeating fields if that's ok? But I have confirmed they are properly calculating total for their segments.
1571076979
GiGs
Pro
Sheet Author
API Scripter
You did right by putting the armor, weapon and gear attributes outside the repeating section. So it's just the final sheet worker that isnt working properly? and aha, i put the wrong name in for the attribute. I think&nbsp;carrying_capacity_ total should be carrying_capacity_ current .
You singlehandedly helped complete my character sheet. Thank you :D
1571078360
GiGs
Pro
Sheet Author
API Scripter
hehe, you're welcome. I'm happy to help.
Unfortunately I have returned. Sorry D: I'm running into a "no attribute" error in regards to rolls that include the skin_ prefix attributes like "skin_primary_bonus". I'm guessing this is regards to having everything into a repeating field? Is there a way to roll with a special character to point at a repeating field or is there a way to roll in the sheet worker? After putting some thought into it, I have no idea if either is even possible...
1571235087
GiGs
Pro
Sheet Author
API Scripter
I'm not understanding what you are saying. Can you describe the issue in more detail?
1571236879

Edited 1571236902
Let's see if I can decipher my late night thinking lol. Button Example (the no attribute error is in bold and underlined) &lt;button name="attr_constitution" value="@{whisper_toggle} &amp;{template:humanity} {{character=@{character_name}}} {{check=Constitution Check}} {{statbonus=@{constitution_bonus}}} {{statpenalty=@{constitution_penalty}}} {{maxhp=@{hp_max}}} {{currenthp=@{hp_current}}} {{maxenhancements=@{enhancement_max}}} {{currentenhancements=@{enhancement_current}}} {{stat=[[[[{[[@{bonus_query_toggle} + @{skin_primary_equipped} * @{skin_primary_bonus} + @{skin_secondary_equipped} * @{skin_secondary_bonus} + @{constitution_dice_pool} + @{constitution_bonus}]], 10}kl1]]d10!!dh[[{[[@{penalty_query_toggle} + @{skin_primary_equipped} * @{skin_primary_penalty} + @{skin_secondary_equipped} * @{skin_secondary_penalty} + @{constitution_penalty} + @{contaminated} + round(@{weakened}/3)]], [[@{bonus_query_toggle} + @{skin_primary_equipped} * @{skin_primary_bonus} + @{skin_secondary_equipped} * @{skin_secondary_bonus} + @{constitution_dice_pool} + @{constitution_bonus} - 1]], 9}kl1]] + @{constitution_modifier}]]}}" type="roll" class="skill_button btn ui-draggable secondary padding-0 width-100"&gt; Constitution &lt;/button&gt; Those Attributes are Inside this Repeating Field &nbsp;(this segment is repeated for the secondary attributes) &lt;fieldset class="repeating_skin"&gt; ... &lt;div class="flex secondary width-75 relative"&gt; &lt;span class="left primary input-info"&gt; Equipped &lt;/span&gt; &lt;select name="attr_skin_primary_equipped" class="input padding-5 border-right width-50 border-bottom border-no border-no-radius" dir="rtl"&gt; &lt;option value="0"&gt; No &lt;/option&gt; &lt;option value="1"&gt; Yes &lt;/option&gt; &lt;/select&gt; ... &lt;/div&gt; &lt;div class="flex secondary width-75 relative"&gt; &lt;span class="left primary input-info"&gt; Bonus &lt;/span&gt; &lt;select name="attr_skin_primary_bonus" class="input padding-5 border-right width-50 border-bottom border-no border-no-radius" dir="rtl"&gt; &lt;option value="0"&gt; No &lt;/option&gt; &lt;option value="1"&gt; Yes &lt;/option&gt; &lt;/select&gt; &lt;span class="right primary input-info left-50"&gt; Penalty &lt;/span&gt; &lt;select name="attr_skin_primary_penalty" class="input padding-5 width-50 border-bottom border-no border-no-radius" dir="rtl"&gt; &lt;option value="0"&gt; No &lt;/option&gt; &lt;option value="1"&gt; Yes &lt;/option&gt; &lt;/select&gt; &lt;/div&gt; I'm wondering if I'm getting this error because I'm using a button outside a repeating field to reference an attribute in a repeating field.
1571238294

Edited 1571238460
GiGs
Pro
Sheet Author
API Scripter
Your wondering is correct. But before I get to explaining this, your button is misnamed. It shouldnt be attr_constitution Buttons are not attributes. It should be roll_constitution Okay the problem here is from a misunderstanding of how a repeating section works. The problem you have is: That button has no way to know which row of the repeating section you want. Remember, a repeating section has (or can have) multiple rows. Because of this the attribute names in a repeating section are partial. To identify an attribute in a repeating section, you need three components: The repeating section name A row id (which is string of random numbers and letters) and the attribute name in the section So for your&nbsp; skin_primary_equipped attribute, the actual full name is something like repeating_skin_-x64gkl36_ skin_primary_equipped For buttons and items on the same row in the repeating section, you only need to use the final bit (bolded), because roll20 is smart enough to know they are being called from the same row and supplies the rest.&nbsp; But when you have something outside of the repeating section, and want to access an attribute from a specific row of a repeating section, you need supply all three parts of the name. Note that all attributes on the same row have the same row ID. So your problem is, your button is not going to work, because you need to define which row&nbsp; you need. This is solvable, but its hard to give a solution without knowing what these attributes are meant to represent. Also, is it supposed to be using a sum of all rows? or is it using one specific row, and how do you choose which row? One way to handle this would be checkbox in the repeating section, to set which row is active. That would be linked to a sheet worker which unchecks all the other row's checkboxes (since you can only have one selected at a time), and also updates a hidden attribute outside the repeating section with the selected row id. You'd then build your button text using that so you have the proper full attribute name.
1571241312

Edited 1571241510
The Original Button [[[[{[[@{bonus_query_toggle} + @{skin_primary_equipped} * @{skin_primary_bonus} + @{skin_secondary_equipped} * @{skin_secondary_bonus} + @{constitution_dice_pool} + @{constitution_bonus}]], 10}kl1]]d10!!dh[[{[[@{penalty_query_toggle} + @{skin_primary_equipped} * @{skin_primary_penalty} + @{skin_secondary_equipped} * @{skin_secondary_penalty} + @{constitution_penalty} + @{contaminated} + round(@{weakened}/3)]], [[@{bonus_query_toggle} + @{skin_primary_equipped} * @{skin_primary_bonus} + @{skin_secondary_equipped} * @{skin_secondary_bonus} + @{constitution_dice_pool} + @{constitution_bonus} - 1]], 9}kl1]] + @{constitution_modifier}]]}} First Segment Broken Down This is meant to calculate an optional custom bonus based on the query, a global bonus called skin (someone's temporary body) but they can have multiple bodies in the sheet which is where the secondary skin comes in as well as it being a repeating field with unused skins are zeroed out by the primary_equipped &nbsp;part, then add the constitution score as well as any constitution bonuses based on outside factors. That makes up the total d10 roll but all rolls are restricted to a max of 10d10 which is where the ,10}kl1 &nbsp;part comes from. [[[[{[[@{bonus_query_toggle} + @{skin_primary_equipped} * @{skin_primary_bonus} + @{skin_secondary_equipped} * @{skin_secondary_bonus} + @{constitution_dice_pool} + @{constitution_bonus}]], 10}kl1]]d10!! Second Segment Breakdown This segment adds up an optional custom penalty based on the query, another global penalty based on the same skins (they can implement a global bonus OR penalty), then add any penalties based on the skill, finally any conditions based on the system is taken into account for any additional penalties all vary based on the skill. dh[[{[[@{penalty_query_toggle} + @{skin_primary_equipped} * @{skin_primary_penalty} + @{skin_secondary_equipped} * @{skin_secondary_penalty} + @{constitution_penalty} + @{contaminated} + round(@{weakened}/3)]] Third Segment Breakdown Just like the first segment, penalties can only add up to zero. The difference here is that the penalty cannot be greater than or equal to the first segment calculation since the minimum roll you can roll is a 1d10. So this checks which is lower the penalty calculated in segment two, segment one minus 1 or a 9. Then all segments are added together to make a roll based on a ?d10!!dh? &nbsp;with a modifier that adds up to 10 to that roll , [[@{bonus_query_toggle} + @{skin_primary_equipped} * @{skin_primary_bonus} + @{skin_secondary_equipped} * @{skin_secondary_bonus} + @{constitution_dice_pool} + @{constitution_bonus} - 1]], 9}kl1]] + @{constitution_modifier}]]}} In other words I somehow got myself into this complicated equation lol. I'm sure I could of simplified this, just don't know how. Back to the situation at hand, I'll try to fully grasp the whole checkbox idea then implement it. Also thanks for pointing out the mistakes I've been doing all along lol.
1571241958

Edited 1571242162
Also how would I go about finding the full name of an attribute in a repeating field? I think I found it. But I'm guessing it's tough to pinpoint since it changes for each row. Hmm.
1571244613

Edited 1571244681
GiGs
Pro
Sheet Author
API Scripter
From your description, I'm wondering if you should be using a repeating section there, or if you do need it, whether you are building it in a suboptimal way. Can you paste a screenshot of what a completed character would look like, focused on that area of the character sheet? I'm confused by the secondary section. If the body has multiple skins, are you free to choose any of them as primary, and any as secondary? Or if you have one as primary, does that limit you to a specific secondary? Also does it matter which is primary and secondary? it seems to me that you would ideally have each skin on a separate row, and just mark one of them as primary and another as secondary.&nbsp;
1571244975
GiGs
Pro
Sheet Author
API Scripter
Zerodaggerz said: Also how would I go about finding the full name of an attribute in a repeating field? I think I found it. But I'm guessing it's tough to pinpoint since it changes for each row. Hmm. It's not possible to find it without a sheet worker. The trick then is where do you save it? Ideally you would have a hidden attribute outside of the repeating section. Then you'd have a checkbox inside the repeating section, and whenever you click it, it saves that row id for that checkbox row to the attribute outside. Then you can access that outside attribute without needing to worry about row id and repeating section name. But you'd also need another &nbsp;hidden attribute, to build the button code, and replace your current button code with a call to that new attribute. This is because you cant dynamically update text in a button (because a button is a roll type, not an attribute), so you need to replace the cod there with a reference to an attribute which can be updated.&nbsp; I'll post some code later, but it would help to first figure out if you are using the repeating section appropriately as per my last post - you might need to rewrite that whole section.
I think I agree with you in having repeating fields just for the gear section. I'll PM you the github with the code and my game (whichever you're more comfortable with).
1571248176
GiGs
Pro
Sheet Author
API Scripter
Don't take this the wrong way, but I dont want either of those. I asked for a pic of a completed or semi complete pic of that area of the sheet so i could grasp what it was for. It's way too much work to be given the entire character sheet code to study, when I shouldn't have to do that much work just to figure out how to help solve one particular problem. (PS: your github link didnt work anyway.). To be clear, I want to help you. But you have to help me to do that, by giving me the information I need. There are several questions in my last posts that you haven't answered. For instance, I want to know what purpose the skin repeating section serves, and whether you need the primary and secondary bits on each row or should they be split up into separate rows. Try and think about what information I need to solve your issue, remembering that you might need to tell me enough about the system you are using to grasp it, and supply that information. I am wondering if you've jumped into writing the sheet without thinking what is the best way to achieve your goals first, and thinking that redesigning the skin section might be needed. But i cant answer that by looking at the sheet code, I need to know how skins work in the system, not in roll20.&nbsp;
1571248424
GiGs
Pro
Sheet Author
API Scripter
Actually better idea: show me a completed character sheet made outside of roll20. If you use this system at a game table, post a pic of a character from your game.
Sorry, just thought complete transparency would help and also at work so the screenshot would be difficult at the moment. But once I'm home I'll get you that image instead
Also driving at the moment, so will properly respond later.
1571258484
GiGs
Pro
Sheet Author
API Scripter
Dont worry about it, I probably came over a bit more blunt than I meant to. text makes everyone sound harsh :)
1571258652

Edited 1571258780
GitHub (if you're even still interested):&nbsp; <a href="https://github.com/zerodaggerz/LostHumanityRoll20Sheet" rel="nofollow">https://github.com/zerodaggerz/LostHumanityRoll20Sheet</a> Alright, so let's clarify some things I botched up. Given you can step away at this point since I think like you said removing the following section from being repeating field or removing the attributes included in these repeating fields would be best and/or work just fine. The section in Question &nbsp;(causes the missing attribute error) Section with the Constitution Button that I'm Using to Test The idea is that the players can store in their sheet multiple bodies they can essentially transfer to via a push of a button or in this case selecting which skin is equipped. With skins being easily customized and unique. It's something I was going for but now realizing is not an important feature and players can easily work around just two skins on their sheet. I thought the drone section was going to have the same issue since players can easily have more than two drones but realized I structured that differently. As for the primary and secondary question, they're just a naming scheme for the code and nothing more but yes players can freely choose which skin they want to have active/influencing rolls. It doesn't matter which is primary or secondary. As for more images here is the entire sheet: Lol it's fine, I know I'm being confusing I do it to myself as well.
1571262328
GiGs
Pro
Sheet Author
API Scripter
As for the primary and secondary question, they're just a naming scheme for the code and nothing more but yes players can freely choose which skin they want to have active/influencing rolls. It doesn't matter which is primary or secondary. I feel we are talking past each other a little bit. It sounds like players can have multiple skins stored, and so I'm not quite grasping why there is a primary and a secondary terminology.&nbsp; My questions are: players can have more than two skins (is this true?) Is only one skin active at a time? Do they have to set one as primary, one as secondary, and the others are inactive? The reason I'm asking, there might be a much simpler way to set up that section. If they can have more than 2 skins, and have to select one to be active (or two to be primary/secondary), the better way to do this would be: Have skins set up in a repeating section Do NOT have two skins on a row - no primary/secondary, just one skin per row Have an Equipped option (which you already have) And if primary/secondary is needed, change the Equipped to a Primary/Secondary/Not Equipped select. Then using a sheet worker, you can always access which is active, which is primary, which is secondary, and get any details you need from them. By the way, I like the look of your sheet. It's fancy.
1571298397

Edited 1571298449
Whoops, I am doing a terrible job of answering questions today. 1) Only one 2) Yes 3) No, just set one as active at no point do they see or does the code cares whether they have the primary or secondary skin active. I could of named the skins skin_left_bonus &nbsp;and skin_right_bonus &nbsp;to represent which side of the sheet they are located. I settled on just not allowing the skins to be repeatable. Keeping players at a maximum of two saved skins should suffice, doubt I'll get much backlash for limiting them there. I think all of this is just me trying to be too flexible with the sheet. Thank you, spent too much time on it lol. I'll be using it for the system I am making and will be selling in the future, probably in like a year or two. And being a big Roll20 guy I want to have a sheet for it so this is me doing just that. That being said I would love to give you a free copy in the future for all this help. Of course it would be me pretty much randomly reaching out to you in like a year or two when it's officially released. I'm a bit of a terrible salesperson and just want to share all my crazy ideas. Or not, or just decide in the future when I have more to show or whatever. Ok I'm done, the caffeine and sleep deprivation is making this weird... Thank you again! :) Oh yeah it's sci-fi so I don't know if you'd be interested. But it is free so... ok I'll shut up... I'm done. D:
Hello all, I have moved this post to the Character Sheets and Compendium forum.
1571365209
GiGs
Pro
Sheet Author
API Scripter
Zerodaggerz said: Whoops, I am doing a terrible job of answering questions today. 1) Only one 2) Yes 3) No, just set one as active at no point do they see or does the code cares whether they have the primary or secondary skin active. I could of named the skins skin_left_bonus &nbsp;and skin_right_bonus &nbsp;to represent which side of the sheet they are located. I settled on just not allowing the skins to be repeatable. Keeping players at a maximum of two saved skins should suffice, doubt I'll get much backlash for limiting them there. I think all of this is just me trying to be too flexible with the sheet. If you are happy with your solution, I'll leave you to it.&nbsp; If you want to do it as as a repeating section, which lets people have any number, and set one of them as active, I can show you how to do that. Just say the word. And I'd never turn down a free rpg :) (Your github link doesnt work btw).