resets, supply, expires_after_days and expires_at.
Resets
A unit withresets on can be set back to 0 by a rule, whichever way the unit goes: a season’s XP, a month’s visit count. Pair it with a schedule.
reset is on Rules.
A limited supply
switches.supply is the most that can ever be given in all, across everyone: “40 in all”.
- It counts what is given from when the supply is set.
stats.issuedsays how much. - When it has run out, a rule that would give it is skipped with the reason
supply_gone, and a give by hand that is more than is left is refused whole. - Taking it back (an undo) does not give the supply back: it was given.
- A supply cannot be set below what has already been given.
Expiry
switches.expires_after_days takes back what was given after that many days.
- It applies to what is given from now on. What was there before keeps its place and never expires.
- Spending uses what expires first, so what is spent does not expire.
- Each hour the worker takes back what has expired, one receipt per person (
via: "system", bysystem:expiry), so balances and receipts always agree. - An undo of a take gives the balance back without an expiry.
- Turning it off forgets the clock: what is already given stays.
An end date
switches.expires_at ends the whole unit at a moment: a ticket for an event on a date. Nothing is given after it, and what is held then expires and is taken back, whatever expires_after_days says. It must be in the future when you set it; null removes it.