Reference · Rolls and exact odds
rollTextfunction
One roll on one line: 2d20kh1+5: 22 [17 (4)], or for a formula (2d6+3)*2: 20 ([6 1]+3)*2.
Import it
import { rollText } from "@johnmorrisdotca/korokoro";
Definition
function rollText(roll: Roll): string
Parameters
| Name | Type | Description |
|---|---|---|
roll | Roll | The completed roll to read or record. |
Returns
string
One roll on one line: 2d20kh1+5: 22 [17 (4)], or for a formula (2d6+3)*2: 20 ([6 1]+3)*2.
Examples
import { rollText } from "@johnmorrisdotca/korokoro";
import { normalizeSpec, rollFrom } from "@johnmorrisdotca/korokoro";
const spec = normalizeSpec({ count: 2, sides: 6 });
const sample = rollFrom(spec, [2, 5], "saved", 0, null)!;
console.log(rollText(sample));2d6: 7 [2 5]What it prints (run when this page was built)