keepLowest: Difference between revisions
Jump to navigation
Jump to search
(Documenting macro function accompanying XdYklZ syntax, introduced in 1.5.2) |
m (Replaced source tages with syntaxhighlight) |
||
Line 6: | Line 6: | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
keepLowest(times, sides, keep) | keepLowest(times, sides, keep) | ||
</ | </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 ten twenty-sided dice, keeping the lowest five rolls. | Roll ten twenty-sided dice, keeping the lowest five rolls. | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[t: keepLowest(10, 20, 5)] | [t: keepLowest(10, 20, 5)] | ||
</ | </syntaxhighlight> | ||
Returns a number that is between {{code|5}} and {{code|100}}, with a low average. | Returns a number that is between {{code|5}} and {{code|100}}, with a low average. | ||
Roll five ten-sided dice keeping the lowest two rolls, using variables. | Roll five ten-sided dice keeping the lowest two rolls, using variables. | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h: DiceTimes = 5] | [h: DiceTimes = 5] | ||
[h: DiceSides = 10] | [h: DiceSides = 10] | ||
[h: DiceKeep = 2] | [h: DiceKeep = 2] | ||
[t: keepLowest(DiceTimes, DiceSides, DiceKeep)] | [t: keepLowest(DiceTimes, DiceSides, DiceKeep)] | ||
</ | </syntaxhighlight> | ||
Returns a number than is between {{code|3}} and {{code|30}}, with a low average. | Returns a number than is between {{code|3}} and {{code|30}}, with a low average. | ||
Revision as of 18:00, 14 July 2022
keepLowest() Function
• Introduced in version 1.5.2
Generates random numbers to emulate dice rolls; returns the total of a dice roll that includes only a certain number of the lowest dice rolled.
Usage
keepLowest(times, sides, keep)
Parameters
times
- The number of times to roll the dice.sides
- The number of sides the dice possess.keep
- The number of lowest rolls that are counted when totaling the roll.
Examples
Roll ten twenty-sided dice, keeping the lowest five rolls.
Returns a number than is between
[t: keepLowest(10, 20, 5)]
Returns a number that is between 5
and 100
, with a low average.
Roll five ten-sided dice keeping the lowest two rolls, using variables.
[h: DiceTimes = 5]
[h: DiceSides = 10]
[h: DiceKeep = 2]
[t: keepLowest(DiceTimes, DiceSides, DiceKeep)]
3
and 30
, with a low average.See Also
For another method of rolling dice, see Dice Expressions.
Version Changes
- 1.5.2 - Introduced