So, I've been using the suggestion above, but I'm encountering an error and I'm not sure whether it is fixable. When I use the "roll_melee_attack" button from '<fieldset class="repeating_meleeattacks filtershortlist">', seen below, I get this error: SyntaxError: Expected "(", ".", "[", "abs(", "ceil(", "d", "floor(", "round(", "t", "{", [ |\t], [+|\-] or [0-9] but end of input found. That is I get that error until I check or uncheck "attr_melee_checkbox_expand" from '<fieldset class="repeating_meleeattacks">'. After I've done that, I no longer see the error. It appears there are values used in "roll_melee_attack" that aren't populated into their hidden value holders until some handling of '<fieldset class="repeating_meleeattacks">' has been triggered. It has been said that: "Not all items must be present or displayed in all lists. However each item must be present in every list in which it is used. For example, if you have an auto-calc field, or a button that uses a field, All the fields used in the autocalc, or passed by the button, must be present in the same instance of the repeating section, it will not go looking for it in other instances of the repeating section. The referenced field may be hidden, but must be present." And there are some values stored in '<fieldset class="repeating_meleeattacks filtershortlist">', which are not stored in '<fieldset class="repeating_meleeattacks">', but adding them there does not fix the problem. My suspicion is that this " trick is not recommended by the developers" because the API wasn't designed to handle it. However, I thought I'd ask in case there is a way to automatically trigger whatever gets triggered when I check or uncheck "attr_melee_checkbox_expand". I should mention that attr_melee_attack_action_points and attr_melee_attack_reach" are autopopulated by a sheetworker, which I'll include below. This is '<fieldset class="repeating_meleeattacks filtershortlist">' <div class="fieldLabelOverviewRepeating sticky blueBorder1">Melee Attacks</div>
<fieldset class="repeating_meleeattacks filtershortlist">
<div class="expandable-section paleRedGradient">
<div class="overviewMeleeAttacksGrid">
<div class="mlerch whiteBackground blueBorder1 section">
<input name="attr_melee_attack_reach_clean" type="hidden">
<input name="attr_melee_attack_reach" type="hidden">
<input name="attr_melee_attack_damage_type_1" type="hidden">
<span class="borderlessField derivedOverviewAttacksTop section" name="attr_melee_attack_reach"></span>
<span class="borderlessField derivedOverviewAttacksBottom section" name="attr_melee_attack_damage_type_1"></span>
</div>
<div class="mlelde blueBackground blueBorderTop1 section">
<input name="attr_melee_attack_action_points" type="hidden">
<input name="attr_melee_attack_action_points_clean" type="hidden">
<button
class="buttonStyleTop load"
name="act_loadmeleeattack"
type="action"
style="float:right;">
<span name="attr_melee_attack_action_points"></span>
</button>
</div>
<div class="mlerol blueBackground section">
<input name="attr_melee_attack_properties" type="hidden">
<input name="attr_melee_attack_name" type="hidden">
<button
class="buttonStyleBottom roll"
name="roll_melee_attack"
type="roll"
value='&{template:default}{{name=@{melee_attack_name}}}{{Attack Roll=[[1d100cf5cs0+@{melee_attack_total_attack_bonus}]]}}{{Properties=@{melee_attack_properties}}}{{Resistance Penalty=[[@{melee_attack_resistance_penalty}]]}}{{@{melee_attack_damage_type_1} =[[@{melee_attack_number_of_damage_dice_1}d@{melee_attack_damage_dice_facet_number_1}cf0cs0+@{melee_attack_attribute_damage_bonus}+@{melee_attack_weapon_quality_damage_bonus}+@{melee_attack_weapon_skill_damage_bonus}+@{melee_attack_damage_bonus_1}]]}}{{@{melee_attack_damage_type_2} =[[@{melee_attack_number_of_damage_dice_2}d@{melee_attack_damage_dice_facet_number_2}cf0cs0+@{melee_attack_damage_bonus_2}]]}}{{@{melee_attack_damage_type_3} =[[@{melee_attack_number_of_damage_dice_3}d@{melee_attack_damage_dice_facet_number_3}cf0cs0+@{melee_attack_damage_bonus_3}]]}}'
style="float:right;">
<span name="attr_melee_attack_name"></span>
</button>
</div>
<input name="attr_melee_attack_hands" type="hidden">
<input name="attr_melee_checkbox_expand" type="hidden">
<input name="attr_melee_attack_basic_combat_bonus" type="hidden">
<input name="attr_melee_attack_weapon_skill_attack_bonus" type="hidden">
<input name="attr_melee_attack_miscellaneous_modifier" type="hidden">
<input name="attr_melee_attack_total_attack_bonus" type="hidden">
<input name="attr_melee_attack_number_of_damage_dice_1" type="hidden">
<input name="attr_melee_attack_damage_dice_facet_number_1" type="hidden">
<input name="attr_melee_attack_damage_bonus_1" type="hidden">
<input name="attr_melee_attack_details" type="hidden">
<input name="attr_melee_attack_attribute_damage_bonus" type="hidden">
<input name="attr_melee_attack_resistance_penalty" type="hidden">
<input name="attr_melee_attack_damage_type_2" type="hidden">
<input name="attr_melee_attack_number_of_damage_dice_2" type="hidden">
<input name="attr_melee_attack_damage_dice_facet_number_2" type="hidden">
<input name="attr_melee_attack_damage_bonus_2" type="hidden">
<input name="attr_melee_attack_weapon_quality_damage_bonus" type="hidden">
<input name="attr_melee_attack_damage_type_3" type="hidden">
<input name="attr_melee_attack_number_of_damage_dice_3" type="hidden">
<input name="attr_melee_attack_damage_dice_facet_number_3" type="hidden">
<input name="attr_melee_attack_damage_bonus_3" type="hidden">
<input name="attr_melee_attack_weapon_skill_damage_bonus" type="hidden">
</div>
</div>
</fieldset>
This is <fieldset class="repeating_meleeattacks">: <div class="blueGradientBackground sectionLabelCenter white sticky repeatingLabel">Melee Attacks</div>
<fieldset class="repeating_meleeattacks">
<div class="expandable-section paleRedGradient">
<input class="expand-control" type="hidden" name="attr_melee_checkbox_expand" value="0"/>
<div class="meleeAttacksTitleGrid">
<div class="mlerch blueBackground section">
<div class="fieldLabelCenter white blueBackground section">Reach</div>
<input name="attr_melee_attack_reach" type="hidden">
<input class="field right manual24" name="attr_melee_attack_reach_clean" type="number" min='5'>
</div>
<div class="mleapc blueBackground section">
<div class="fieldLabelCenter white blueBackground section">AP</div>
<input name="attr_melee_attack_action_points" type="hidden">
<input class="field right manual24" name="attr_melee_attack_action_points_clean" type="number" min='2'>
</div>
<div class="mlehnd blueBackground section">
<div class="fieldLabelCenter white section">Hands</div>
<select name="attr_melee_attack_hands" class="dropDown manual20">
<option value=""></option>
<option value="Primary" >Primary</option>
<option value="Secondary" >Secondary</option>
<option value="Both" >Both</option>
</select>
</div>
<div class="mleshw section">
<input type="checkbox" name="attr_melee_checkbox_expand" value="1" class="expandEntry expand-state" title="@{melee_checkbox_expand}" />
</div>
<div class="mlenam blueBackground section">
<div class="fieldLabelCenter white section">Name</div>
<input class="field manual24" name="attr_melee_attack_name" type="text" value="New Melee Attack">
</div>
<div class="mlelde blueBackground blueBorderTop1 section">
<button class="buttonStyleTop load" name="act_loadmeleeattack" type="action" style="float:right;">Load</button>
</div>
<div class="mlerol blueBackground section">
<button
class="buttonStyleBottom roll"
name="roll_melee_attack"
type="roll"
value='&{template:default}{{name=@{melee_attack_name}}}{{Attack Roll=[[1d100cf5cs0+@{melee_attack_total_attack_bonus}]]}}{{Properties=@{melee_attack_properties}}}{{Resistance Penalty=[[@{melee_attack_resistance_penalty}]]}}{{@{melee_attack_damage_type_1} =[[@{melee_attack_number_of_damage_dice_1}d@{melee_attack_damage_dice_facet_number_1}cf0cs0+@{melee_attack_attribute_damage_bonus}+@{melee_attack_weapon_quality_damage_bonus}+@{melee_attack_weapon_skill_damage_bonus}+@{melee_attack_damage_bonus_1}]]}}{{@{melee_attack_damage_type_2} =[[@{melee_attack_number_of_damage_dice_2}d@{melee_attack_damage_dice_facet_number_2}cf0cs0+@{melee_attack_damage_bonus_2}]]}}{{@{melee_attack_damage_type_3} =[[@{melee_attack_number_of_damage_dice_3}d@{melee_attack_damage_dice_facet_number_3}cf0cs0+@{melee_attack_damage_bonus_3}]]}}'
style="float:right;">Attack</button>
</div>
<div class="mlebcb blueBackground section">
<div class="fieldLabelCenter white blueBackground section">Base</div>
<input
class="field derived24 section"
name="attr_melee_attack_basic_combat_bonus"
value="@{melee_subtotal}"
disabled="true">
</div>
<div class="mleskl blueBackground section">
<div class="fieldLabelCenter white blueBackground section">Wpn Skl</div>
<input class="field right manual24" name="attr_melee_attack_weapon_skill_attack_bonus" type="number" value='0' min='0'>
</div>
<div class="mlemsc blueBackground section">
<div class="fieldLabelCenter white blueBackground section">Misc.</div>
<input class="field right manual24" name="attr_melee_attack_miscellaneous_modifier" type="number" value='0'>
</div>
<div class="mletot blueBackground section">
<div class="fieldLabelCenter white blueBackground section">Total</div>
<input
class="field derived24 section"
name="attr_melee_attack_total_attack_bonus"
value="@{melee_attack_basic_combat_bonus}+@{melee_attack_weapon_skill_attack_bonus}+@{melee_attack_miscellaneous_modifier}"
disabled="true">
</div>
</div>
<div class="collapsed-view">
<!--What you want shown when the section is collapsed goes here-->
</div>
<div class="expanded-view">
<div class="meleeAttacksBodyGrid">
<div class="mledt1 section">
<div class="fieldLabelCenter white blueBackground section">Damage Type</div>
<select name="attr_melee_attack_damage_type_1" class="dropDown transparentBackground manual20">
<option value="" ></option>
<option value="Air" >Air</option>
<option value="Earth" >Earth</option>
<option value="Fire" >Fire</option>
<option value="Water" >Water</option>
<option value="Animus" >Animus</option>
<option value="Entropy" >Entropy</option>
<option value="Bludgeoning" >Bludgeoning</option>
<option value="Slashing" >Slashing</option>
<option value="Piercing" >Piercing</option>
<option value="Biological" >Biological</option>
<option value="Mental" >Mental</option>
<option value="Divine" >Divine</option>
<option value="Infernal" >Infernal</option>
</select>
</div>
<div class="mledi1 section">
<div class="fieldLabelCenter white blueBackground section">Dice #</div>
<input class="field right transparentBackground manual24" name="attr_melee_attack_number_of_damage_dice_1" type="number" value='0' min='0'>
</div>
<div class="mlefc1 section">
<div class="fieldLabelCenter white blueBackground section">Facet #</div>
<input class="field right transparentBackground manual24" name="attr_melee_attack_damage_dice_facet_number_1" type="number" value='0' min='0'>
</div>
<div class="mledb1 section">
<div class="fieldLabelCenter white blueBackground section">Bonus</div>
<input class="field right transparentBackground manual24" name="attr_melee_attack_damage_bonus_1" type="number" value='0'>
</div>
<div class="mledtl section">
<div class="fieldLabelCenter white blueBackground section">Details</div>
<textarea class="attacksTextarea baseTextarea blueBorder1 transparentBackground section" name="attr_melee_attack_details"></textarea>
</div>
<div class="mleadb section">
<div class="fieldLabelCenter white blueBackground section">Attr Dmg</div>
<input class="field right transparentBackground manual24" name="attr_melee_attack_attribute_damage_bonus" type="number" value='0'>
</div>
<div class="mlerpn section">
<div class="fieldLabelCenter white blueBackground section">Res Pen</div>
<input class="field right transparentBackground manual24" name="attr_melee_attack_resistance_penalty" type="number" value='0' max='0'>
</div>
<div class="mledt2 section">
<div class="fieldLabelCenter white blueBackground section">Damage Type</div>
<select name="attr_melee_attack_damage_type_2" class="dropDown transparentBackground manual20">
<option value="" ></option>
<option value="Air" >Air</option>
<option value="Earth" >Earth</option>
<option value="Fire" >Fire</option>
<option value="Water" >Water</option>
<option value="Animus" >Animus</option>
<option value="Entropy" >Entropy</option>
<option value="Bludgeoning" >Bludgeoning</option>
<option value="Slashing" >Slashing</option>
<option value="Piercing" >Piercing</option>
<option value="Biological" >Biological</option>
<option value="Mental" >Mental</option>
<option value="Divine" >Divine</option>
<option value="Infernal" >Infernal</option>
</select>
</div>
<div class="mledi2 section">
<div class="fieldLabelCenter white blueBackground section">Dice #</div>
<input class="field right transparentBackground manual24" name="attr_melee_attack_number_of_damage_dice_2" type="number" value='0' min='0'>
</div>
<div class="mlefc2 section">
<div class="fieldLabelCenter white blueBackground section">Facet #</div>
<input class="field right transparentBackground manual24" name="attr_melee_attack_damage_dice_facet_number_2" type="number" value='0' min='0'>
</div>
<div class="mledb2 section">
<div class="fieldLabelCenter white blueBackground section">Bonus</div>
<input class="field right transparentBackground manual24" name="attr_melee_attack_damage_bonus_2" type="number" value='0'>
</div>
<div class="mleqdb section">
<div class="fieldLabelCenter white blueBackground section">Quality Damage</div>
<input class="field transparentBackground manual24" name="attr_melee_attack_weapon_quality_damage_bonus" type="number" value='0'>
</div>
<div class="mledt3 section">
<div class="fieldLabelCenter white blueBackground section">Damage Type</div>
<select name="attr_melee_attack_damage_type_3" class="dropDown transparentBackground manual20">
<option value="" ></option>
<option value="Air" >Air</option>
<option value="Earth" >Earth</option>
<option value="Fire" >Fire</option>
<option value="Water" >Water</option>
<option value="Animus" >Animus</option>
<option value="Entropy" >Entropy</option>
<option value="Bludgeoning" >Bludgeoning</option>
<option value="Slashing" >Slashing</option>
<option value="Piercing" >Piercing</option>
<option value="Biological" >Biological</option>
<option value="Mental" >Mental</option>
<option value="Divine" >Divine</option>
<option value="Infernal" >Infernal</option>
</select>
</div>
<div class="mledi3 section">
<div class="fieldLabelCenter white blueBackground section">Dice #</div>
<input class="field right transparentBackground manual24" name="attr_melee_attack_number_of_damage_dice_3" type="number" value='0' min='0'>
</div>
<div class="mlefc3 section">
<div class="fieldLabelCenter white blueBackground section">Facet #</div>
<input class="field right transparentBackground manual24" name="attr_melee_attack_damage_dice_facet_number_3" type="number" value='0' min='0'>
</div>
<div class="mledb3 section">
<div class="fieldLabelCenter white blueBackground section">Bonus</div>
<input class="field right transparentBackground manual24" name="attr_melee_attack_damage_bonus_3" type="number" value='0'>
</div>
<div class="mlekdb section">
<div class="fieldLabelCenter white blueBackground section">Wpn Skill Damage</div>
<input class="field transparentBackground manual24" name="attr_melee_attack_weapon_skill_damage_bonus" type="number" value='0' min='0'>
</div>
</div>
<div class="meleeAttacksPropertiesGrid blueBackground">
<input name="attr_melee_attack_properties" type="hidden">
<div class="mlepr1 section">
<input type="checkbox" name="attr_melee_attack_checkbox_cold_iron_weapon" value="1" class="property" title="@{melee_attack_checkbox_cold_iron_weapon}"/> <span title="Cold Iron"></span>
</div>
<div class="mlepr2 section">
<input type="checkbox" name="attr_melee_attack_checkbox_silver_weapon" value="1" class="property" title="@{melee_attack_checkbox_silver_weapon}"/> <span title="Silver"></span>
</div>
<div class="mlepr3 section">
<input type="checkbox" name="attr_melee_attack_checkbox_blessed_weapon" value="1" class="property" title="@{melee_attack_checkbox_blessed_weapon}"/> <span title="Blessed"></span>
</div>
<div class="mlepr4 section">
<input type="checkbox" name="attr_melee_attack_checkbox_enchanted_weapon" value="1" class="property" title="@{melee_attack_checkbox_enchanted_weapon}"/> <span title="Enchanted"></span>
</div>
<div class="mlepr5 section">
<input type="checkbox" name="attr_melee_attack_checkbox_magic_weapon" value="1" class="property" title="@{melee_attack_checkbox_magic_weapon}"/> <span title="Magic"></span>
</div>
<div class="mlepr6 section">
<input type="checkbox" name="attr_melee_attack_checkbox_spectral_weapon" value="1" class="property" title="@{melee_attack_checkbox_spectral_weapon}"/> <span title="Spectral"></span>
</div>
<div class="mledm1 section"></div>
<div class="mledm2 section"></div>
<div class="mledm3 section"></div>
<div class="mledm4 section"></div>
<div class="mledm5 section"></div>
</div>
</div>
</div>
</fieldset>
The sheetworker that autopopulates attr_melee_attack_action_points and attr_melee_attack_reach: // load melee attack properties & AP
on('change:repeating_meleeattacks:melee_attack_properties change:repeating_meleeattacks:melee_attack_checkbox_cold_iron_weapon change:repeating_meleeattacks:melee_attack_checkbox_silver_weapon change:repeating_meleeattacks:melee_attack_checkbox_blessed_weapon change:repeating_meleeattacks:melee_attack_checkbox_enchanted_weapon change:repeating_meleeattacks:melee_attack_checkbox_magic_weapon change:repeating_meleeattacks:melee_attack_checkbox_spectral_weapon change:repeating_meleeattacks:melee_attack_action_points_clean change:repeating_meleeattacks:melee_attack_reach_clean', () => {
getAttrs(['repeating_meleeattacks_melee_attack_properties', 'repeating_meleeattacks_melee_attack_checkbox_cold_iron_weapon', 'repeating_meleeattacks_melee_attack_checkbox_silver_weapon', 'repeating_meleeattacks_melee_attack_checkbox_blessed_weapon', 'repeating_meleeattacks_melee_attack_checkbox_enchanted_weapon', 'repeating_meleeattacks_melee_attack_checkbox_magic_weapon', 'repeating_meleeattacks_melee_attack_checkbox_spectral_weapon', 'repeating_meleeattacks_melee_attack_action_points_clean', 'repeating_meleeattacks_melee_attack_reach_clean'], values => {
const propsSelected = [
[int(values.repeating_meleeattacks_melee_attack_checkbox_cold_iron_weapon), "cold iron, "],
[int(values.repeating_meleeattacks_melee_attack_checkbox_silver_weapon), "silver, "],
[int(values.repeating_meleeattacks_melee_attack_checkbox_blessed_weapon), "blessed, "],
[int(values.repeating_meleeattacks_melee_attack_checkbox_enchanted_weapon), "enchanted, "],
[int(values.repeating_meleeattacks_melee_attack_checkbox_magic_weapon), "magic, "],
[int(values.repeating_meleeattacks_melee_attack_checkbox_spectral_weapon), "spectral, "]
];
const act_pnts = "AP:" + int(values.repeating_meleeattacks_melee_attack_action_points_clean);
const reach = "Reach:" +int(values.repeating_meleeattacks_melee_attack_reach_clean);
var props = "";
var i = 0;
while (i < propsSelected.length) {
if (propsSelected[i][0] > 0)
props += propsSelected[i][1];
i++;
}
props = props.slice(0, props.length - 2);
console.log(
'load melee attack properties & AP' + '\n',
'melee_attack_properties: ' + props + '\n',
'melee_attack_action_points: ' + act_pnts + '\n',
'melee_attack_reach: ' + reach
);
setAttrs({
repeating_meleeattacks_melee_attack_properties: props,
repeating_meleeattacks_melee_attack_action_points: act_pnts,
repeating_meleeattacks_melee_attack_reach: reach
});
});
});