reroll: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Conversion script moved page reroll to Reroll without leaving a redirect: Converting page title to first-letter uppercase)
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 5: Line 5:


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
reroll(times, sides, minimum)
reroll(times, sides, minimum)
</source>
</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.
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[t: reroll(5, 10, 5)]
[t: reroll(5, 10, 5)]
</source>
</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.
<source lang="mtmacro" line>
<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)]
</source>
</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.
[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)]
Returns a number than is between 25 and 50.

See Also

For another method of rolling dice, see Dice Expressions.