Reference · Rolls and exact odds
formulaTextfunction
A formula's roll with each kind of dice written as it fell: ([6 1]+3)*2-[3]. For a roll without a formula, the same as diceText.
Import it
import { formulaText } from "@johnmorrisdotca/korokoro";
Definition
function formulaText(roll: Roll): string
Parameters
| Name | Type | Description |
|---|---|---|
roll | Roll | The completed roll to read or record. |
Returns
string
A formula's roll with each kind of dice written as it fell: ([6 1]+3)*2-[3]. For a roll without a formula, the same as diceText.
Examples
import { formulaText } 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(formulaText(sample));2 5What it prints (run when this page was built)