I'm new to Character Sheet creation within Roll20, have a fair amount of coding knowledge, though nothing professional, and have been going through the tutorials and guides online for Roll20 sheetworkers. I thought I had it figured out but am coming up empty. I got into sheet creation simply because I wanted to fix some issues with and existing sheet, Dark Heresy 2nd Edition Advanced, but have found myself wanting to add a bit more than intended. The first section shows the attr_Strength & attr_Toughness for those specific Attributes. In the second section I show where I'm trying to send the result of my code, attr_CarryMod & attr_CarryBase. The last section shows the code that I wrote based off my reading of Roll20 character sheet guides and my own personal knowledge. I'm attempting to use the Core Rulebook's set values for SB+TB and have the value automatically entered into CarryMod, then also have the value created and added for starting maximum weight into CarryBase. I also am adding a section for maximum weight and available weight but those can be entered utilizing existing Attribute values without advanced calculations or statements. Can someone point out what I'm doing wrong here? If you need more context please let me know what to add beyond what is already shown. Thank you. <!-- Strength (S) -->
<div class="sheet-2colrow">
<div class="sheet-col">
<button name="roll_S" type="roll" value="/em rolls Strength: [[1d100]] Target: [[@{Strength}+ ?{Modifier|0}]]."><span data-i18n="strength-(s)-u">Strength (S)</span></button>
</div>
<div class="sheet-col">
<div class="sheet-unnatural_box">
<input name="attr_Strength" class="sheet-unnaturaltext" type="text" value="0">
<input name="attr_UnS" Title="Unnatural Strength" class="sheet-unnatural" type="number" value="0" />
...
<!-- Toughness (T) -->
<div class="sheet-2colrow">
<div class="sheet-col">
<button name="roll_T" type="roll" value="/em rolls Toughness: [[1d100]] Target: [[@{Toughness}+ ?{Modifier|0}]]."><span data-i18n="toughness-(t)-u">Toughness (T)</span></button>
</div>
<div class="sheet-col">
<div class="sheet-unnatural_box">
<input name="attr_Toughness" class="sheet-unnaturaltext" type="text" value="0">
<input name="attr_UnT" Title="Unnatural Toughness" class="sheet-unnatural" type="number" value="0" />
... <h3 data-i18n="gear-u">Gear</h3>
<div class="sheet-quickborder">
<div class="sheet-row">
<div class="sheet-item" style="width:15%">
<span data-i18n="max-carry-wt-(sb+tb)-u">Carry Modifier: </span>
</div>
<div class="sheet-item" style="width:15%">
<input name="attr_CarryMod" type="number" disabled="disabled"/>
<!-- value="floor(@{Strength}/10)+@{UnS}+floor(@{Toughness}/10)+@{UnT}"-->
</div>
<div class="sheet-item" style="width:15%">
<span style="width:15%" data-i18n="base-weight">Base Carry: </span>
</div>
<div class="sheet-item" style="width:15%">
<input name="attr_CarryBase" type="number" disabled="disabled"/>
</div>
<div class="sheet-item" style="width:15%">
<span style="width:15%" data-i18n="max-weight">Max Carry: </span>
</div>
<div class="sheet-item" style="width:15%">
<input name="attr_CarryMax" type="number" disabled="disabled"/>
</div>
</div>
... on('change:Strength change:Toughness',function()
{
getAttrs([Strength, Toughness], function(values)
{
let str = parseInt(values.Strength||0);
let tgh = parseInt(values.Toughness||0);
let cMod = str + tgh;
let cBase = 0;
switch(cBase)
{
case 0:
cBase = 0.9;
break;
case 1:
cBase = 2.25;
break;
case 2:
cBase = 4.5;
break;
case 3:
cBase = 9;
break;
case 4:
cBase = 18;
break;
case 5:
cBase = 27;
break;
case 6:
cBase = 36;
break;
case 7:
cBase = 45;
break;
case 8:
cBase = 56;
break;
case 9:
cBase = 67;
break;
case 10:
cBase = 78;
break;
case 11:
cBase = 90;
break;
case 12:
cBase = 112;
break;
case 13:
cBase = 225;
break;
case 14:
cBase = 337;
break;
case 15:
cBase = 450;
break;
case 16:
cBase = 675;
break;
case 17:
cBase = 900;
break;
case 18:
cBase = 1350;
break;
case 19:
cBase = 1800;
break;
case 20:
cBase = 2250;
break;
}
SetAttrs({
CarryMod: cMod
CarryBase: cBase
});
});
});