Skip to main content
A rule’s WHEN is usually an event. It can also be a balance reaching a number, a balance passing each multiple of one, or the clock.

A rule can follow a balance

WHEN can also be a balance reaching a number. The rule starts after another rule’s change in the same event takes that balance from below the number to the number or more, and its receipt is part of the same event’s receipt.
  • It reads the event that started the chain, so if and amounts from the event work as they do in any rule.
  • It fires once per crossing. A balance that is already past the number does not fire it again.
  • A chain stops after three steps, and a rule that could start itself, directly or through others, is refused when you save it. Taking from the unit a rule follows is fine: only adding can start another rule.
  • Changes made by hand (units.give), by giving a held change or by undoing a receipt do not start rules.
  • A rule that follows a balance has no event to replay, so rules.preview does not run a replay for it. It lists the other rules that change that unit (what starts this one) and how many people already hold that much.

A rule can repeat every so many

Instead of reaches, WHEN can be every: the rule starts each time a change takes the balance up across a multiple of the number. This is how “every 100 XP is a level up” is written.
  • A change that crosses several multiples starts the rule once for each, up to 10 at a time. 90 → 340 XP is three level-ups, and the receipt says “1 of 3”, “2 of 3”, “3 of 3”.
  • Each start counts on its own against the rule’s limit and budget.
  • Only going up counts. Spending XP and earning it back crosses the multiple again, as it does with reaches.
  • The same rules apply as for reaches: one chain of at most three steps, no loops. rules.preview lists what leads into it, and says no head count for every.

A rule can start on a schedule

WHEN can also be the clock, in the project’s time zone. The rule runs for each person in the project at that time, and if narrows it to the people who qualify. A rule that reads an audience in if looks only at that audience’s members, so a rule for a small audience stays cheap in a big project.
  • every is day, week (with on: mon to sun) or month (with on: a day from 1 to 28).
  • The receipts say they came from the schedule (via: "system") and have no event.
  • A scheduled rule has no event, so it cannot read an event’s properties or take an amount from one, and it cannot hold a change for a person. Saving one that does is refused and says which clause.
  • A moment that comes round while Lurk is not running for more than ten minutes is skipped, not made up later.
  • Each person gets it once for each moment. Pausing the rule stops it, and so does a limit or a budget.
  • A scheduled rule has no event to replay, so rules.preview shows the next five times it runs, in the project’s time zone, and how many people each run goes through.