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

d6 macro & condition

Hello, In my game, I use a d6 system where you count a score wich depend of the dices: 1 = -1 2, 3 = 0 4, 5 = 1 6 = 2 I want to create a Macro wich will roll Xd6, show the result of each dice (like a normal /r Xd6) but in the place of the dice sum, place the "Score" I try to look the macros, but it's not easy at all. How can I get an array of the rolled dice, and how can I create an "if/else if/else" situation, and how can I create a show a variable ? Thank you !!
1494269602
The Aaron
Pro
API Scripter
There is no support for an if/else construct in macros. &nbsp;The best you can do is workout a formula that will result in the value you're interested in, often a summation of terms. Toward your dice though, making a Rollable Table should give you precisely what you need. You'll have 4 rows: Row named "-1" with a weight of 1 Row named "0" with a weight of 2 Row named "1" with a weight of 2 Row named "2" with a weight of 1 You'll then be able to roll it like a normal die. &nbsp;Assuming it's named "my6" it would look like these: /roll 1t[my6] /roll 5t[my6] Rolling [[ 1t[my6] ]] Rolling [[ 5t[my6] ]] See:&nbsp; <a href="https://wiki.roll20.net/Collections#Rollable_Table" rel="nofollow">https://wiki.roll20.net/Collections#Rollable_Table</a>...
I will check that, thank you !
That's great and that's the idea, for me, that's a usefull tool, but for my player, I want to show them dices. I show some math formula, that look hard, but I'll try ! Thank you !!
1494276061
Lithl
Pro
Sheet Author
API Scripter
Aurélien P. said: I show some math formula, that look hard, but I'll try ! For each die, the formula would be floor(d6 / 2 - 1) . If you're rolling multiple dice, you'd have to list them separately (eg, floor(d6 / 2 - 1) + floor(d6 / 2 - 1) instead of 2d6).
I don't know that we can do floor function ^^ nice But I have some difficulties to find information about macros, I want to do this : { int result = 0; int diceA; int diceB; int diceC; //I prefer use array and for, but I don't know if macro can do this diceA = d6; diceB = d6; diceC = d6; result = floor(diceA / 2 - 1) +&nbsp;floor(diceB / 2 - 1) +&nbsp;floor(diceC / 2 - 1); ShowInChat("Dices: " + diceA + " + " + diceB + " + " + diceC); // If possible with dice structure, 1 in red, 6 in green, and the dice shape behind ShowInChat("Score: " result); } Is it to complexe for macro system ? Can you explain how can I do this ? Thanks for your help :)
How about this? /r floor([[d6]]/2-1) + floor([[d6]]/2-1) + floor([[d6]]/2-1)
the result is good, but that show all the formula to the other player, not really clear, but that's the idea ^^
1494421957

Edited 1494422079
You could hide the formula using one of these macros: /r [[floor(d6/2-1)]] + [[floor(d6/2-1)]] + [[floor(d6/2-1)]] [[ [[floor(d6/2-1)]] + [[floor(d6/2-1)]] + [[floor(d6/2-1)]] ]] Neither displays the individual dice rolled immediately, however.
Nice, last thing, display the dices ^^
3 questions: -Is there a way to roll X dices and after get &nbsp;an array of the X dicess rolled ? -Is there a way to display a number with dice display (1 in red, 6 in green, and a d6 shape behind) ? -Is there a way to create var to save the result of a dice ?
1494435900
Lithl
Pro
Sheet Author
API Scripter
Aurélien P. said: 3 questions: -Is there a way to roll X dices and after get &nbsp;an array of the X dicess rolled ? -Is there a way to display a number with dice display (1 in red, 6 in green, and a d6 shape behind) ? -Is there a way to create var to save the result of a dice ? Not sure what you mean /roll does exactly that, so long as the dice themselves are not wrapped in inline rolls (as Silvyre showed when you said you didn't want to show the formula) No
This is what I have with a normal dice: But I don't want the "11" I want in this place the result of my formula, but always have the result of my dice "( 3 + 2 + 6 )", soit I need a "2", cause 3 & 2 = 0 et 6 = 2 like this (photoshoped): Actualy my macro just display the number or display this: Where 0 + 0 + 2 aren't my dices, but the calculated result of "3 + 2 + 6" Any idea ? ^^
You can get close. Create a rollable table with the following entries, each with a weight of 1: -1 [1] 0 [2] 0 [3] 1 [4] 1 [5] 2 [6] Suppose we call this table "my6." You get the following for the commands "/roll 1t[my6]" and "/roll 3t[my6]": You see the actual die rolled, but you also see the number that's actually being used to calculate the total. The die-roller ignores anything between single square brackets. It's not quite as pretty as your mock-up, but it has all the information you want.
Yep, I see this solution, but I think my player gonna be loose with this display ! :/ but thank for your help ;)
1494617769

Edited 1494617916
The API Script called PowerCards could be used to achieve a cleaner output. API access requires a Game's Creator to have an active Pro subscription . After PowerCards is installed, you could use this macro: !power {{ --Rolled|[^A.base] + [^B.base] + [^C.base] = [[ [NH] floor([$A]{d6}/2-1) + floor([$B]{d6}/2-1) + floor([$C]{d6}/2-1) ]] }}
Nice ! that's it !! Thanks ! I will check this when I will have an active pro subscription&nbsp;