You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: assets/content/cookbook/Advanced/06.ScriptEventCallbacks.md
+57-14Lines changed: 57 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,40 +90,43 @@ public override function onNoteMiss(event:NoteScriptEvent):Void
90
90
There is a predefined list of every script event callback the game has set up to be overridable, with their respective event type whose fields you can read from or write to. More of these will be added to the future.
91
91
92
92
-`onScriptEvent(event:ScriptEvent)` - Called when any sort of script event would get dispatched. This is called before the event's respective callback.
93
-
- Available to Songs, Stage Props, Boppers, Characters, Stages, Backing Cards, Note Kinds, Dialogue Boxes, Speakers, Conversations and Modules.
93
+
- Available to Songs, Stage Props, Boppers, Characters, Stages, Backing Cards, Freeplay DJs, Note Kinds, Dialogue Boxes, Speakers, Conversations and Modules.
94
94
95
95
-`onCreate(event:ScriptEvent)` - Called when the base class gets created in the game.
96
-
- Available to Songs, Stage Props, Boppers, Characters, Stages, Backing Cards, Note Kinds, Dialogue Boxes, Speakers, Conversations and Modules.
96
+
- Available to Songs, Stage Props, Boppers, Characters, Stages, Backing Cards, Freeplay DJs, Note Kinds, Dialogue Boxes, Speakers, Conversations and Modules.
97
97
98
98
-`onDestroy(event:ScriptEvent)` - Called when the base class gets destroyed in the game.
99
-
- Available to Songs, Stage Props, Boppers, Characters, Stages, Backing Cards, Note Kinds, Dialogue Boxes, Speakers, Conversations and Modules.
99
+
- Available to Songs, Stage Props, Boppers, Characters, Stages, Backing Cards, Freeplay DJs, Note Kinds, Dialogue Boxes, Speakers, Conversations and Modules.
100
100
101
101
-`onUpdate(event:UpdateScriptEvent)` - Called when the base class gets updated in the game.
102
-
- Available to Songs, Stage Props, Boppers, Characters, Stages, Backing Cards, Note Kinds, Dialogue Boxes, Speakers, Conversations and Modules.
102
+
- Available to Songs, Stage Props, Boppers, Characters, Stages, Backing Cards, Freeplay DJs, Note Kinds, Dialogue Boxes, Speakers, Conversations and Modules.
103
103
104
104
-`onStateChangeBegin(event:StateChangeScriptEvent)` - Called when the State changing process begins.
105
-
- Available to Backing Cards and Modules.
105
+
- Available to Backing Cards, Freeplay DJs and Modules.
106
106
107
107
-`onStateChangeEnd(event:StateChangeScriptEvent)` - Called when the State changing process ends.
108
-
- Available to Backing Cards and Modules.
108
+
- Available to Backing Cards, Freeplay DJs and Modules.
109
+
110
+
-`onStateCreate(event:ScriptEvent)` - Called when the State that was switched to gets created.
111
+
- Available to Modules.
109
112
110
113
-`onSubStateOpenBegin(event:SubStateScriptEvent)` - Called when the SubState opening process begins.
111
-
- Available to Backing Cards and Modules.
114
+
- Available to Backing Cards, Freeplay DJs and Modules.
112
115
113
116
-`onSubStateOpenEnd(event:SubStateScriptEvent)` - Called when the SubState opening process ends.
114
-
- Available to Backing Cards and Modules.
117
+
- Available to Backing Cards, Freeplay DJs and Modules.
115
118
116
119
-`onSubStateCloseBegin(event:SubStateScriptEvent)` - Called when the SubState closing process begins.
117
-
- Available to Backing Cards and Modules.
120
+
- Available to Backing Cards, Freeplay DJs and Modules.
118
121
119
122
-`onSubStateCloseEnd(event:SubStateScriptEvent)` - Called when the SubState closing process ends.
120
-
- Available to Backing Cards and Modules.
123
+
- Available to Backing Cards, Freeplay DJs and Modules.
121
124
122
125
-`onFocusLost(event:FocusScriptEvent)` - Called when the focus from the game window is lost.
123
-
- Available to Backing Cards and Modules.
126
+
- Available to Backing Cards, Freeplay DJs and Modules.
124
127
125
128
-`onFocusGained(event:FocusScriptEvent)` - Called when the focus from the game window is gained.
126
-
- Available to Backing Cards and Modules.
129
+
- Available to Backing Cards, Freeplay DJs and Modules.
127
130
128
131
-`onAdd(event:ScriptEvent)` - Called when the base class is added to the game stage.
129
132
- Available to Stage Props, Boppers and Characters.
@@ -141,10 +144,10 @@ There is a predefined list of every script event callback the game has set up to
141
144
- Available to Songs, Boppers, Characters, Stages, Notekinds and Modules.
142
145
143
146
-`onStepHit(event:SongTimeScriptEvent)` - Called when the Conductor reaches a new step of the music.
144
-
- Available to Songs, Boppers, Characters, Stages, Backing Cards and Modules.
147
+
- Available to Songs, Boppers, Characters, Stages, Backing Cards, Freeplay DJs and Modules.
145
148
146
149
-`onBeatHit(event:SongTimeScriptEvent)` - Called when the Conductor reaches a new beat of the music.
147
-
- Available to Songs, Boppers, Characters, Stages, Backing Cards and Modules.
150
+
- Available to Songs, Boppers, Characters, Stages, Backing Cards, Freeplay DJs and Modules.
148
151
149
152
-`onPause(event:PauseScriptEvent)` - Called when the main gameplay is paused.
150
153
- Available to Songs, Boppers, Characters, Stages and Modules.
@@ -194,6 +197,33 @@ There is a predefined list of every script event callback the game has set up to
194
197
-`onDialogueEnd(event:DialogueScriptEvent)` - Called when the dialogue ends.
195
198
- Available to Dialogue Boxes, Speakers and Conversations.
196
199
200
+
-`onCapsuleSelected(event:CapsuleScriptEvent)` - Called when the Freeplay capsule is selected.
201
+
- Available to Backing Cards, Freeplay DJs and Modules.
202
+
203
+
-`onDifficultySwitch(event:CapsuleScriptEvent)` - Called when the difficulty is switched in the Freeplay menu.
204
+
- Available to Backing Cards, Freeplay DJs and Modules.
205
+
206
+
-`onSongSelected(event:CapsuleScriptEvent)` - Called when the song is selected in the Freeplay menu.
207
+
- Available to Backing Cards, Freeplay DJs and Modules.
208
+
209
+
-`onFreeplayIntroDone(event:FreeplayScriptEvent)` - Called when the Freeplay intro sequence is finished - sort of like `onCountdownStart` but for the Freeplay menu.
210
+
- Available to Backing Cards, Freeplay DJs and Modules.
211
+
212
+
-`onFreeplayOutro(event:FreeplayScriptEvent)` - Called when the Freeplay closing process begins.
213
+
- Available to Backing Cards, Freeplay DJs and Modules.
214
+
215
+
-`onFreeplayClose(event:FreeplayScriptEvent)` - Called when the Freeplay closing process ends.
216
+
- Available to Backing Cards, Freeplay DJs and Modules.
217
+
218
+
-`onCharacterSelect(event:CharacterSelectScriptEvent)` - Called when a character has been hovered over in the Character Select menu.
219
+
- Available to Modules.
220
+
221
+
-`onCharacterConfirm(event:CharacterSelectScriptEvent)` - Called when the character selection has been confirmed in the Character Select menu.
222
+
- Available to Modules.
223
+
224
+
-`onCharacterDeselect(event:CharacterSelectScriptEvent)` - Called when the character selection has been cancelled in the Character Select menu.
225
+
- Available to Modules.
226
+
197
227
## List of Event Types
198
228
199
229
There is a predefined list of script events, whose fields are readable and, in some cases, changeable, that get dispatched to script event callbacks. More of these will be added in the future. See above which callback accepts which event.
@@ -286,6 +316,19 @@ There is a predefined list of script events, whose fields are readable and, in s
286
316
- Inherited from `ScriptEvent`.
287
317
- (read-only) `conversation` - The Conversation object associated with the event.
288
318
319
+
-`CapsuleScriptEvent`, with fields:
320
+
- Inherited from `ScriptEvent`.
321
+
- (read-only) `capsule` - The freeplay song capsule associated with the event.
322
+
- (read-only) `difficultyId` - The ID of the currently selected difficulty in the Freeplay menu.
323
+
- (read-only) `variationId` - The ID of the currently selected variation in the Freeplay menu.
324
+
325
+
-`FreeplayScriptEvent`, with fields:
326
+
- Inherited from `ScriptEvent`.
327
+
328
+
-`CharacterSelectScriptEvent`, with fields:
329
+
- Inherited from `ScriptEvent`.
330
+
- (read-only) `characterId` - The ID of the player associated with the event.
0 commit comments