openTest: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Needs clarification)
(Add reference to explodingSuccess)
 
(5 intermediate revisions by 4 users not shown)
Line 3: Line 3:
|name=openTest
|name=openTest
|description=
|description=
Generates random numbers to emulate dice rolls; returns a formatted string containing the result of each dice(using an [[explode]]d roll), and the highest.
Rolls a number of dice of requested side with exploding rolls and returns a formatted string containing the result of each roll and the highest value produced.


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
openTest(times, sides)
openTest(times, sides)
</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 14: Line 14:


|examples=
|examples=
{{Clarify|Obviously not the right function used.}}
Roll five ten-sided dice.
Roll five ten-sided dice.
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[t: roll(5, 10)]
[t: openTest(5, 10)]
</source>
</syntaxhighlight>
Returns a string that is similar to {{code|Dice: 5, 4, 19, 6, 3, Maximum: 19}}
Returns a string that is similar to {{code|Dice: 5, 4, 19, 6, 3, Maximum: 19}}


Roll five ten-sided dice, using variables.
Roll five ten-sided dice, using variables.
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h: DiceTimes = 5]
[h: DiceTimes = 5]
[h: DiceSides = 10]
[h: DiceSides = 10]
[t: roll(DiceTimes, DiceSides)]
[t: openTest(DiceTimes, DiceSides)]
</source>
</syntaxhighlight>
Returns a string that is similar to {{code|Dice: 5, 4, 19, 6, 3, Maximum: 19}}
Returns a string that is similar to {{code|Dice: 5, 4, 19, 6, 3, Maximum: 19}}


|also=
|also=
For another method of rolling dice, see [[Dice Expressions]].
For another method of rolling dice, see [[Dice Expressions]].<br>
 
For a similar function that returns the number of successes instead of the highest roll, see [[explodingSuccess]].
}}
}}
[[Category:Dice Function]]
[[Category:Dice Function]]

Latest revision as of 23:59, 1 August 2023

 This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.
 This article needs: Better explanation, perhaps examples on how to strip out the dice rolls from the string that is returned.

openTest() Function

Rolls a number of dice of requested side with exploding rolls and returns a formatted string containing the result of each roll and the highest value produced.

Usage

openTest(times, sides)

Parameters

  • times - The number of times to roll the dice.
  • sides - The number of sides the dice possess.

Examples

Roll five ten-sided dice.
[t: openTest(5, 10)]

Returns a string that is similar to Dice: 5, 4, 19, 6, 3, Maximum: 19

Roll five ten-sided dice, using variables.

[h: DiceTimes = 5]
[h: DiceSides = 10]
[t: openTest(DiceTimes, DiceSides)]
Returns a string that is similar to Dice: 5, 4, 19, 6, 3, Maximum: 19

See Also

For another method of rolling dice, see Dice Expressions.
For a similar function that returns the number of successes instead of the highest roll, see explodingSuccess.