Events are time-stamped triggers embedded in chart files that fire during gameplay. The engine fires built-in events automatically, and your Lua scripts can handle any event — including events you define yourself — through theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Quiet-Wolfe/Rustic-Engine/llms.txt
Use this file to discover all available pages before exploring further.
onEvent callback.
How events work in a chart
Events are stored in the top-levelevents array of a chart JSON file. Each entry is a two-element array: a strum time (milliseconds) and a list of event tuples.
[name, value1, value2]. All three values are strings. When the song position reaches a strum time, all events at that time fire together.
Events can also appear inside the sectionNotes array of a section. A note with a negative direction value (or a string direction) is parsed as a legacy inline event:
The EventNote data structure
Internally, each parsed event is represented as:| Field | Type | Description |
|---|---|---|
strum_time | f64 | Time in milliseconds when the event fires |
name | String | Event name (e.g. "Hey!", "Add Camera Zoom") |
value1 | String | First parameter string |
value2 | String | Second parameter string |
Built-in events
These events are handled directly by the engine before Lua scripts receive them:| Event name | value1 | value2 | Effect |
|---|---|---|---|
Hey! | Target: "BF", "DAD", or "GF" | Duration (seconds) | Forces the target character to play their hey animation |
Add Camera Zoom | Game camera zoom delta | HUD camera zoom delta | Adds a zoom bump (e.g. "0.04" and "0.03") |
Play Animation | Animation name | Character: "BF", "DAD", or "GF" | Plays a named animation on the target character |
Your
onEvent Lua callback is called for every event, including built-in ones. You can extend built-in behavior or inspect event values from Lua without needing to replace the engine handling.Handling events in Lua
onEvent
The primary callback for custom events. The engine calls this on every loaded script whenever an event fires.onEvent receives three string arguments:
| Parameter | Type | Description |
|---|---|---|
name | string | The event name from the chart |
value1 | string | First value field from the chart |
value2 | string | Second value field from the chart |
eventEarlyTrigger
Return a number of milliseconds fromeventEarlyTrigger to pre-fire a named event before its chart time. This is useful for events that need to trigger visual changes slightly ahead of the beat.
eventEarlyTrigger for each pending event and subtracts the returned offset from the event’s strum time.
Custom events
To add your own event, place it in your chart’sevents array with any name and string values that make sense for your mod. There is no registration step — just use the name in the chart and check for it in onEvent.
custom_events/ directory of your mod. The engine scans all search roots for custom_events/*.lua and loads them. Each file can define its own onEvent handler.
The Wildcard event type (VS Retrospecter)
The VS Retrospecter Part 2 mod uses a Wildcard event pattern: the eventname is the name of a Lua function to call, and value1 is the argument to pass. The engine implements this through ScriptManager::call_lua_function, which calls a named function on all loaded scripts with a single string argument.
onEvent handler for Wildcard events — the function is called directly.