keep: Difference between revisions
Jump to navigation
Jump to search
Verisimilar (talk | contribs) (Initial write-up.) |
No edit summary |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 5: | Line 5: | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
keep(times, sides, highDice) | keep(times, sides, highDice) | ||
</ | </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, keeping the two highest rolls. | Roll five ten-sided dice, keeping the two highest rolls. | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[t: keep(5, 10, 2)] | [t: keep(5, 10, 2)] | ||
</ | </syntaxhighlight> | ||
Returns a number than is between {{code|2}} and {{code| | Returns a number than is between {{code|2}} and {{code|20}}, with a high average. | ||
Roll five ten-sided dice, keeping the two highest rolls, using variables. | Roll five ten-sided dice, keeping the two highest 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: keep(DiceTimes, DiceSides, DiceKeep)] | [t: keep(DiceTimes, DiceSides, DiceKeep)] | ||
</ | </syntaxhighlight> | ||
Returns a number than is between {{code|2}} and {{code| | Returns a number than is between {{code|2}} and {{code|20}}, with a high average. | ||
|also= | |also= |
Latest revision as of 18:36, 14 March 2023
keep() Function
Generates random numbers to emulate dice rolls; returns the total of a dice roll only counting a specified number of the highest rolls.
Usage
keep(times, sides, highDice)
Parameters
times
- The number of times to roll the dice.sides
- The number of sides the dice possess.highDice
- The number of highest dice that should be kept, the rest are discarded.
Examples
Roll five ten-sided dice, keeping the two highest rolls.
Returns a number than is between
[t: keep(5, 10, 2)]
Returns a number than is between 2
and 20
, with a high average.
Roll five ten-sided dice, keeping the two highest rolls, using variables.
[h: DiceTimes = 5]
[h: DiceSides = 10]
[h: DiceKeep = 2]
[t: keep(DiceTimes, DiceSides, DiceKeep)]
2
and 20
, with a high average.See Also
For another method of rolling dice, see Dice Expressions.