rollWithUpper: Difference between revisions
Jump to navigation
Jump to search
m (Conversion script moved page rollWithUpper to RollWithUpper 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= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
rollWithUpper(times, sides, maximum) | rollWithUpper(times, sides, maximum) | ||
</ | </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 above 16 are treated as 16. | Roll five twenty-sided dice. Any rolls above 16 are treated as 16. | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[t: rollWithUpper(5, 20, 16)] | [t: rollWithUpper(5, 20, 16)] | ||
</ | </syntaxhighlight> | ||
Returns a number that is between 5 and 80 (and no longer up to 100 as with a regular {{code|5d20}} roll). | Returns a number that is between 5 and 80 (and no longer up to 100 as with a regular {{code|5d20}} roll). | ||
Latest revision as of 23:59, 14 March 2023
rollWithUpper() Function
Generates random numbers to emulate dice rolls. Returns the total of a dice roll where each die that rolled higher than the
maximum
parameter is counted as that value instead.Usage
rollWithUpper(times, sides, maximum)
Parameters
times
- The number of times to roll the dice.sides
- The number of sides the dice possess.maximum
- The maximum value that each individual die can contribute to the total.
Examples
Roll five twenty-sided dice. Any rolls above 16 are treated as 16.
Returns a number that is between 5 and 80 (and no longer up to 100 as with a regular
[t: rollWithUpper(5, 20, 16)]
5d20
roll).See Also
The corresponding dice roll expression is
XdYuZ
. For other methods of rolling dice, see Dice Expressions.