rollSubWithLower: Difference between revisions
Jump to navigation
Jump to search
m (Conversion script moved page rollSubWithLower to RollSubWithLower 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> | ||
rollSubWithLower(times, sides, sub, minimum) | rollSubWithLower(times, sides, sub, 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 16: | Line 16: | ||
|examples= | |examples= | ||
Roll five twenty-sided dice. Subtract 2 from each. Any value now lower than 3 is treated as 3. | Roll five twenty-sided dice. Subtract 2 from each. Any value now lower than 3 is treated as 3. | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[t: rollSubWithLower(5, 20, 2, 3)] | [t: rollSubWithLower(5, 20, 2, 3)] | ||
</ | </syntaxhighlight> | ||
Returns a number that is between 15 and 90 (and no longer 5 to 100 as with a regular {{code|5d20}} roll). | Returns a number that is between 15 and 90 (and no longer 5 to 100 as with a regular {{code|5d20}} roll). | ||
Latest revision as of 23:59, 14 March 2023
rollSubWithLower() Function
Generates random numbers to emulate dice rolls. The
sub
parameter is subtracted from each die and all intermediate results that are then lower than the minimum
parameter are replaced with that value instead. The total is returned.Usage
rollSubWithLower(times, sides, sub, minimum)
Parameters
times
- The number of times to roll the dice.sides
- The number of sides the dice possess.sub
- The number to subtract from each die roll.minimum
- The minimum value (after the subtraction) that each individual die will contribute to the total.
Examples
Roll five twenty-sided dice. Subtract 2 from each. Any value now lower than 3 is treated as 3.
Returns a number that is between 15 and 90 (and no longer 5 to 100 as with a regular
[t: rollSubWithLower(5, 20, 2, 3)]
5d20
roll).See Also
The corresponding dice roll expression is
XdYsZlW
. For other methods of rolling dice, see Dice Expressions.