Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Help with NPC damage autoroller for 5e ogl

I set up this script and everything works fine, except for one thing. I have my campaign set to whisper NPC rolls and this script outputs the auto rolled damage globally. I have read through the API wiki for roll20 and tried to think about what would go where to make this script whisper as default but I just do not know the proper syntax for the code to make it work and I know I would most likely just break it instead of fixing it if I tried to do it alone. Any help on this issue would be greatly appreciated.  For reference to what script I mean, it is the one in  this post.  
Already had the same issue as you and made the same changes you were looking for.  This was a quick hack and will now only whisper the gm the rolls even if rolled publicly. on('chat:message', function(msg) { // ROLL LISTENER if(msg.playerid.toLowerCase() != "api" && msg.rolltemplate) { if (msg.rolltemplate === "npcaction"){ let desc = ((msg.content.split("{{description=")[1]||'').split("}}")[0]||''); if (desc.match(/\(\d+(d)\d+.*\)/g)) { let output =[]; let roll = desc.match(/\(\d+(d)\d+.*\)/g); let type = desc.match(/\)\s\w+/g); for (let n = 0; n < roll.length; n++) { output[n] = {die: roll[n].replace(/\(/g, "[[").replace(/\)/g, "]]"), type: type[n].replace(") ", "")}; } for (let x of output) { sendChat(msg.who, "/w gm &{template:npcdmg} {{damage=1}} {{dmg1=" + x.die + "}} {{dmg1flag=1}} {{dmg1type=" + x.type + "}}"); } } } } });
Awesome, Thanks for the reply. I will say, I thought that might be what was needed and where, just wanted to verify. Thanks again for the help.
No problem, happy to help!