Loading Leap…

Values and Expressions

Use fixed numbers, element values, formulas and random curves wherever Leap expects a value.

Values and Expressions

Wherever Leap expects a number — an effect's amount, the value a condition compares against, an outcome's weight — you can use more than a fixed number. This page covers the value field and the expression builder behind it, with live demos.

Demo mode: the fields below are fully interactive, but nothing you do here is saved. Each demo shows the value it currently holds underneath. Use Reset to restore the starting state.

The Value Field

A value field can hold one of four things:

  • A number — type it straight into the field.
  • An expression — click # ("Build an expression (elements, curves, arithmetic)") to open the builder. Once built, the field shows the expression as a chip; click the chip to edit it.
  • A random curve — a value drawn at random, shaped by a curve you draw.
  • A formula — click ƒ ("Use an existing formula") to pick a named formula. The ƒ button appears only where formulas can be used; see Formulas.

Building an Expression

The builder reads "Type the formula, or build it with the blocks below". Build an expression from blocks:

  • Under Add Value, add a Fixed number, an Element's current value, a ƒ Formula, or a Random Curve.
  • Join values with the operators +, −, × and ÷.

Click Done to use the expression, or Cancel to leave the value as it was. Clicking Done with no blocks turns the value back into a plain number.

The example below is gold × 2 + 10. Click its chip to open the builder:

Typing a Formula

You can also type an expression into the builder's Formula box, e.g. @gold * 2 + 10:

  • Type @ to reference an element by its slug, or press ⌘K (Ctrl+K on Windows and Linux) to pick one from a list.
  • If two kinds of element share a slug, name the kind: @resource/gold, @flag/tutorial_done, @achievement/first_victory or @formula/upgrade_cost.
  • The usual rules apply: × and ÷ before + and −, and parentheses to change the order.
  • Only +, −, × and ÷ are available — there are no functions such as min or max.

The blocks update as you type. While the text can't be read — for example Unknown element "gld" — the builder shows what's wrong and Done stays disabled.

Parentheses

Between two values, the () button puts them in parentheses: "Put these two values in parentheses — they are then worked out first". A bracketed pair has a button to remove its parentheses: "Remove the parentheses — these values then apply left to right with the rest".

Important: Adding or removing parentheses changes the result, not just how the expression looks. gold × (2 + 10) and gold × 2 + 10 are different values.

For long expressions, the bar under the builder gives an overview: drag a value's handle to move it, and click a bracket's handle to fold it away while you work on the rest.

Random Curves

A random curve turns a random draw between 0 and 1 into a value. Its input always runs from 0 to 1; you choose the output range, and the curve's shape decides how likely each result is. Start from a preset — Linear, Ease in, Ease out or S-curve — then drag the points, or add more with + Add point. Values between points are joined with straight lines.

The example below mostly draws low values, with a few reaching 100. Click the curve to reshape it:

Next Steps

Continue to Formulas to name an expression and reuse it.