clearRolls

From RPTools Wiki
Revision as of 16:59, 14 March 2023 by Taustin (talk | contribs) (Text replacement - "source>" to "syntaxhighlight>")
Jump to navigation Jump to search

clearRolls() Function

Introduced in version 1.5.2
Clears the internal array that keeps track of the individual dice rolls for the current macro.

Usage

<source lang="mtmacro" line> clearRolls() </syntaxhighlight> Parameters

  • none - Takes no parameters.

Example

Clear the saved rolls after second time.

<source lang="mtmacro" line> Roll 3d6: [e: 3D6]
Get New Rolls: [r: getNewRolls()]
Get Rolled: [r: getRolled()]
Roll 3d6 minimum 2: [e: 3D6L2]
Get New Rolls: [r: getNewRolls()]
Get Rolled: [r: getRolled()]
-- Clear Rolls --[h: clearRolls()]
Roll 3d6: [e: 3D6]
Get New Rolls: [r: getNewRolls()]
Get Rolled: [r: getRolled()]
</syntaxhighlight>

Output: <source lang="mtmacro" line>

Roll 3d6: « 3D6 = 12 » Get New Rolls: [5,5,2] Get Rolled: [5,5,2] Roll 3d6 minimum 2: « 3D6L2 = 17 » Get New Rolls: [5,6,6] Get Rolled: [5,5,2,5,6,6] -- Clear Rolls -- Roll 3d6: « 3D6 = 8 » Get New Rolls: [2,2,4] Get Rolled: [2,2,4]

</syntaxhighlight>

See Also