I'm working on a script that constructs and sends a macro to chat using something like: sendChat('character|' + character.id, macroString) When I create the macro with an API command and sendChat(), the ammo tracking doesn't work (though the rest of the output is formatted correctly). If I simply paste 'macroString' into chat, it does properly deduct ammo (and also still formats correctly). Some initial points: 1. 'macroString' is a formatted macro, using an atkdmg template and including roll information.
The ammo section is formatted like: {{ammo=' +
getAttrByName(character.id, 'custom_resource') + ' @{' +
character.get('name') + '|charname_output}}} 2. For the ammo I'd like to use, I'm manually copying the resource ID from an already created ammo resource tracker, so the value of the custom_resource I'm passing looks something like 'Arrows|-OaWjCykKAarqfvyWXeR' I've looked over the Companion source code for handleammo() and I'm guessing the issue is that sendChat() isn't satisfying the 'player' object, so handleammo() returns nothing - as opposed to manually sending 'macroString' myself. All this said, I'm coming to you fine people to see if I'm missing something. Is there a way to get the Companion ammo tracking to trigger in a macro that was created using sendChat()?