rollWithLower: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Conversion script moved page RollWithLower to rollWithLower: Converting page titles to lowercase)
No edit summary
 
Line 5: Line 5:


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
rollWithLower(times, sides, minimum)
rollWithLower(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 twenty-sided dice. Any rolls below 7 are treated as 7.
Roll five twenty-sided dice. Any rolls below 7 are treated as 7.
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[t: rollWithLower(5, 20, 7)]
[t: rollWithLower(5, 20, 7)]
</source>
</syntaxhighlight>
Returns a number that is between 35 and 100 (and no longer down to 5 as with a regular {{code|5d20}} roll).
Returns a number that is between 35 and 100 (and no longer down to 5 as with a regular {{code|5d20}} roll).



Latest revision as of 22:02, 14 March 2023

rollWithLower() Function

Generates random numbers to emulate dice rolls. Returns the total of a dice roll where each die that rolled lower than the minimum parameter is counted as that value instead.

Usage

rollWithLower(times, sides, minimum)

Parameters

  • times - The number of times to roll the dice.
  • sides - The number of sides the dice possess.
  • minimum - The minimum value that each individual die will contribute to the total.

Examples

Roll five twenty-sided dice. Any rolls below 7 are treated as 7.
[t: rollWithLower(5, 20, 7)]
Returns a number that is between 35 and 100 (and no longer down to 5 as with a regular 5d20 roll).

See Also

The corresponding dice roll expression is XdYlZ. For other methods of rolling dice, see Dice Expressions.