So this is the error I'm seeing: TypeError: Cannot read property '0' of undefined
at Object.eval [as -M5SIsHyheCjqByBODMA//false//0.34907922302937244] (eval at messageHandler (sheetsandboxworker.js?1599542623218:698), <anonymous>:2285:21)
at _fullfillAttrReq (sheetsandboxworker.js?1599542623218:673)
at messageHandler (sheetsandboxworker.js?1599542623218:705) The worker has a multidimensional array called minimums, and pulling a value from that array appears to be what is causing the issue. I don't know why though. This is the worker that is throwing it: // update standard effects
on('change:effect_deafened_checkbox change:effect_blinded_checkbox change:effect_invisible_checkbox change:effect_high_ground_checkbox change:effect_ambushed_checkbox change:effect_prone_mounted_checkbox change:effect_prone_mounted_value change:effect_flank_back_checkbox change:effect_flank_back_value change:effect_range_checkbox change:effect_range_value change:effect_overwhelming_checkbox change:effect_overwhelming_foe_number change:effect_overwhelming_party_size change:effect_overwhelming_party_levels', () => {
getAttrs(['effect_deafened_checkbox', 'effect_blinded_checkbox', 'effect_invisible_checkbox', 'effect_high_ground_checkbox', 'effect_ambushed_checkbox', 'effect_prone_mounted_checkbox', 'effect_prone_mounted_value', 'effect_flank_back_checkbox', 'effect_flank_back_value', 'effect_range_checkbox', 'effect_range_value', 'effect_overwhelming_checkbox', 'effect_overwhelming_foe_number', 'effect_overwhelming_party_size', 'effect_overwhelming_party_levels'], values => {
const prn_mntd_chkbox = int(values.effect_prone_mounted_checkbox);
const prn_mntd_value = int(values.effect_prone_mounted_value);
const flnk_bck_chkbox = int(values.effect_flank_back_checkbox);
const flnk_bck_value = int(values.effect_flank_back_value);
const rng_chkbox = int(values.effect_range_checkbox);
const rng_value = int(values.effect_range_value);
const ovrwhlm_foe_nmbr = int(values.effect_overwhelming_foe_number);
const ovrwhlm_prt_size = int(values.effect_overwhelming_party_size);
const ovrwhlm_prt_lvls = int(values.effect_overwhelming_party_levels);
const prone = prn_mntd_value == 0 ? prn_mntd_chkbox : 0;
const mounted = prn_mntd_value == 1 ? prn_mntd_chkbox : 0;
const flank = flnk_bck_value == 0 ? flnk_bck_chkbox : 0;
const back = flnk_bck_value == 1 ? flnk_bck_chkbox : 0;
const melee_rng = rng_value == 0 ? rng_chkbox : 0;
const short_rng = rng_value == 1 ? rng_chkbox : 0;
const long_rng = rng_value == 2 ? rng_chkbox : 0;
const extreme_rng = rng_value == 3 ? rng_chkbox : 0;
const minimums = [
[1, 5],
[2, 8],
[3, 9],
[4, 12],
[5, 14],
[6, 14],
[7, 16],
[8, 16]
];
var minimum = 0;
var overwhelmMelee = 0;
var overwhelmRanged = 0;
var i = 0;
while (i < 8) {
i++;
if (minimums[i][0] == ovrwhlm_foe_nmbr)
minimum = minimus[i][1];
}
if (ovrwhlm_prt_size >= minimum)
overwhelmMelee = ovrwhlm_prt_size * 5 + ovrwhlm_prt_lvls;
if (melee_rng == 1)
overwhelmRanged = overwhelmMelee;
const modifiers = [
/* [checkbox, melee, ranged, mystic, defense] */
/* prone */ [prone, -10, -15, -15, -30],
/* mounted */ [mounted, 15, -15, -15, 5],
/* flank */ [flank, 25, 25, 25, 0],
/* back */ [back, 50, 50, 50, 0],
/* melee_rng */ [melee_rng, 0, -10, -10, 0],
/* short_rng */ [short_rng, 0, 10, 10, 0],
/* long_rng */ [long_rng, 0, -30, -30, 0],
/* extreme_rng */ [extreme_rng, 0, -75, -75, 0],
/* 8 deaf */ [int(values.effect_deafened_checkbox), -10, -10, -10, -10],
/* 9 blind */ [int(values.effect_blinded_checkbox), -75, -150, -150, -40],
/* 10 invisible */ [int(values.effect_invisible_checkbox), 0, 0, 0, 150],
/* 11 high ground */ [int(values.effect_high_ground_checkbox), 10, 0, 0, 0],
/* 12 ambushed */ [int(values.effect_ambushed_checkbox), 0, 0, 0, -15],
/* 13 overwhelm */ [int(values.effect_overwhelming_checkbox), overwhelmMelee, overwhelmRanged, 0, 0]
];
var i = 0;
var melee = 0;
var rangedMystic = 0;
var defense = 0;
while (i < 12) {
if (modifiers[i][0] > 0) {
melee += modifiers[i][1];
ranged += modifiers[i][2];
mystic += modifiers[i][3];
defense += modifiers[i][4];
}
i++;
}
console.log(
'update standard effects' + '\n',
'standard_melee_bonuses: ' + melee + '\n',
'standard_ranged_bonuses: ' + ranged + '\n',
'standard_mystic_bonuses: ' + mystic + '\n',
'standard_defense_bonuses: ' + defense
);
setAttrs({
standard_melee_bonuses: melee,
standard_ranged_bonuses: ranged,
standard_mystic_bonuses: mystic,
standard_defense_bonuses: defense
});
});
});
This is the code for the UI elements that contain the values used in the worker: <!-- Standard Effects -->
<div class="deafn_ blueBackground section">
<input type="checkbox" name="attr_effect_deafened_checkbox" value="1" class="effectOverview" title="@{effect_deafened_checkbox}"/> <span title="Status: Deafened"></span>
</div>
<div class="quick_ blueBackground section">
<input type="checkbox" name="attr_effect_quickness_checkbox" value="1" class="effectOverviewShort" title="@{effect_quickness_checkbox}"/> <span title="Quicknes."></span>
</div>
<div class="blind_ blueBackground section">
<input type="checkbox" name="attr_effect_blinded_checkbox" value="1" class="effectOverview" title="@{effect_blinded_checkbox}"/> <span title="Status: Blinded"></span>
</div>
<div class="invef_ blueBackground section">
<input type="checkbox" name="attr_effect_invisible_checkbox" value="1" class="effectOverview" title="@{effect_invisible_checkbox}"/> <span title="Status: Invisible"></span>
</div>
<div class="hghgr_ blueBackground section">
<input type="checkbox" name="attr_effect_high_ground_checkbox" value="1" class="effectOverview" title="@{effect_high_ground_checkbox}"/> <span title="High Ground"></span>
</div>
<div class="ambsh_ blueBackground section">
<input type="checkbox" name="attr_effect_ambushed_checkbox" value="1" class="effectOverview" title="@{effect_ambushed_checkbox}"/> <span title="Am-bushed"></span>
</div>
<div class="prmnt_ effectDropdownBox section">
<input type="checkbox" name="attr_effect_prone_mounted_checkbox" value="1" class="effectOverviewDropdown" title="@{effect_prone_mounted_checkbox}"/> <span title="Prone / Mounted:"></span>
<select name="attr_effect_prone_mounted_value" class="effectDropdown transparentBackground">
<option value="0">Prone</option>
<option value="1">Mounted</option>
</select>
</div>
<div class="flkbk_ effectDropdownBox section">
<input type="checkbox" name="attr_effect_flank_back_checkbox" value="1" class="effectOverviewDropdown" title="@{effect_flank_back_checkbox}"/> <span title="Flank / Back Attack:"></span>
<select name="attr_effect_flank_back_value" class="effectDropdown transparentBackground">
<option value="0">Flank</option>
<option value="1">Back</option>
</select>
</div>
<div class="range_ effectDropdownBox section">
<input type="checkbox" name="attr_effect_range_checkbox" value="1" class="effectOverviewDropdown" title="@{effect_range_checkbox}"/> <span title="% of Med. Range:"></span>
<select name="attr_effect_range_value" class="effectDropdown transparentBackground">
<option value="0">Melee</option>
<option value="1">Short 50%</option>
<option value="2">Long 150%</option>
<option value="3">Extreme 200%</option>
</select>
</div>
<div class="overw_ effectDropdownBox section">
<div class="overwhelmGrid transparentBackground">
<div class="dfndr_ section">
<input type="checkbox" name="attr_effect_overwhelming_checkbox" value="1" class="effectOverviewDropdown" title="@{effect_overwhelming_checkbox}"/> <span title="Overwhelmed Foes"></span>
<select name="attr_effect_overwhelming_foe_number" class="effectDropdown transparentBorderBottom transparentBackground">
<option value="0">1 Foe</option>
<option value="1">2 Foes</option>
<option value="2">3 Foes</option>
<option value="3">4 Foes</option>
<option value="4">5 Foes</option>
<option value="5">6 Foes</option>
<option value="6">7 Foes</option>
<option value="7">8 Foes</option>
</select>
</div>
<div class="pnum__ section">
<input type="checkbox" name="attr_effect_overwhelming_checkbox" value="1" class="effectOverviewLabel" title="@{effect_overwhelming_checkbox}"/> <span title="Party of:"></span>
</div>
<div class="plvl__ section">
<input type="checkbox" name="attr_effect_overwhelming_checkbox" value="1" class="effectOverviewLabel" title="@{effect_overwhelming_checkbox}"/> <span title="Levels:"></span>
</div>
<div class="pnumb_ section">
<input class="field manual19 transparentBackground transparentField" name="attr_effect_overwhelming_party_size" type="number" value='0'>
</div>
<div class="plvls_ section">
<input class="field manual19 transparentBackground transparentField" name="attr_effect_overwhelming_party_levels" type="number" value='0'>
</div>
</div>
</div>