keep: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Initial write-up.)
 
mNo edit summary
Line 18: Line 18:
[t: keep(5, 10, 2)]
[t: keep(5, 10, 2)]
</source>
</source>
Returns a number than is between {{code|2}} and {{code|10}}, with a high average.
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.
Line 27: Line 27:
[t: keep(DiceTimes, DiceSides, DiceKeep)]
[t: keep(DiceTimes, DiceSides, DiceKeep)]
</source>
</source>
Returns a number than is between {{code|2}} and {{code|10}}, with a high average.
Returns a number than is between {{code|2}} and {{code|20}}, with a high average.


|also=
|also=

Revision as of 23:41, 5 February 2010

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.
[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)]
Returns a number than is between 2 and 20, with a high average.

See Also

For another method of rolling dice, see Dice Expressions.