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

Use one roll result in two whispers

Did not really find answer to this  - is it possible to do player api macro - which will do roll for something and send different messages to player/gm with result?  eg - roll for attack hit - player will get " you tried to hit XXXX and rolled 17" GM will get "PLAYERNAME rolled 17 which is 12 roll since he is cursed and misses YYY who have AC of 13" 
1606842134
The Aaron
Roll20 Production Team
API Scripter
With the API, that sort of automation would be possible to create.  The way you would want to organize that data, and the interactions you'd need to deal with might become quite complicated, but it would be possible.
1606843908
timmaugh
Forum Champion
API Scripter
The DiscreteWhisper script can send customized whispers to multiple people at the same time, but that wouldn't quite get you there. You'd need some flexibility in the message (for instance, whether the character is actually cursed, and whether she actually hit or not). I agree with Aaron that that level of option handling would require API processing. You can change the text to make it somewhat helpful, maybe: !w --gm|Character1 --{{aside|Character1}}You tried to hit XXXX and rolled [[$1]] {{aside|gm}}Character1 rolled [[$1]], modified to a [[[[$1]]-@{Character1|CursedModAttr}}]], hitting XXXX (AC @{{XXXX|ArmorClassAttr}}) on a [[ ...math for a hit... ]] I probably mangled the inline roll accessing (I'm better with the back-end stuff than the chat/macro access), but hopefully that will get you close.
So how it would be done within api ? (I do have API access) 
1607011032
The Aaron
Roll20 Production Team
API Scripter
Here's a very simple script that demonstrates the mechanics: !sendroll [[3d6]] Code: on('ready',()=>{ const processInlinerolls = (msg) => { if(_.has(msg,'inlinerolls')){ return _.chain(msg.inlinerolls) .reduce(function(m,v,k){ let ti=_.reduce(v.results.rolls,function(m2,v2){ if(_.has(v2,'table')){ m2.push(_.reduce(v2.results,function(m3,v3){ m3.push(v3.tableItem.name); return m3; },[]).join(', ')); } return m2; },[]).join(', '); m['$[['+k+']]']= (ti.length && ti) || v.results.total || 0; return m; },{}) .reduce(function(m,v,k){ return m.replace(k,v); },msg.content) .value(); } else { return msg.content; } }; on('chat:message',msg=>{ if('api'===msg.type && /^!sendroll(\b\s|$)/i.test(msg.content) ){ let content = processInlinerolls(msg); let who = (getObj('player',msg.playerid)||{get:()=>'API'}).get('_displayname'); let args = content.split(/\s+/); sendChat('',`/w "${who}" You rolled ${args[1]}`); sendChat('',`/w gm <code>${who}</code> rolled ${args[1]} which is ${parseInt(args[1])-5} when you subtract 5.`); } }); }); The complexity is not in how you send the data, but in how you manage what you want to send (who is cursed, which roll was affected, etc).  I'm not aware of scripts that would let you do this, you'd need to come up with a plan an write one.
Thanks AllmightyScriptomancer! Ill try that - Now it seems that DiscreteWhisper might be solution too :)