If you want the results of an API command to show in a Roll Template, then the API command must emit the Roll Template as it's output: // some calculations ...
sendChat('Roll Template Result', `&{template:someTemplate}{{name=${someVar} result}}{{roll=${someOtherVar}}}`); If you want the Roll Template to make the decision on what should be output, you have to use it's syntax: <table>
<tr><th>{{rollname}}</th></tr>
<tr><td><span class="tcat">Attack: </span>{{attack}}</td></tr>
<tr>
<td>
<span class="tcat">Damage: </span>{{damage}}
{{#rollWasCrit() attack}}
<span class="tcat">Crit: </span>{{dmgcrit}}
{{/rollWasCrit() attack}}
</td>
</tr>
</table> Which requires editing the character sheet.