Skip to content

Commit a133d1c

Browse files
KoloInDaCribKade-github
authored andcommitted
add 0.8.0 events to the ScriptEventCallbacks article
1 parent aa4c10b commit a133d1c

File tree

1 file changed

+57
-14
lines changed

1 file changed

+57
-14
lines changed

assets/content/cookbook/Advanced/06.ScriptEventCallbacks.md

Lines changed: 57 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,40 +90,43 @@ public override function onNoteMiss(event:NoteScriptEvent):Void
9090
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.
9191

9292
- `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.
9494

9595
- `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.
9797

9898
- `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.
100100

101101
- `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.
103103

104104
- `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.
106106

107107
- `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.
109112

110113
- `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.
112115

113116
- `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.
115118

116119
- `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.
118121

119122
- `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.
121124

122125
- `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.
124127

125128
- `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.
127130

128131
- `onAdd(event:ScriptEvent)` - Called when the base class is added to the game stage.
129132
- 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
141144
- Available to Songs, Boppers, Characters, Stages, Notekinds and Modules.
142145

143146
- `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.
145148

146149
- `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.
148151

149152
- `onPause(event:PauseScriptEvent)` - Called when the main gameplay is paused.
150153
- 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
194197
- `onDialogueEnd(event:DialogueScriptEvent)` - Called when the dialogue ends.
195198
- Available to Dialogue Boxes, Speakers and Conversations.
196199

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+
197227
## List of Event Types
198228

199229
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
286316
- Inherited from `ScriptEvent`.
287317
- (read-only) `conversation` - The Conversation object associated with the event.
288318

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.
331+
289332
[^darnell]: <https://github.com/FunkinCrew/funkin.assets/blob/main/preload/scripts/songs/darnell.hxc>
290333

291334
[^bf-christmas]: <https://github.com/FunkinCrew/funkin.assets/blob/main/preload/scripts/characters/bf-christmas.hxc>

0 commit comments

Comments
 (0)