drop: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Conversion script moved page Drop to drop: Converting page titles to lowercase)
m (Text replacement - "<source" to "<syntaxhighlight")
Line 5: Line 5:


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
drop(times, sides, ignore)
drop(times, sides, ignore)
</source>
</source>
Line 15: Line 15:
|examples=
|examples=
Roll ten twenty-sided dice, ignoring the lowest five rolls.
Roll ten twenty-sided dice, ignoring the lowest five rolls.
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[t: drop(10, 20, 5)]
[t: drop(10, 20, 5)]
</source>
</source>
Line 21: Line 21:


Roll five ten-sided dice ignoring the lowest two rolls, using variables.
Roll five ten-sided dice ignoring the lowest two rolls, using variables.
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h: DiceTimes = 5]
[h: DiceTimes = 5]
[h: DiceSides = 10]
[h: DiceSides = 10]

Revision as of 17:18, 14 March 2023

drop() Function

Generates random numbers to emulate dice rolls; returns the total of a dice roll that ignores a certain number of the lowest dice rolled.

Usage

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

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

Examples

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

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

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

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

See Also

For another method of rolling dice, see Dice Expressions.