
Hi, There's a lot of great info from GiGs and others about sheetworkers. I've followed what I could, and I'm clearly not doing it right. What I'm trying to do is say, if you choose a given vehicle, the stats on that vehicle fill themselves in for you. Here's the code for the vehicle section repeater- <div class="sheet-vehicles">
<h1 class="sheet-section">Vehicles</h1>
<table width="100%">
</table>
<fieldset class="repeating_vehicles">
<table width="100%">
<tbody>
<tr>
<th width="20%">Description</th>
<th width="7%">Quick</th>
<th width="7%">Weight</th>
<th width="10%">Armor</th>
<th width="13%">SP</th>
<th width="15%">Range</th>
<th width="20%">Speed</th>
<th width="7%">Acc</th>
</tr>
<tr>
<td><input type="text" name="attr_VehicleName"></td>
<td><input type="text" name="attr_VehicleQuick" min="0"></td>
<td><input type="text" name="attr_VehicleWeight" min="0"></td>
<td><input type="text" name="attr_VehicleArmor" min="0"></td>
<td><input type="text" name="attr_VehicleSP"></td>
<td>
<select name="attr_VehicleRange">
<option selected></option>
<option>Touching</option>
<option>Close</option>
<option>Medium</option>
<option>Far</option>
<option>Extreme</option>
<option>Out Of Range</option>
</select>
</td>
<td>
<select name="attr_VehicleSpeed">
<option selected></option>
<option>Safe</option>
<option>Risky</option>
<option>Dangerous</option>
<option>Life Threatening</option>
<option>Crazy</option>
<option>Plaid</option>
</select>
</td>
<td><input type="text" name="attr_VehicleAcc" min="0"></td>
</tr>
<tr>
<th>Class</th>
<th>Safe</th>
<th>Risky</th>
<th>Dangerous</th>
<th>Life Threatening</th>
<th>Crazy</th>
<th>Plaid</th>
</tr>
<tr>
<td>
<select name="attr_VehicleType">
<option selected></option>
<option value="1">Skateboard</option>
<option value="2">Bicycle</option>
<option value="3">Moped</option>
<option value="4">Motorcycle</option>
<option value="5">Hog</option>
<option value="6">Compact Car</option>
<option value="7">Medium Car</option>
<option value="8">Large SUV</option>
<option value="9">Van</option>
<option value="10">Small Truck</option>
<option value="11">Truck</option>
<option value="12">Bus</option>
</select>
</td>
<td><input type="text" name="attr_VehicleSpeedSafe"></td>
<td><input type="text" name="attr_VehicleSpeedRisky"></td>
<td><input type="text" name="attr_VehicleSpeedDangerous"></td>
<td><input type="text" name="attr_VehicleSpeedLifeThreatening"></td>
<td><input type="text" name="attr_VehicleSpeedCrazy"></td>
<td><input type="text" name="attr_VehicleSpeedPlaid"></td>
<th>kph</th>
</tr>
</tbody>
</table>
</fieldset>
</div> And here's the sheetworker bit- <script type="text/worker">
on("change:repeating_vehicles:vehicletype sheet:opened", function() { //when the VehicleType dropdown changes
getAttrs(["repeating_vehicles:VehicleType"], function(values) { //read the value of the selected entry in the VehicleType dropdown
const vehicles = {
Skateboard: {quick: 7, safe: 5, risky: 10, dangerous: 20, life_threatening: 30, crazy: 40, plaid: 50, tons: 0.0001, SP: 1, armor: 0},
Bicycle: {quick: 6, safe: 15, risky: 25, dangerous: 40, life_threatening: 50, crazy: 70, plaid: 80, tons: 0.001, SP: 2, armor: 0},
Moped: {quick: 4, safe: 20, risky: 40, dangerous: 50, life_threatening: 70, crazy: 100, plaid: 1200, tons: 0.03, SP: 5, armor: 1},
Motorcycle: {quick: 10, safe: 30, risky: 50, dangerous: 75, life_threatening: 100, crazy: 130, plaid: 50, tons: 0.5, SP: , armor: 1},
Hog: {quick: 7, safe: 30, risky: 60, dangerous: 80, life_threatening: 110, crazy: 150, plaid: 180, tons: 0.7, SP: 8, armor: 1},
Compact car: {quick: 4, safe: 30, risky: 50, dangerous: 70, life_threatening: 90, crazy: 120, plaid: 140, tons: 1.3, SP: 13, armor: 3},
Medium Car: {quick: 6, safe: 30, risky: 50, dangerous: 80, life_threatening: 100, crazy: 130, plaid: 150, tons: 1.5, SP: 15, armor: 3},
Large SUV: {quick: 6, safe: 20, risky: 50, dangerous: 70, life_threatening: 90, crazy: 120, plaid: 150, tons: 2.4, SP: 24, armor: 4},
Van: {quick: 5, safe: 30, risky: 50, dangerous: 70, life_threatening: 100, crazy: 120, plaid: 140, tons: 6, SP: 30, armor: 3},
Small Truck: {quick: 4, safe: 30, risky: 50, dangerous: 80, life_threatening: 100, crazy: 110, plaid: 120, tons: 12, SP: 40, armor: 2},
Truck: {quick: 3, safe: 30, risky: 50, dangerous: 80, life_threatening: 100, crazy: 110, plaid: 120, tons: 25, SP: 60, armor: 4},
Bus: {quick: 3, safe: 30, risky: 50, dangerous: 80, life_threatening: 100, crazy: 110, plaid: 120, tons: 17, SP: 50, armor: 4}
};
let VehicleTypeValue = values.VehicleType||0; //make a temp variable called "VehicleTypeValue" and store the value of VehicleType in it. If not selected, 0
setAttrs({
"repeating_vehicles:attr_VehicleSpeedSafe": VehicleType.safe //pass VehicleTypeValue into VehicleSpeedSafe
});
)};
)};
</script> Any idea why the Safe speed is not showing up in the field if I choose a vehicle?