dropHighest: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Conversion script moved page DropHighest to dropHighest: Converting page titles to lowercase)
m (Text replacement - "source>" to "syntaxhighlight>")
Line 8: Line 8:
<source lang="mtmacro" line>
<source lang="mtmacro" line>
dropHighest(times, sides, ignore)
dropHighest(times, sides, ignore)
</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 18: Line 18:
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[t: dropHighest(10, 20, 5)]
[t: dropHighest(10, 20, 5)]
</source>
</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.


Line 27: Line 27:
[h: DiceIgnore = 2]
[h: DiceIgnore = 2]
[t: dropHighest(DiceTimes, DiceSides, DiceIgnore)]
[t: dropHighest(DiceTimes, DiceSides, DiceIgnore)]
</source>
</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 17:08, 14 March 2023

dropHighest() Function

Introduced in version 1.5.2
Generates random numbers to emulate dice rolls; returns the total of a dice roll that ignores a certain number of the highest dice rolled.

Usage

<source lang="mtmacro" line> dropHighest(times, sides, ignore) </syntaxhighlight> Parameters

  • times - The number of times to roll the dice.
  • sides - The number of sides the dice possess.
  • ignore - The number of highest rolls that are ignored when totaling the roll.

Examples

Roll ten twenty-sided dice, ignoring the highest five rolls.

<source lang="mtmacro" line> [t: dropHighest(10, 20, 5)] </syntaxhighlight> Returns a number that is between 5 and 100, with a low average.

Roll five ten-sided dice ignoring the highest two rolls, using variables. <source lang="mtmacro" line> [h: DiceTimes = 5] [h: DiceSides = 10] [h: DiceIgnore = 2] [t: dropHighest(DiceTimes, DiceSides, DiceIgnore)] </syntaxhighlight>

Returns a number than is between 3 and 30, with a low average.

See Also

For another method of rolling dice, see Dice Expressions.

Version Changes

  • 1.5.2 - Introduced