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 .
×
Advertisement Create a free account

Trying to write a macro for a token action that whispers a player's perception roll to me

1631667390
I confess that I have a very limited amount of experience writing macros. I'm trying to make a token action button for my players to roll perception but conceal the results from them. This way if they don't "find" something they don't simply attribute it to their low roll. I came up with this as a token action /gmroll 1d20+@{selected|perception_bonus} [Perception] I did the same for investigation. It's clumsy but it works. Does anyone have a simpler or cleaner macro for this? Thanks in advance.
1631676098
The Aaron
Forum Champion
API Scripter
The problem with a GM roll is that the player that initiates it still sees the result. To get a true blind roll, you need to use an API script.  Here's a simple one (I didn't write it, only modified it).  Call it like this: !broll 1d20+@{selected|perception_bonus} [Perception] Script: on("chat:message", function(msg_orig) { "use strict"; var msg = _.clone(msg_orig), who; if (msg.type !== "api") { return; } if(_.has(msg,'inlinerolls')){ msg.content = _.chain(msg.inlinerolls) .reduce(function(m,v,k){ m['$[['+k+']]']=v.results.total || 0; return m; },{}) .reduce(function(m,v,k){ return m.replace(k,v); },msg.content) .value(); } who=getObj('player',msg.playerid).get('_displayname').split(' ')[0]; var cmdName = "!broll "; var msgTxt = msg.content; var msgWho = msg.who; var msgFormula = msgTxt.slice(cmdName.length); if(msg.type == "api" && msgTxt.indexOf(cmdName) !== -1) { if(_.has(msg,'rolltemplate')) { sendChat(msgWho,'/w gm &{template:'+msg.rolltemplate+'}'+msg.content); sendChat(msgWho, "/w " + who + " secret rolltemplate sent to GM"); } else { sendChat(msgWho, "/gmroll " + msgFormula); sendChat(msgWho, "/w " + who + " secret roll sent to GM (" + msgFormula + ")"); } }; });
1631714935
For non-Pro users, there is a non-API way to do Blind Rolls using the Stylus extension , but it's not foolproof if your players are savvy and are going to inspect the HTML in their browser. Since you are a Pro user I would suggest using The Aaron's script instead!