reroll: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(One intermediate revision by the same user not shown) | |||
Line 5: | Line 5: | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
reroll(times, sides, minimum) | reroll(times, sides, minimum) | ||
</ | </syntaxhighlight> | ||
'''Parameters''' | '''Parameters''' | ||
{{param|times|The number of times to roll the dice.}} | {{param|times|The number of times to roll the dice.}} | ||
Line 15: | Line 15: | ||
|examples= | |examples= | ||
Roll five ten-sided dice, rerolling any dice rolled lower than five. | Roll five ten-sided dice, rerolling any dice rolled lower than five. | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[t: reroll(5, 10, 5)] | [t: reroll(5, 10, 5)] | ||
</ | </syntaxhighlight> | ||
Returns a number that is between {{code|25}} and {{code|50}}. | Returns a number that is between {{code|25}} and {{code|50}}. | ||
Roll five ten-sided dice, rerolling any dice rolled lower than five, using variables. | Roll five ten-sided dice, rerolling any dice rolled lower than five, using variables. | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h: DiceTimes = 5] | [h: DiceTimes = 5] | ||
[h: DiceSides = 10] | [h: DiceSides = 10] | ||
[h: DiceMinimum = 5] | [h: DiceMinimum = 5] | ||
[t: reroll(DiceTimes, DiceSides, DiceMinimum)] | [t: reroll(DiceTimes, DiceSides, DiceMinimum)] | ||
</ | </syntaxhighlight> | ||
Returns a number than is between {{code|25}} and {{code|50}}. | Returns a number than is between {{code|25}} and {{code|50}}. | ||
Latest revision as of 23:59, 14 March 2023
reroll() Function
Generates random numbers to emulate dice rolls; returns a dice roll similar to roll() with the difference being that each dice rolled that is lower than the
minimum
parameter is rerolled until it is at least the minimum
.Usage
reroll(times, sides, minimum)
Parameters
times
- The number of times to roll the dice.sides
- The number of sides the dice possess.minimum
- The lowest number a dice rolled can return without being rerolled.
Examples
Roll five ten-sided dice, rerolling any dice rolled lower than five.
Returns a number than is between
[t: reroll(5, 10, 5)]
Returns a number that is between 25
and 50
.
Roll five ten-sided dice, rerolling any dice rolled lower than five, using variables.
[h: DiceTimes = 5]
[h: DiceSides = 10]
[h: DiceMinimum = 5]
[t: reroll(DiceTimes, DiceSides, DiceMinimum)]
25
and 50
.See Also
For another method of rolling dice, see Dice Expressions.