Aarani said: Thank you both for the responses! At least I know now that the inline rolls can't show the rolls. How can I send chat strings out to the chat window from a worker script? I think I am going to have to rewrite all my inline rolls if I have to. Here's a script I quickly edited from one I posted to a similar question: /*
Call this as follows:
!custom-roll-template [[1d100]] @{physstat} {?{Modifier|0}
Be careful! it must begin with !custom-roll-template followed by a space, followed by an inline roll (in this case [[1d100]])
You can then have any number of modifiers, which must be simple numbers separated by spaces, or stat calls.
For example:
!custom-roll-template [[1d100]] 6 @{physstat} {?{Modifier|0} 17 23 -5
*/
on('ready',function(){
'use strict';
on('chat:message',function(msg){
if('api' === msg.type && msg.content.match(/^!custom-roll-template/) ){
let args = msg.content.split(/\s+/);
if(msg.inlinerolls === undefined) { //msg.inlinerolls
sendChat("Initiative","No Roll Detected");
return;
};
let bonus = 0;
for(var i = 2; i < args.length; i++) {
bonus += parseInt(args[i])||0;
}
let roll = msg.inlinerolls[0].results.total;
let total = roll + bonus;
//let outPut = '&{template:default} {{name=Custom Roll}} {{Result='+total+'}} {{Roll='+roll+'}}';
let outPut = '&{template:statroll} {{result='+total+'}} {{roll='+roll+'}}';
sendChat(msg.who,outPut);
}
});
});
Post that in the API Scripts section of your campaign. Then in your character sheet, change this value="&{template:statroll} {{result=[[(@{physstat} + ?{Modifier|0}) - 1d100]]}} to this: value="!custom-roll-template [[1d100]] @{physstat} {?{Modifier|0}" So the button on your character sheet sends text to chat, which is intercepted by the script. The script than identifies the roll, and adds the bonuses to it to get a result. Then the sendchat line in the script sends text back to chat, and that is intercepted by your rolltemplate. It's pretty convoluted, but it works! Also, about your template, adding a second row might make it prettier. it'll make the numbers line up in the output, like this: <rolltemplate>
<table>
<tr><td>Result:</td><td>{{result}}</td></tr>
<tr><td>Roll:</td><td>{{roll}}</td></tr>
</table>
</rolltemplate>