
Okay, I have two fields that receive dice (1D6, 1D8, etc). I need the two fields to be multiplied. Field 1 = 1D6 Field 2 = 1D12 These fields are manually filled. As a macro it works. In the chat box I can simply do [[1D6*1D12]] and that works. But not in javascript Here's the on(change I have for it. // Watching for when rangedweapon change on('change:rangedWeapon change:rangedDamage change:rangedHitBonus change:rangedPenetrationPlus change:rangedRoF change:rangedAmmunition change:rangedAmmunition_max change:rangedRange change:rangedSkill change:ranged_rf', function(eventInfo) { getAttrs(['rangedWeapon', 'rangedDamage', 'rangedHitBonus', 'rangedPenetrationPlus', "rangedRoF", "rangedAmmunition", 'rangedAmmunition_max', 'rangedRange', 'rangedSkill',], function(values) { let textToChat = "&{template:default}"; textToChat = textToChat.concat(" {{name=" + values.rangedWeapon + "}}"); textToChat = textToChat.concat(" {{Hit= [[1d20+" + values.rangedHitBonus + "]]}}"); textToChat = textToChat.concat(" {{Damage= [[" + values.rangedDamage + "]]}}");
// in this section I was trying to add 2 lines, first for the attack roll, the 2nd to add the damage // // textToChat = textToChat.concat(" {{Rapid Fire= [[1d20+" + values.rangedHitBonus + "]]}}"); // textToChat = textToChat.concat(" {{Damage= [[" + values.rangedDamage * values.ranged_rf + "]]}}"); // I couldn't get it to work, because I don't know the lingo to multiply in this specific syntax!!!
textToChat = textToChat.concat(" {{Penetration= " + values.rangedPenetrationPlus + "}}"); textToChat = textToChat.concat(" {{Ammunition= " + String(parseInt(values.rangedAmmunition)-1) + " / " + values.rangedAmmunition_max + "}}"); console.log(textToChat); setAttrs({ rangedRoll : textToChat }); }); }); Thanks in advance!