User guide All lessons Cookbook Function reference Open playground

Ordered outcome labels

At the table

Some games speak in named bands (failure, success, critical) instead of a raw total. You still want exact probabilities—and sometimes “success or better” on that ladder.

Try it

In the playground, open this lesson in the playground and click Run (or press Shift+Enter).

The script

Scale = (
    scale()
    .step("CRITICAL_FAIL", ..5)
    .step("FAIL", 6..10)
    .step("SUCCESS", 11..15)
    .step("CRITICAL_SUCCESS", 16..)
)
roll = 1d20
out = roll.bucket(Scale)
output("check", out)
output("p_success_plus", out.p_at_least("SUCCESS"))

Reading the result

The text tab lists each label and its probability. The json tab uses "kind": "ordinal" with scale and entries.

Try this

Builtin details: standard library reference (scale, Scale.step, bucket).

What’s next

D&D 5e d20 checks—nat 1, nat 20, advantage, and modifiers with scale().step(...) on the natural die (not fixed bands on 1d20 alone, and not 1d20 + MOD for true 5e crits).

For two dice with custom rules (e.g. white/black PbtA-style), see games-systems/white-and-black-story.dice and joint_classify in the reference.

check · Outcomes

outcome%fracX/36
CRITICAL_FAIL25.01/49
FAIL25.01/49
SUCCESS25.01/49
CRITICAL_SUCCESS25.01/49

p_success_plus · Prob

outcome%fracX/36
p_success_plus50.01/218