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 a macro

1740528723
Nylo
Pro
Marketplace Creator
i want to have a query number of dice , query what dice type (eycd20) and then when it rolls it display the results seperatly like 2,3,4,5 and dont add them  together thanks
For this kind of query, you need an upper bound of how many dice can be rolled, as you can't iterate a roll n times. As I'm on phone right now, I'll limit my example to up to 3 rolls: ?{how many rolls|1,[[1d?{die size|6}]]|2,[[1d?{die size|6}]] [[1d?{die size|6}]]|3,[[1d?{die size|6}]] [[1d?{die size|6}]] [[1d?{die size|6}]]} Edit: forgot the html substitutions...
1740532494
Nylo
Pro
Marketplace Creator
little ashamed of asking but i could not figure out how to increase the number of dice to roll and i do need to hav at least six ,so when you have time i would appreciate it
1740533518
timmaugh
Forum Champion
API Scripter
Or, with scripts... The base roll is simple enough: [[ ?{Number of Dice|0}d?{Sides}]] Then, where you need to output the dice in your list, you could use: {&eval}getDiceByVal($[[0]] >0 all list){&/eval} ...where the roll index (i.e., $[[0]] ) matches the correct roll. The "list" argument takes an optional delimiter, so you could specify a plus sign, for instance, with: list|+ To see this in chat, you can enter something like: !The roll  [[ ?{Number of Dice|0}d?{Sides}]] has dice of {&eval}getDiceByVal($[[0]] >0 all list|+){&/eval} {&simple} I'm on my phone, but I'll double check my syntax when I'm back in front of my computer. REQUIRED SCRIPTS : MetascriptToolbox
1740540354

Edited 1740666182
timmaugh
Forum Champion
API Scripter
Yes, the above command works. However/Also, you can use double-hyphens to open up more options for the delimiter. For instance, to get a space, you would need to enclose it in some sort of single/double quotation marks or tick marks... but that only becomes possible with the double-hyphen syntax. Here is what that would look like, leaving a space between the individual die: !The roll [[ ?{Number of Dice|0}d?{Sides}]] has dice of {&eval}getDiceByVal(--$[[0]] -->0 --all --list|' '){&/eval} {&simple}
1740557015

Edited 1740633986
GiGs
Pro
Sheet Author
API Scripter
Roll20 macros aren't able to do iteration - Tuo's method is the way to go if you aren't using scripts, and it gets laborious. But this should be easy with a script. Tim's method is a great way, and more metascript toolbox examples are always great, but looks too complicated to me. You only need 2 pieces of information: the die size, and the number of dice. A simple script macro should be able to do the roll with just those 2 pieces of information.
C1 said: little ashamed of asking but i could not figure out how to increase the number of dice to roll and i do need to hav at least six ,so when you have time i would appreciate it As GiG's pointed out, a script will probably serve you better, but expanding the macro solution to 6 is just a matter of adding new options to the query, copying over the inline rolls within: ?{how many rolls|1,[[1d?{die size|6}]] |2,[[1d?{die size|6}]] [[1d?{die size|6}]] |3,[[1d?{die size|6}]] [[1d?{die size|6}]] [[1d?{die size|6}]] |4,[[1d?{die size|6}]] [[1d?{die size|6}]] [[1d?{die size|6}]] [[1d?{die size|6}]] |5,[[1d?{die size|6}]] [[1d?{die size|6}]] [[1d?{die size|6}]] [[1d?{die size|6}]] [[1d?{die size|6}]] |6,[[1d?{die size|6}]] [[1d?{die size|6}]] [[1d?{die size|6}]] [[1d?{die size|6}]] [[1d?{die size|6}]] [[1d?{die size|6}]]}
1740563380
Nylo
Pro
Marketplace Creator
I can use any script i am pro subscriper
1740565992

Edited 1740854590
GiGs
Pro
Sheet Author
API Scripter
I'm trying to remember the name of the common script with easy syntax that is often used for simple script solutions, but in the meantime, to explain TUOs method. First, set up a basic query skeleton like this: ?{how many rolls |1, |2, |3, |4, |5, |6, } The number at the start of each row is what you want to show to players in the query. It could just as easily be ?{how many rolls |6, |7, |8, |9, |10, } Then this is used for a single die roll. Copy it on the above rows as many times as the number. A single roll: [[1d?{die size|6}]] Remember, that is one die. You want to copy it as many times as there are dice rolls (this is why it gets laborious). For example, when players can choose 1 to 3 dice, you could have ?{how many rolls |1,[[1d?{die size|6}]] |2,[[1d?{die size|6}]] [[1d?{die size|6}]] |3,[[1d?{die size|6}]] [[1d?{die size|6}]] [[1d?{die size|6}]] } So expanding from 3 dice is simple (but irritating): just include that single die string multiple times.
1740571960
Nylo
Pro
Marketplace Creator
i really appreciate all  of this thanks
Haven't tested it but this might work &{template:default} {{name=Custom Dice Roller}} {{Rolls=[[ ?{Number of Rolls|1}d?{Dice to Roll|20} ]]}} {{Results=Rolls: $[[0]]}}
David Q. said: Haven't tested it but this might work &{template:default} {{name=Custom Dice Roller}} {{Rolls=[[ ?{Number of Rolls|1}d?{Dice to Roll|20} ]]}} {{Results=Rolls: $[[0]]}} That just gives you two reads of the same roll, you can't separate the rolls of XdY with the roll index, because that entire expression is a single entry in the roll index.