ON
The callback of every value is on the ON events page.
| Name | Value | Description |
|---|---|---|
ON.ARENA_INTRO | 25 | Runs when entering the arena VS intro screen. |
ON.ARENA_ITEMS | 23 | Runs when entering the arena item config screen. |
ON.ARENA_MATCH | 26 | Runs when entering the arena level screen, after all entities have spawned, on the first level frame, before the get ready go scene. |
ON.ARENA_MENU | 21 | Runs when entering the main arena rules menu screen. |
ON.ARENA_SCORE | 27 | Runs when entering the arena scores screen. |
ON.ARENA_SELECT | 24 | |
ON.ARENA_STAGES | 22 | Runs when entering the arena stage selection screen. |
ON.BLOCKED_GAME_LOOP | 162 | Runs instead of POST_GAME_LOOP when anything blocks a PRE_GAME_LOOP. Even runs in Playlunky when Overlunky blocks a PRE_GAME_LOOP. |
ON.BLOCKED_PROCESS_INPUT | 163 | Runs instead of POST_PROCESS_INPUT when anything blocks a PRE_PROCESS_INPUT. Even runs in Playlunky when Overlunky blocks a PRE_PROCESS_INPUT. |
ON.BLOCKED_UPDATE | 161 | Runs instead of POST_UPDATE when anything blocks a PRE_UPDATE. Even runs in Playlunky when Overlunky blocks a PRE_UPDATE. |
ON.CAMP | 11 | Runs when entering the camp, after all entities have spawned, on the first level frame. |
ON.CHARACTER_SELECT | 9 | Runs when entering the character select screen. |
ON.CONSTELLATION | 19 | Runs when entering the turning into constellation cutscene after cosmic ocean. |
ON.CREDITS | 17 | Runs when entering the credits screen. |
ON.DEATH | 14 | Runs when entering the death screen. |
ON.DEATH_MESSAGE | 137 | Params: STRINGID id Runs once after death when the death message journal page is shown. The parameter is the STRINGID of the title, like 1221 for BLOWN UP. |
ON.FRAME | 101 | Runs while playing the game while the player is controllable, not in the base camp or the arena mode |
ON.GAMEFRAME | 108 | Runs whenever the game engine is actively running. This includes base camp, arena, level transition and death screen |
ON.GUIFRAME | 100 | Params: GuiDrawContext draw_ctx Runs every frame the game is rendered, thus runs at selected framerate. Drawing functions are only available during this callback through a GuiDrawContext |
ON.INTRO | 1 | Runs when entering the intro cutscene. |
ON.LEADERBOARD | 7 | Runs when entering the leaderboard screen. |
ON.LEVEL | 12 | Runs when entering any level, after all entities have spawned, on the first level frame. |
ON.LOAD | 107 | Params: LoadContext load_ctx Runs as soon as your script is loaded, including reloads, then never again |
ON.LOADING | 104 | Runs whenever state.loading changes and is > 0. Prefer PRE/POST_LOAD_SCREEN instead though. |
ON.LOGO | 0 | Runs when entering the the mossmouth logo screen. |
ON.MENU | 4 | Runs when entering the main menu. |
ON.ONLINE_LOADING | 28 | Runs when entering the online loading screen. |
ON.ONLINE_LOBBY | 29 | Runs when entering the online lobby screen. |
ON.OPTIONS | 5 | Runs when entering the options menu. |
ON.PLAYER_PROFILE | 6 | Runs when entering the player profile screen. |
ON.POST_GAME_LOOP | 156 | Runs right after the main engine loop. |
ON.POST_LAYER_CREATION | 148 | Params: LAYER layer Runs right after a layer has been created and you can start spawning entities in it. Runs in all screens that usually have entities, or when creating a layer manually. |
ON.POST_LAYER_DESTRUCTION | 152 | Params: LAYER layer Runs right after a layer has been unloaded and any entities there destroyed. Runs in pretty much all screens, even ones without entities. The screen has already changed at this point, meaning the screen being destroyed is in state.screen_last. |
ON.POST_LEVEL_CREATION | 146 | Runs right after the back layer has been created and you can start spawning entities in it. Runs in all screens that usually have entities, or when creating a layer manually. |
ON.POST_LEVEL_DESTRUCTION | 150 | Runs right after the current level has been unloaded and all entities destroyed. Runs in pretty much all screens, even ones without entities. The screen has already changed at this point, meaning the screen being destroyed is in state.screen_last. |
ON.POST_LEVEL_GENERATION | 112 | Runs right after level generation is done, i.e. after all level gen entities are spawned, before any entities are updated. You can spawn your own entities here, like extra enemies, give items to players etc. |
ON.POST_LOAD_JOURNAL_CHAPTER | 139 | Params: JOURNALUI_PAGE_SHOWN chapter, array:int pages
Runs after the pages for the journal are prepared, but not yet displayed, |
ON.POST_LOAD_SCREEN | 136 | Runs right after a screen is loaded, before rendering anything |
ON.POST_LOAD_STATE | 160 | Runs right after the main StateMemory is manually loaded from a slot or a custom SaveState. Slot is 1..4 or -1 on custom SaveState. Params: int slot, StateMemory loaded |
ON.POST_PROCESS_INPUT | 154 | Runs right after the game gets input from various devices and writes to a bunch of buttons-variables. Probably the first chance you have to capture or edit buttons_gameplay or buttons_menu sort of things. |
ON.POST_ROOM_GENERATION | 111 | Params: PostRoomGenerationContext room_gen_ctx Runs right after all rooms are generated before entities are spawned |
ON.POST_SAVE_STATE | 158 | Runs right after the main StateMemory is manually saved to a slot or a custom SaveState. Slot is 1..4 or -1 on custom SaveState. Params: int slot, StateMemory saved |
ON.POST_UPDATE | 143 | Runs right after the State is updated, runs always (menu, settings, camp, game, arena, online etc.) with the game engine, typically 60FPS |
ON.PRE_GAME_LOOP | 155 | Runs right before the main engine loop. Return true to block state updates and menu updates, i.e. to pause inside menus. |
ON.PRE_GET_FEAT | 140 | Runs before getting performed status for a FEAT when rendering the Feats page in journal. Return: true to override the vanilla feat with your own. Defaults to Steam GetAchievement. |
ON.PRE_GET_RANDOM_ROOM | 113 | Params: int x, int y, LAYER layer, ROOM_TEMPLATE room_template
Return: |
ON.PRE_HANDLE_ROOM_TILES | 114 | Params: int x, int y, ROOM_TEMPLATE room_template, PreHandleRoomTilesContext room_ctx
Return: |
ON.PRE_LAYER_CREATION | 147 | Params: LAYER layer Runs right before a layer is created. Runs in all screens that usually have entities, or when creating a layer manually. |
ON.PRE_LAYER_DESTRUCTION | 151 | Params: LAYER layer Runs right before a layer is unloaded and any entities there destroyed. Runs in pretty much all screens, even ones without entities. The screen has already changed at this point, meaning the screen being destroyed is in state.screen_last. |
ON.PRE_LEVEL_CREATION | 145 | Runs right before the front layer is created. Runs in all screens that usually have entities, or when creating a layer manually. |
ON.PRE_LEVEL_DESTRUCTION | 149 | Runs right before the current level is unloaded and any entities destroyed. Runs in pretty much all screens, even ones without entities. The screen has already changed at this point, meaning the screen being destroyed is in state.screen_last. |
ON.PRE_LEVEL_GENERATION | 110 | Runs before any level generation, no entities exist at this point. Runs in most screens that have entities. Return true to block normal level generation, i.e. stop any entities from being spawned by ThemeInfo functions. Does not block other ThemeInfo functions, like spawn_effects though. POST_LEVEL_GENERATION will still run if this callback is blocked. |
ON.PRE_LOAD_JOURNAL_CHAPTER | 138 | Params: JOURNALUI_PAGE_SHOWN chapter Runs before the journal or any of it's chapter is opened Return: return true to not load the chapter (or journal as a whole) |
ON.PRE_LOAD_LEVEL_FILES | 109 | Params: PreLoadLevelFilesContext load_level_ctx Runs right before level files would be loaded |
ON.PRE_LOAD_SCREEN | 135 | Runs right before loading a new screen based on screen_next. Return true from callback to block the screen from loading. |
ON.PRE_LOAD_STATE | 159 | Runs right before the main StateMemory is manually loaded from a slot or a custom SaveState. Slot is 1..4 or -1 on custom SaveState. Return true to block load. Params: int slot, StateMemory loaded |
ON.PRE_PROCESS_INPUT | 153 | Runs right before the game gets input from various devices and writes to a bunch of buttons-variables. Return true to disable all game input completely. |
ON.PRE_SAVE_STATE | 157 | Runs right before the main StateMemory is manually saved to a slot or a custom SaveState. Slot is 1..4 or -1 on custom SaveState. Return true to block save. Params: int slot, StateMemory saved |
ON.PRE_SET_FEAT | 141 | Runs before the game sets a vanilla feat performed. Return: true to block the default behaviour of calling Steam SetAchievement. |
ON.PRE_UPDATE | 142 | Runs before the State is updated, runs always (menu, settings, camp, game, arena, online etc.) with the game engine, typically 60FPS Return behavior: return true to stop further PRE_UPDATE callbacks from executing and don't update the state (this will essentially freeze the game engine) |
ON.PROLOGUE | 2 | Runs when entering the prologue / poem. |
ON.RECAP | 20 | Runs when entering the Dear Journal screen after final scores. |
ON.RENDER_POST_BLURRED_BACKGROUND | 122 | Params: VanillaRenderContext render_ctx, float blur
Runs after the blurred background is drawn on screen, behind pause menu or journal book. In this event, you can draw textures with the |
ON.RENDER_POST_DRAW_DEPTH | 124 | Params: VanillaRenderContext render_ctx, int draw_depth
Runs right after the entities of the specified draw_depth are drawn on screen. In this event, you can draw textures with the |
ON.RENDER_POST_GAME | 132 | Params: VanillaRenderContext render_ctx Runs after the level and HUD are rendered, before pause menus and blur effects |
ON.RENDER_POST_HUD | 118 | Params: VanillaRenderContext render_ctx, Hud hud
Runs after the HUD is drawn on screen. In this event, you can draw textures with the |
ON.RENDER_POST_JOURNAL_PAGE | 126 | Params: VanillaRenderContext render_ctx, JOURNAL_PAGE_TYPE page_type, JournalPage page
Runs after the journal page is drawn on screen. In this event, you can draw textures with the draw_screen_texture function of the VanillaRenderContext
The JournalPage parameter gives you access to the specific fields of the page. Be sure to cast it to the correct type, the following functions are available to do that:
|
ON.RENDER_POST_LAYER | 128 | Params: VanillaRenderContext render_ctx, int rendered_layer Runs after a layer is rendered, runs for both layers during layer door transitions. Things drawn here will be part of the layer transition animation |
ON.RENDER_POST_LEVEL | 130 | Params: VanillaRenderContext render_ctx, int camera_layer Runs after the level is rendered, before hud |
ON.RENDER_POST_PAUSE_MENU | 120 | Params: VanillaRenderContext render_ctx
Runs after the pause menu is drawn on screen. In this event, you can draw textures with the |
ON.RENDER_PRE_BLURRED_BACKGROUND | 121 | Params: VanillaRenderContext render_ctx, float blur
Runs before the blurred background is drawn on screen, behind pause menu or journal book. In this event, you can't really draw textures, because the blurred background is drawn on top of them. Return |
ON.RENDER_PRE_DRAW_DEPTH | 123 | Params: VanillaRenderContext render_ctx, int draw_depth
Runs before the entities of the specified draw_depth are drawn on screen. In this event, you can draw textures with the |
ON.RENDER_PRE_GAME | 131 | Params: VanillaRenderContext render_ctx
Runs before the in-game part of the game is rendered. Return |
ON.RENDER_PRE_HUD | 117 | Params: VanillaRenderContext render_ctx, Hud hud
Runs before the HUD is drawn on screen. In this event, you can draw textures with the |
ON.RENDER_PRE_JOURNAL_PAGE | 125 | Params: VanillaRenderContext render_ctx, JOURNAL_PAGE_TYPE page_type, JournalPage page
Runs before the journal page is drawn on screen. Return |
ON.RENDER_PRE_LAYER | 127 | Params: VanillaRenderContext render_ctx, int rendered_layer
Runs before a layer is rendered, runs for both layers during layer door transitions. Return |
ON.RENDER_PRE_LEVEL | 129 | Params: VanillaRenderContext render_ctx, int camera_layer
Runs before the level is rendered. Return |
ON.RENDER_PRE_PAUSE_MENU | 119 | Params: VanillaRenderContext render_ctx
Runs before the pause menu is drawn on screen. In this event, you can't really draw textures, because the blurred background is drawn on top of them. Return |
ON.RESET | 105 | Runs when resetting a run |
ON.SAVE | 106 | Params: SaveContext save_ctx Runs at the same times as ON.SCREEN, but receives the save_ctx |
ON.SCORES | 18 | Runs when entering the final score celebration screen of a normal or hard ending. |
ON.SCREEN | 102 | Runs whenever state.screen changes |
ON.SCRIPT_DISABLE | 116 | Runs when the script is disabled from the UI and also right before unloading/reloading. |
ON.SCRIPT_ENABLE | 115 | Runs when the script is enabled from the UI or when imported by another script while disabled, but not on load. |
ON.SEED_INPUT | 8 | Runs when entering the seed input screen of a seeded run. |
ON.SPACESHIP | 15 | Runs when entering the olmecship cutscene after Tiamat. |
ON.SPEECH_BUBBLE | 133 | Params: Entity speaking_entity, string text Runs before any speech bubble is created, even the one using say function Return: if you don't return anything it will execute the speech bubble function normally with default message if you return empty string, it will not create the speech bubble at all, if you return string, it will use that instead of the original The first script to return string (empty or not) will take priority, the rest will receive callback call but the return behavior won't matter |
ON.START | 103 | Runs on the first ON.SCREEN of a run |
ON.TEAM_SELECT | 10 | Runs when entering the team select screen of arena mode. |
ON.TITLE | 3 | Runs when entering the title screen. |
ON.TOAST | 134 | Params: string text Runs before any toast is created, even the one using toast function Return: if you don't return anything it will execute the toast function normally with default message if you return empty string, it will not create the toast at all, if you return string, it will use that instead of the original message The first script to return string (empty or not) will take priority, the rest will receive callback call but the return behavior won't matter |
ON.TRANSITION | 13 | Runs when entering the transition screen, after all entities have spawned. |
ON.USER_DATA | 144 | Params: Entity ent Runs on all changes to Entity.user_data, including after loading saved user_data in the next level and transition. Also runs the first time user_data is set back to nil, but nil won't be saved to bother you on future levels. |
ON.WIN | 16 | Runs when entering any winning cutscene, including the constellation. |