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
@@ -11,171 +11,223 @@ Several base classes use functions that get an event dispatched to them whenever
11
11
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.
12
12
13
13
-`onScriptEvent(event:ScriptEvent)` - Called when any sort of script event would get dispatched. This is called before the event's respective callback.
14
+
14
15
- Available to Songs, Stage Props, Boppers, Characters, Stages, Backing Cards, Note Kinds, Dialogue Boxes, Speakers, Conversations and Modules.
15
16
-`onCreate(event:ScriptEvent)` - Called when the base class gets created in the game.
17
+
16
18
- Available to Songs, Stage Props, Boppers, Characters, Stages, Backing Cards, Note Kinds, Dialogue Boxes, Speakers, Conversations and Modules.
17
19
-`onDestroy(event:ScriptEvent)` - Called when the base class gets destroyed in the game.
20
+
18
21
- Available to Songs, Stage Props, Boppers, Characters, Stages, Backing Cards, Note Kinds, Dialogue Boxes, Speakers, Conversations and Modules.
19
22
-`onUpdate(event:UpdateScriptEvent)` - Called when the base class gets updated in the game.
23
+
20
24
- Available to Songs, Stage Props, Boppers, Characters, Stages, Backing Cards, Note Kinds, Dialogue Boxes, Speakers, Conversations and Modules.
21
25
-`onStateChangeBegin(event:StateChangeScriptEvent)` - Called when the State changing process begins.
26
+
22
27
- Available to Backing Cards and Modules.
23
28
-`onStateChangeEnd(event:StateChangeScriptEvent)` - Called when the State changing process ends.
29
+
24
30
- Available to Backing Cards and Modules.
25
31
-`onSubStateOpenBegin(event:SubStateScriptEvent)` - Called when the SubState opening process begins.
32
+
26
33
- Available to Backing Cards and Modules.
27
34
-`onSubStateOpenEnd(event:SubStateScriptEvent)` - Called when the SubState opening process ends.
35
+
28
36
- Available to Backing Cards and Modules.
29
37
-`onSubStateCloseBegin(event:SubStateScriptEvent)` - Called when the SubState closing process begins.
38
+
30
39
- Available to Backing Cards and Modules.
31
40
-`onSubStateCloseEnd(event:SubStateScriptEvent)` - Called when the SubState closing process ends.
41
+
32
42
- Available to Backing Cards and Modules.
33
43
-`onFocusLost(event:FocusScriptEvent)` - Called when the focus from the game window is lost.
44
+
34
45
- Available to Backing Cards and Modules.
35
46
-`onFocusGained(event:FocusScriptEvent)` - Called when the focus from the game window is gained.
47
+
36
48
- Available to Backing Cards and Modules.
37
49
-`onAdd(event:ScriptEvent)` - Called when the base class is added to the game stage.
50
+
38
51
- Available to Stage Props, Boppers and Characters.
39
52
-`onNoteIncoming(event:NoteScriptEvent)` - Called when a note is within the field of view.
53
+
40
54
- Available to Songs, Boppers, Characters, Stages, Notekinds and Modules.
41
55
-`onNoteHit(event:HitNoteScriptEvent)` - Called when a note is hit by either character.
56
+
42
57
- Available to Songs, Boppers, Characters, Stages, Notekinds and Modules.
43
58
-`onNoteMiss(event:NoteScriptEvent)` - Called when a note is missed by either character.
59
+
44
60
- Available to Songs, Boppers, Characters, Stages, Notekinds and Modules.
45
61
-`onNoteHoldDrop(event:HoldNoteScriptEvent)` - Called when a hold note is dropped by either character.
62
+
46
63
- Available to Songs, Boppers, Characters, Stages, Notekinds and Modules.
47
64
-`onStepHit(event:SongTimeScriptEvent)` - Called when the Conductor reaches a new step of the music.
65
+
48
66
- Available to Songs, Boppers, Characters, Stages, Backing Cards and Modules.
49
67
-`onBeatHit(event:SongTimeScriptEvent)` - Called when the Conductor reaches a new beat of the music.
68
+
50
69
- Available to Songs, Boppers, Characters, Stages, Backing Cards and Modules.
51
70
-`onPause(event:PauseScriptEvent)` - Called when the main gameplay is paused.
71
+
52
72
- Available to Songs, Boppers, Characters, Stages and Modules.
53
73
-`onResume(event:ScriptEvent)` - Called when the main gameplay is resumed.
74
+
54
75
- Available to Songs, Boppers, Characters, Stages and Modules.
55
76
-`onSongLoaded(event:SongLoadScriptEvent)` - Called when song chart has been parsed but before the notes have been placed, both when starting the song for the first time and retrying the song.
77
+
56
78
- Available to Songs, Boppers, Characters, Stages and Modules.
57
79
-`onSongStart(event:ScriptEvent)` - Called when the song starts.
58
-
- Available to Songs, Boppers, Characters, Stages and Modules.
80
+
81
+
- Available to Songs, Boppers, Characters, Stages and Modules.
59
82
-`onSongEnd(event:ScriptEvent)` - Called when the song ends.
60
-
- Available to Songs, Boppers, Characters, Stages and Modules.
83
+
84
+
- Available to Songs, Boppers, Characters, Stages and Modules.
61
85
-`onGameOver(event:ScriptEvent)` - Called when the player runs out of health but before the game over substate is opened.
86
+
62
87
- Available to Songs, Boppers, Characters, Stages and Modules.
63
88
-`onSongRetry(event:SongRetryEvent)` - Called when the song retrying process begins, either through the pause menu or through the game over screen.
89
+
64
90
- Available to Songs, Boppers, Characters, Stages and Modules.
65
91
-`onNoteGhostMiss(event:GhostMissNoteScriptEvent)` - Called when the player pressed a key with no notes on the strumline.
92
+
66
93
- Available to Songs, Boppers, Characters, Stages and Modules.
67
94
-`onSongEvent(event:SongEventScriptEvent)` - Called when a song event (such as Focus Camera) is triggered.
95
+
68
96
- Available to Songs, Boppers, Characters, Stages and Modules.
69
97
-`onCountdownStart(event:CountdownScriptEvent)` - Called when the countdown is about to start.
98
+
70
99
- Available to Songs, Boppers, Characters, Stages and Modules.
71
100
-`onCountdownStep(event:CountdownScriptEvent)` - Called when a countdown changes its current step.
101
+
72
102
- Available to Songs, Boppers, Characters, Stages and Modules.
73
-
-`onCountdownEnd(event:CountdownScriptEvent)` - Called when the countdown ends.
103
+
-`onCountdownEnd(event:CountdownScriptEvent)` - Called when the countdown ends.
104
+
74
105
- Available to Songs, Boppers, Characters, Stages and Modules.
75
106
-`onDialogueCompleteLine(event:DialogueScriptEvent)` - Called when the player advanced the dialogue while it's being typed.
107
+
76
108
- Available to Dialogue Boxes, Speakers and Conversations.
77
109
-`onDialogueLine(event:DialogueScriptEvent)` - Called when the player advances the dialogue while it's idling.
110
+
78
111
- Available to Dialogue Boxes, Speakers and Conversations.
79
112
-`onDialogueSkip(event:DialogueScriptEvent)` - Called when the dialogue gets skipped.
113
+
80
114
- Available to Dialogue Boxes, Speakers and Conversations.
81
115
-`onDialogueEnd(event:DialogueScriptEvent)` - Called when the dialogue ends.
116
+
82
117
- Available to Dialogue Boxes, Speakers and Conversations.
83
118
84
119
## List of Event Types
85
120
86
121
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.
87
122
88
123
-`ScriptEvent`, with fields:
89
-
- (read-only) `cancelable` - If the event can be canceled.
90
-
- (read-only) `type` - The type of the event.
91
-
- (read-only) `shouldPropagate` - If the event can be dispatched to its respective callback. If false, it will only get dispatched to `onScriptEvent`.
92
-
- (read-only) `eventCanceled` - If the event has been cancelled.
93
-
-`cancelEvent()` - Cancels the event, if possible.
94
-
-`cancel()` - Cancels the event, if possible.
95
-
-`stopPropagation()` - Stops the propagation of this event.
124
+
125
+
126
+
- (read-only) `cancelable` - If the event can be canceled.
127
+
- (read-only) `type` - The type of the event.
128
+
- (read-only) `shouldPropagate` - If the event can be dispatched to its respective callback. If false, it will only get dispatched to `onScriptEvent`.
129
+
- (read-only) `eventCanceled` - If the event has been cancelled.
130
+
-`cancelEvent()` - Cancels the event, if possible.
131
+
-`cancel()` - Cancels the event, if possible.
132
+
-`stopPropagation()` - Stops the propagation of this event.
96
133
97
134
-`UpdateScriptEvent`, with fields:
98
-
- Inherited from `ScriptEvent`.
99
-
- (read-only) `elapsed` - How much time has passed since the last update.
135
+
136
+
- Inherited from `ScriptEvent`.
137
+
- (read-only) `elapsed` - How much time has passed since the last update.
100
138
101
139
-`StateChangeScriptEvent`, with fields:
102
-
- Inherited from `ScriptEvent`.
103
-
- (read-only) `targetState` - The State that was switched to.
140
+
141
+
- Inherited from `ScriptEvent`.
142
+
- (read-only) `targetState` - The State that was switched to.
104
143
105
144
-`SubStateScriptEvent`, with fields:
106
-
- Inherited from `ScriptEvent`.
107
-
- (read-only) `targetState` - The SubState that was opened/closed.
145
+
146
+
- Inherited from `ScriptEvent`.
147
+
- (read-only) `targetState` - The SubState that was opened/closed.
108
148
109
149
-`FocusScriptEvent`, with fields:
110
-
- Inherited from `ScriptEvent`.
150
+
151
+
- Inherited from `ScriptEvent`.
111
152
112
153
-`NoteScriptEvent`, with fields:
113
-
- Inherited from `ScriptEvent.`
114
-
- (read-only) `note` - The NoteSprite associated with this event.
115
-
- (read-only) `comboCount` - The currently ongoing combo.
116
-
-`playSound` - Whether to play a miss sound when missing a note.
117
-
-`healthChange` - The amount of health to add to the player. Can be a negative value too.
154
+
155
+
- Inherited from `ScriptEvent.`
156
+
- (read-only) `note` - The NoteSprite associated with this event.
157
+
- (read-only) `comboCount` - The currently ongoing combo.
158
+
-`playSound` - Whether to play a miss sound when missing a note.
159
+
-`healthChange` - The amount of health to add to the player. Can be a negative value too.
118
160
119
161
-`HitNoteScriptEvent`, with fields:
120
-
- Inherited from `NoteScriptEvent`.
121
-
-`judgement` - The judgement received from hitting the note.
122
-
-`score` - The score received from hitting the note.
123
-
-`isComboBreak` - If the hit caused a combo break.
124
-
-`hitDiff` - The time difference (in miliseconds) when the player hit the note.
125
-
-`doesNotesplash` - If the note does a splash, defaults to true when the judgement is "sick".
162
+
163
+
- Inherited from `NoteScriptEvent`.
164
+
-`judgement` - The judgement received from hitting the note.
165
+
-`score` - The score received from hitting the note.
166
+
-`isComboBreak` - If the hit caused a combo break.
167
+
-`hitDiff` - The time difference (in miliseconds) when the player hit the note.
168
+
-`doesNotesplash` - If the note does a splash, defaults to true when the judgement is "sick".
126
169
127
170
-`HoldNoteScriptEvent`, with fields:
128
-
- Inherited from `NoteScriptEvent`.
129
-
-`holdNote` - The SustainTrail object associated with this event.
130
-
-`score` - The score received from hitting the note.
131
-
-`isComboBreak` - If the hit caused a combo break.
132
-
-`hitDiff` - The time difference (in miliseconds) when the player hit the note.
133
-
-`doesNotesplash` - If the note does a splash, defaults to true when the judgement is "sick".
171
+
172
+
- Inherited from `NoteScriptEvent`.
173
+
-`holdNote` - The SustainTrail object associated with this event.
174
+
-`score` - The score received from hitting the note.
175
+
-`isComboBreak` - If the hit caused a combo break.
176
+
-`hitDiff` - The time difference (in miliseconds) when the player hit the note.
177
+
-`doesNotesplash` - If the note does a splash, defaults to true when the judgement is "sick".
134
178
135
179
-`SongTimeScriptEvent`, with fields:
136
-
- Inherited from `ScriptEvent`.
137
-
- (read-only) `beat` - The current beat of the song.
138
-
- (read-only) `step` - The current step of the song.
180
+
181
+
- Inherited from `ScriptEvent`.
182
+
- (read-only) `beat` - The current beat of the song.
183
+
- (read-only) `step` - The current step of the song.
139
184
140
185
-`PauseScriptEvent`, with fields:
141
-
- Inherited from `ScriptEvent`.
142
-
-`gitaroo` - If the Gitaroo Man easter egg should be used.
186
+
187
+
- Inherited from `ScriptEvent`.
188
+
-`gitaroo` - If the Gitaroo Man easter egg should be used.
143
189
144
190
-`SongLoadScriptEvent`, with fields:
145
-
- Inherited from `ScriptEvent`.
146
-
- (read-only) `id` - The song id associated with the event.
147
-
- (read-only) `difficulty` - The song difficulty associated with the event.
148
-
-`notes` - An Array of SongNoteData objects representing the notes for the chart.
149
-
-`events` - An Array of SongEventData objects representing the events for the chart.
191
+
192
+
- Inherited from `ScriptEvent`.
193
+
- (read-only) `id` - The song id associated with the event.
194
+
- (read-only) `difficulty` - The song difficulty associated with the event.
195
+
-`notes` - An Array of SongNoteData objects representing the notes for the chart.
196
+
-`events` - An Array of SongEventData objects representing the events for the chart.
150
197
151
198
-`SongRetryEvent`, with fields:
152
-
- Inherited from `ScriptEvent`.
153
-
- (read-only) `difficulty` - The new difficulty of the song.
199
+
200
+
- Inherited from `ScriptEvent`.
201
+
- (read-only) `difficulty` - The new difficulty of the song.
154
202
155
203
-`GhostMissNoteScriptEvent`, with fields:
156
-
- Inherited from `ScriptEvent`.
157
-
- (read-only) `dir` - The direction (1-4) that was mistakenly pressed.
158
-
- (read-only) `hasPossibleNotes` - If there were notes within judgement range when the key was pressed.
159
-
-`healthChange` - The amount of health to add to the player. Can be a negative value too.
160
-
-`scoreChange` - The amount of score to add to the player. Can be a negative value too.
161
-
-`playSound` - Whether to play a miss sound.
162
-
-`playAnim` - Whether to play a miss animation.
204
+
205
+
- Inherited from `ScriptEvent`.
206
+
- (read-only) `dir` - The direction (1-4) that was mistakenly pressed.
207
+
- (read-only) `hasPossibleNotes` - If there were notes within judgement range when the key was pressed.
208
+
-`healthChange` - The amount of health to add to the player. Can be a negative value too.
209
+
-`scoreChange` - The amount of score to add to the player. Can be a negative value too.
210
+
-`playSound` - Whether to play a miss sound.
211
+
-`playAnim` - Whether to play a miss animation.
163
212
164
213
-`SongEventScriptEvent`, with fields:
165
-
- Inherited from `ScriptEvent`.
166
-
- (read-only) `eventData` - The SongEventData object associated with the event.
214
+
215
+
- Inherited from `ScriptEvent`.
216
+
- (read-only) `eventData` - The SongEventData object associated with the event.
167
217
168
218
-`CountdownScriptEvent`, with fields:
169
-
- Inherited from `ScriptEvent`.
170
-
- (read-only) `step` - The current countdown step. Can be *BEFORE*, *THREE*, *TWO*, *ONE*, *GO* or *AFTER*.
219
+
220
+
- Inherited from `ScriptEvent`.
221
+
- (read-only) `step` - The current countdown step. Can be `BEFORE`, `THREE`, `TWO`, `ONE`, `GO` or `AFTER`.
171
222
172
223
-`DialogueScriptEvent`, with fields:
173
-
- Inherited from `ScriptEvent`.
174
-
- (read-only) `conversation` - The Conversation object associated with the event.
224
+
225
+
- Inherited from `ScriptEvent`.
226
+
- (read-only) `conversation` - The Conversation object associated with the event.
175
227
176
228
## Script Event Cancelling
177
229
178
-
While most cannot be cancelled, cancelling some events provides more leeway to the custom behavior. An example to this would be having pre-song cutscenes, as seen in the script file for the song Darnell[^darnell]:
230
+
While most cannot be cancelled, cancelling some events provides more leeway to the custom behavior. An example to this would be having pre-song cutscenes, as seen in the script file for the song Darnell:[^darnell]
179
231
```haxe
180
232
// ...
181
233
@@ -207,7 +259,7 @@ public override function onCountdownStart(event:CountdownScriptEvent):Void
207
259
208
260
## Overriding Script Event Callbacks
209
261
210
-
Even if most base classes have the script event callbacks as empty functions, others have behavior that is entirely dependant on them. As such, you can skip the behavior or call it under a condition depending on if and where you put your super function call. One such example is in the script file for Boyfriend (Christmas)[^bf-christmas]:
262
+
Even if most base classes have the script event callbacks as empty functions, others have behavior that is entirely dependant on them. As such, you can skip the behavior or call it under a condition depending on if and where you put your super function call. One such example is in the script file for Boyfriend (Christmas)[^bf-christmas]
211
263
```haxe
212
264
// ...
213
265
@@ -234,6 +286,7 @@ function onNoteHit(event:HitNoteScriptEvent)
0 commit comments