Skip to content
Documentation

State and Time Events

Built-in authoring reference for Mercury 1.0.1. All events.

Alarm

Runs when the selected alarm reaches zero.

Reference key: alarm.

Editor category: State and Time > Timers.

Example: Use Alarm to delay a shot, spawn wave, or cooldown reset.

Object inputs: self.

Filter (Alarm): Select the numbered Alarm slot, 0–11. The slot must match the Set Alarm Action on this instance; named recurring timers use a separate Event.

Event context is a read-only snapshot for this invocation. It is available in the Event’s Action fields; store a required value in a declared Variable before using it in another Event.

This Event exposes no additional context fields. Configure its filter and Object inputs where offered; a missing field is not an implicit zero-valued output.

Clock Day Changed

Runs once when the world clock enters a different day. event.day is the new day and event.previousDay is the day it left.

Reference key: timeDayChanged.

Editor category: State and Time > World Time.

Example: On Clock Day Changed, grow watered crops and refresh the request board.

Object inputs: self.

Event context is a read-only snapshot for this invocation. It is available in the Event’s Action fields; store a required value in a declared Variable before using it in another Event.

Event context

Field Type Description
day number Current day counter of the game clock after the clock change. This is game time rather than a calendar date.
previousDay number Day counter before the clock change. A jump across several days produces one change Event with the two endpoints.

Clock Hour Changed

Runs once when the world clock enters a different hour. event.hour is the new hour and event.previousHour is the hour it left. A large Set or Advance jump produces one change event, not one event for every skipped hour.

Reference key: timeHourChanged.

Editor category: State and Time > World Time.

Example: On Clock Hour Changed, update shop and NPC schedules once instead of polling in Step.

Object inputs: self.

Event context is a read-only snapshot for this invocation. It is available in the Event’s Action fields; store a required value in a declared Variable before using it in another Event.

Event context

Field Type Description
hour number Current integer hour of the game clock, from 0 to 23, after the clock change.
previousHour number Integer hour before the clock change. A jump across several hours produces one change Event with the two endpoints.

Day Phase Changed

Runs once when the clock crosses a configured dawn, day, dusk, or night boundary. event.phase is the new phase and event.previousPhase is the old phase.

Reference key: timePhaseChanged.

Editor category: State and Time > World Time.

Example: On Day Phase Changed, branch on event.phase to swap ambience and lighting.

Object inputs: self.

Event context is a read-only snapshot for this invocation. It is available in the Event’s Action fields; store a required value in a declared Variable before using it in another Event.

Event context

Field Type Description
phase enum Game clock phase after the transition, determined by the configured dawn, day, dusk, and night boundaries. Choices: dawn, day, dusk, night.
previousPhase enum Game clock phase before the transition. Choices: dawn, day, dusk, night.

Game State Changed

Runs after the singular project Game State changes. event.previous and event.current identify the transition.

Reference key: gameStateChanged.

Editor category: State and Time > Game State.

Object inputs: self.

Event context is a read-only snapshot for this invocation. It is available in the Event’s Action fields; store a required value in a declared Variable before using it in another Event.

Event context

Field Type Description
previous enum Game State before the transition. Compare with Current Game State to detect a specific transition.
current enum Game State after the transition. Gameplay and input policies may change with this state.

Meter Threshold Lost

Runs once when Update Meter moves the named instance variable from at-or-above its threshold to below it. Leave the filter blank for any meter. event.meter, event.previousValue, event.value, and event.threshold describe the crossing.

Reference key: meterThresholdLost.

Editor category: State and Time > Value Ranges.

Example: On Meter Threshold Lost [crowd], return the audience to its calm behavior.

Object inputs: self.

Filter (Meter variable (blank = any)): Select the Meter name whose threshold transition should activate this Event.

Event context is a read-only snapshot for this invocation. It is available in the Event’s Action fields; store a required value in a declared Variable before using it in another Event.

Event context

Field Type Description
meter text Name of the changed bounded meter Variable. The name identifies the meter on the receiving instance.
previousValue number Meter value before the bounded update, in the meter definition’s units and within its configured limits.
value number Meter value after the bounded update, in the meter definition’s units and within its configured limits.
threshold number Threshold used for the meter edge test, clamped to the meter limits. It is not necessarily the maximum value.
direction number Sign of the bounded meter change: 1 for an increase, -1 for a decrease, and 0 when the value did not change.

Meter Threshold Reached

Runs once when Update Meter moves the named instance variable from below its threshold to at-or-above it. Leave the filter blank for any meter. event.meter, event.previousValue, event.value, and event.threshold describe the crossing.

Reference key: meterThresholdReached.

Editor category: State and Time > Value Ranges.

Example: On Meter Threshold Reached [suspicion], switch the guard from searching to alert.

Object inputs: self.

Filter (Meter variable (blank = any)): Select the Meter name whose threshold transition should activate this Event.

Event context is a read-only snapshot for this invocation. It is available in the Event’s Action fields; store a required value in a declared Variable before using it in another Event.

Event context

Field Type Description
meter text Name of the changed bounded meter Variable. The name identifies the meter on the receiving instance.
previousValue number Meter value before the bounded update, in the meter definition’s units and within its configured limits.
value number Meter value after the bounded update, in the meter definition’s units and within its configured limits.
threshold number Threshold used for the meter edge test, clamped to the meter limits. It is not necessarily the maximum value.
direction number Sign of the bounded meter change: 1 for an increase, -1 for a decrease, and 0 when the value did not change.

Recurring Timer

Runs each time the named recurring timer comes due. Leave the filter blank to hear every recurring timer on this instance. event.timer, event.interval, and event.count identify the firing timer.

Reference key: recurringTimer.

Editor category: State and Time > Timers.

Example: On Recurring Timer [rent], update shops and wages without rearming an Alarm by hand.

Object inputs: self.

Filter (Timer name (blank = any)): Select the exact named recurring timer started on this instance. Its Event context supplies the name, interval in seconds, and firing count.

Event context is a read-only snapshot for this invocation. It is available in the Event’s Action fields; store a required value in a declared Variable before using it in another Event.

Event context

Field Type Description
timer text Name of the recurring timer that fired. Matches the name passed to Start Recurring Timer and the Event filter.
interval number Configured recurring interval in seconds of instance time. This is the repeat period, not elapsed time since project launch.
count number Number of firings since this timer was started. The first firing is 1; restarting the timer resets the count.

Variable Changed

Runs once, at the end of a step, after the selected Global Variable changes value. Leave the filter blank to hear every Global Variable. Read the variable itself for its new value.

Reference key: variableChanged.

Editor category: State and Time > Variables.

Example: On Variable Changed [score] → If score ≥ nextShip, add a life.

Object inputs: self.

Filter (Global Variable (blank = any)): Select the declared Global whose value change should activate this Event. The Event supplies the previous and current values.

Event context is a read-only snapshot for this invocation. It is available in the Event’s Action fields; store a required value in a declared Variable before using it in another Event.

Event context

Field Type Description
meter text Name of the changed bounded meter Variable. The name identifies the meter on the receiving instance.
previousValue number Meter value before the bounded update, in the meter definition’s units and within its configured limits.
value number Meter value after the bounded update, in the meter definition’s units and within its configured limits.
threshold number Threshold used for the meter edge test, clamped to the meter limits. It is not necessarily the maximum value.
direction number Sign of the bounded meter change: 1 for an increase, -1 for a decrease, and 0 when the value did not change.

Myth Engine Documentation