States
An entity (or trait, or the story itself) can declare named states with
a states: line. The owner starts in the first state listed. States are
the language's replacement for flags and ad-hoc booleans: they are
declared, ordered, and visible to conditions (when the fountain is still),
select on dispatch, and change.
create the fountain
a thing, scenery
in the Orangery
states, reversible: flowing, still
A marble fountain in the middle of the floor.
on the player touching
change the fountain to still when the fountain is flowing
phrase fountain-stopped when the fountain is still
end on
State order is a promise. Without , reversible, a change back to an
earlier state is a load error (analysis.irreversible-state): a marrow
declared states: entire, sliced can never be un-sliced, and the
compiler holds you to it. Add , reversible only when the story really
does move both ways, as the fountain does.
One name is reserved. dark is the platform's word for a room without
light, so a states: line on anything but a room may not declare a state
called dark (analysis.dark-state-reserved): the lantern is dark
would read the room's light, never the lantern's state. A thing that
gives light composes light-source (with switchable to turn it on and
off) instead of declaring a dark state.