
Hey Guys! Okay... the hole in the wall keeps getting bigger from my head... I have a set of fields which when defined I want to be displayed in the chat. Pretty standard. Hit Roll, Dmg Roll, Weapons Range, notes, etc. But the Watcher doesn't seem to be grabbing all the lines. Just 4: Weapon Name, Dmg Roll, Penetration, Ammunition This is what it currently looks like when rolled: But it should have 6 more rows of data! And they are not sequential, meaning the data should be peppered between some of the above image. Here is the HTML that defines the weapons stats: (I Know, I have to update it to the new "non table" method...) //Combat section where you define the weapons stats//
<div class="widget borderedContainer">
<span class="subheading">Ranged Weapon</span><br />
<table>
<tr>
<td>Weapon</td>
<td colspan="3"><input class="inputfield text gold-color" style="width: 200px;" type="text" name="attr_rangedWeapon" /></td>
</tr>
<tr>
<td>Damage</td>
<td><input class="inputfield text blue-color" style="width: 80px;" type="text" name="attr_rangedDamage" /></td>
<td>RoF</td>
<td><input class="inputfield text blue-color" style="width: 80px;" type="text" name="attr_rangedRoF" /></td>
</tr>
<tr>
<td>Rpd Fire</td>
<td><input class="inputfield text blue-color" style="width: 80px;" type="text" name="attr_rangedDamage_rf"/></td>
<td>RF DR</td>
<td><input class="inputfield text blue-color" style="width: 80px;" type="text" name="attr_rangedDamage_rf_dr"/></td>
</tr>
<tr>
<td>Range</td>
<td><input class="inputfield text blue-color" style="width: 80px;" type="number" name="attr_rangedRange" min="0" max="9999"/></td>
<td>Hit bonus</td>
<td><input class="inputfield text blue-color" style="width: 80px;" type="number" name="attr_rangedHitBonus" min="0" max="9999"/></td>
</tr>
<tr>
<td>P+</td>
<td><input class="inputfield text blue-color" style="width: 80px;" type="number" name="attr_rangedPenetrationPlus" min="0" max="9999"/></td>
<td>Notes</td>
<td><input class="inputfield text blue-color" style="width: 80px;" type="text" name="attr_ranged_notes" /></td>
</tr>
<tr>
<td>Ammunition</td>
<td><input class="inputfield text blue-color" style="width: 80px;" type="number" name="attr_rangedAmmunition" min="0" max="9999"/></td>
<td>/</td>
<td><input class="inputfield text blue-color" style="width: 80px;" type="number" name="attr_rangedAmmunition_max" min="0" max="9999"/></td>
</tr>
<tr>
</tr>
</table><br />
<table>
<tr>
<td style="width:50px"><button class="blank-roll-button" type="roll" value="@{rangedRoll}" >Attack</button></td>
<td style="width:50px"><button type="action" class="blank-roll-button" name="act_rangedAmmoReduce" >Ammo-</button></td>
<td style="width:50px"><button type="action" class="blank-roll-button" name="act_rangedAmmoReload" >Reload</button></td>
</tr>
</table>
</div> Here is the watcher for this section: // Watching for when rangedweapon change
on('change:rangedWeapon change:rangedDamage change:rangedRoF change:rangedDamage_rf change:ranged_rf_dr change:rangedPenetrationPlus change:rangedHitBonus change:rangedRange change:ranged_notes change:rangedAmmunition change:rangedAmmunition_max', function(eventInfo) {
getAttrs([ 'rangedWeapon' 'rangedDamage' 'rangedRoF' 'rangedDamage_rf' 'ranged_rf_dr' 'rangedPenetrationPlus' 'rangedHitBonus' 'rangedRange' 'ranged_notes' 'rangedAmmunition' 'rangedAmmunition_max',], function(values) {
let textToChat = "&{template:default}";
// let rf_dmg = rangedDamage * rangedDamaged_rf;
textToChat = textToChat.concat(" {{Name= " + values.rangedWeapon + "}}");
textToChat = textToChat.concat(" {{Dmg= [[" + values.rangedDamage + "]]}}");
textToChat = textToChat.concat(" {{RoF= " + values.rangedRoF + "}}");
textToChat = textToChat.concat(" {{RF DR=" + values.ranged_rf_dr + "}}");
textToChat = textToChat.concat(" {{RF Damage= [[" + values_rangedDamage * values.rangedDamage_rf + "]]}}");
textToChat = textToChat.concat(" {{Penetration= " + values.rangedPenetrationPlus + "}}");
textToChat = textToChat.concat(" {{Hit= [[1d20+" + values.rangedHitBonus + "]]}}");
textToChat = textToChat.concat(" {{Range= " + values.rangedRange + "}}");
textToChat = textToChat.concat(" {{Notes= " + values.ranged_notes + "}}");
textToChat = textToChat.concat(" {{Ammunition= " + String(parseInt(values.rangedAmmunition)-1) + " / " + values.rangedAmmunition_max + "}}");
console.log(textToChat);
setAttrs({ rangedRoll : textToChat });
});
}); Here is a link to the full sheet if you think the issue is elsewhere. <a href="https://github.com/MavSantroy/Drakudai/blob/main/Drakudai%20Hero%20Sheet%205-11-2022" rel="nofollow">https://github.com/MavSantroy/Drakudai/blob/main/Drakudai%20Hero%20Sheet%205-11-2022</a>