Repository navigation
Reacting to the game
molly edited this page Nov 12, 2026
·
1 revision
on(event, function) runs your function when something happens in the game. This mod cheers every 100 combo and
writes the result of each song to the log:
local name
on("song", function(chart)
name = chart.name .. " " .. chart.difficulty -- "Glaciaxion IN"
end)
on("hit", function(hit)
if hit.combo > 0 and hit.combo % 100 == 0 then toast(hit.combo .. " combo!") end
end)
on("finish", function(result)
print(("%s: %d, %.2f%%"):format(name, result.score, result.accuracy))
end)The events you'll use most:
| Event | When | What your function gets |
|---|---|---|
scene |
the game changes screen | its name: "SongSelector", "Level"... |
song |
a song starts | the chart: id, name, difficulty, level, notes... |
hit |
a note is judged |
judgement ("perfect", "good", "bad", "miss"), offset in ms, combo
|
pause, resume
|
the player pauses or comes back | nothing |
finish |
the song ends | the final stats |
update |
every frame | nothing |
During a song, stats() gives the play so far (score, accuracy, combo, maxcombo, perfect, good, bad,
miss...), and playing() the chart being played. replaying() is true while a replay is shown, so a mod can stay
quiet then.
Mods watch the game, they never change how it plays: scores stay fair and replays stay true.
Everything else (the player's records, songs, touches, timers) is in Mod API.