IScriptedClass interfaces define callback methods that scripted classes can implement to respond to game events. These interfaces enable mods to hook into the game’s lifecycle and react to player actions.
Core Interface
IScriptedClass
The base interface that all scripted classes implement:Lifecycle Methods
onCreate(event)Called when the object is first created and added to the game. onDestroy(event)
Called when the object is about to be destroyed or removed. onUpdate(event)
Called every frame. The
UpdateScriptEvent contains elapsed (delta time in seconds).
onScriptEvent(event)Called for any script event dispatched to this object. Use this to handle custom events or as a catch-all.
State Management
IStateChangingScriptedClass
For scripts that need to persist across state changes:Example: State Transition Handler
IStateStageProp
For scripted objects that are added to the game state:Called when the element is added to the current state. Generally requires the class to be an instance of
FlxBasic.
Gameplay Events
INoteScriptedClass
For scripts that respond to note events:Event Details
onNoteIncoming(event)Called when a note enters the field of view and approaches the strumline.
- Access the note:
event.note - Check direction:
event.note.direction
Called when either player hits a note.
- Access the note:
event.note - Check if player or CPU:
event.note.mustPress - Get accuracy:
event.accuracy - Get judgement:
event.judgement
Called when a note is missed (usually by the player). onNoteHoldDrop(event)
Called when a hold note is dropped early.
Example: Note Event Handler
IBPMSyncedScriptedClass
For scripts that sync with the music tempo:Called once every step (16th note) of the song.
- Get current step:
event.step
Called once every beat (quarter note) of the song.
- Get current beat:
event.beat
Example: Beat-Synced Animation
IPlayStateScriptedClass
Comprehensive interface for gameplay mods:Song Manipulation
Countdown Control
UI State Events
IFreeplayScriptedClass
For Freeplay menu interactions:Example: Freeplay Menu Mod
ICharacterSelectScriptedClass
For Character Select interactions:IDialogueScriptedClass
For dialogue system interactions:Event Handler Interface
IEventHandler
For objects that can dispatch events to children:Event Cancellation
Many events are cancellable, allowing mods to prevent default behavior:Event Propagation
Control whether events continue to other scripts:Related
- Module System - Create persistent mods using these interfaces
- PolymodHandler - Mod loading and management
- Song Events - Song event reference
