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

Variable number of roll ouputs?

I saw in an old suggestion comment that someone wanted to add a feature like "/roll3 [[2d6]]" that would have an output of "4 5 6" is there a way to do this in the current system?
1488476215
The Aaron
Pro
API Scripter
The way you'd do that in the current system is just by repeating the roll multiple times: [[2d6]] [[2d6]] [[2d6]] An API script could be used make duplicates, of course, but that requires a Pro Subscription.
I was curious because I'm looking to do something like this in a macro /w "gm" ?{Number of monsters} @{selected|character_name} attacking @{target|character_name} with ?{Attack type|Sword|Bow}. /roll?{Number of monsters} %{selected|?{Attack type}}
1488481402
The Aaron
Pro
API Scripter
Probably the best way to handle it is to create several macros, one for each number of monsters you're likely to encounter, then call it with something like: ?{Number of Monsters|1,#attack1|2,#attack2|3,#atack3} Never tried it before, but that should work out...
1488481539

Edited 1488481595
Not possible to do multiple rolls easily without an api script. Aarons solution above is the "easiest" workaround.
1488485225
The Aaron
Pro
API Scripter
If you did want to do this with a script, here's one that does it... on('ready',function(){     "use strict";     let esRE = function (s) {           var escapeForRegexp = /(\\|\/|\[|\]|\(|\)|\{|\}|\?|\+|\*|\||\.|\^|\$)/g;           return s.replace(escapeForRegexp,"\\$1");         },         HE = (function(){           var entities={                   //' ' : '&'+'nbsp'+';',                   '<' : '&'+'lt'+';',                   '>' : '&'+'gt'+';',                   "'" : '&'+'#39'+';',                   '@' : '&'+'#64'+';',                   '{' : '&'+'#123'+';',                   '|' : '&'+'#124'+';',                   '}' : '&'+'#125'+';',                   '[' : '&'+'#91'+';',                   ']' : '&'+'#93'+';',                   '"' : '&'+'quot'+';'               },               re=new RegExp('('+_.map(_.keys(entities),esRE).join('|')+')','g');           return function(s){             return s.replace(re, function(c){ return entities[c] || c; });           };         }());     on('chat:message',function(msg){         var cmd,who;         if('api' !== msg.type || !playerIsGM(msg.playerid) ){             return;         }         cmd=msg.content.match(/^!roll(\d+)\s+(.*)$/);         who=(getObj('player',msg.playerid)||{get:_.noop}).get('displayname');         if(cmd){             let times=parseInt(cmd[1],10);             sendChat('',`/w "${who}" [${times} x ${HE(cmd[2])}](!${_.times(times,()=>`&${'#13;'}${cmd[2]}`).join('')})`);         }     }); }); Standard escaping rules apply: