Repository navigation
Expand file tree
/
Copy pathcontent.js
More file actions
1 lines (1 loc) · 136 KB
/
Copy pathcontent.js
File metadata and controls
1 lines (1 loc) · 136 KB
1
window.WIKI = {"version":"v0.1.0","groups":[{"name":"Start here","pages":["home","install","first-script","tutorials"]},{"name":"LuaSlice Lua API","pages":["api-overview","api-hooks","api-helpers","api-raw","api-examples","api-chart-events","api-whatsnew","api-errors"]},{"name":"Psych Lua API","pages":["psych-guide","psych-examples","psych-callbacks","psych-diff"]},{"name":"Reference","pages":["changelog-engine","changelog-psych"]}],"pages":{"home":{"title":"Home","md":"# LuaSlice Wiki\n\n<div class=\"home-top\">\n<div>\n\nLuaSlice is a Friday Night Funkin' engine based on V-Slice. You can write mods for it in Lua or Haxe, and it also runs Psych Engine 1.0.4 Lua scripts.\n\n</div>\n<img class=\"home-logo\" src=\"icons/logo.webp\" alt=\"LuaSlice Engine logo\">\n</div>\n\n## Where to start\n\n- [Installing mods](#install): where the `mods` folder is on each platform.\n- [Your first script](#first-script): a small Lua script for the Tutorial song.\n- [Tutorials](#tutorials): adding a character, a stage, and a song with a week.\n- [LuaSlice Lua API](#api-overview): script folders, hooks, helpers, the raw bridge, and examples.\n- [Psych Lua API](#psych-guide): running Psych Engine scripts, and what differs on V-Slice.\n\n## Script types\n\n| Extension | Language | Loads |\n| --- | --- | --- |\n| `.lua` | LuaSlice Lua | Isolated: each file has its own environment |\n| `.luag` | LuaSlice Lua | Global: shared environment, good for helper modules |\n| `.luap` | Psych Lua | One Psych-style script, with the Psych Engine 1.0.4 API |\n| `.luapg` | Psych Lua | Same, but discovered globally for every song |\n| `.ss` / `.ssg` | SScript (Haxe-style) | Isolated / global |\n| `.nx` / `.nxg` | NxScript | Isolated / global |\n| `.hxc` | HScript | FNF's own module system |\n\n`.lua` and `.luap` are separate runtimes and don't read each other's files. Moving a Psych Engine script over means renaming it to `.luap`. Writing something new for LuaSlice means `.lua`.\n\n## FAQ\n\n**Is this like Psych Engine or P-Slice's Lua API?**\nKind of. LuaSlice has its own Lua API, built from the game's Haxe code, and it also includes the Psych Engine 1.0.4 Lua API as a separate loader.\n\n**Can I use Psych Engine or P-Slice scripts and mods?**\nScripts, yes, if they were made for Psych Engine 1.0.4. Rename them from `.lua` to `.luap`. Whole mods need more: songs, characters, stages and events still have to work with V-Slice. See [Differences from Psych](#psych-diff).\n\n**Does LuaSlice still use Haxe?**\nYes. You can code in Haxe and Lua. HScript modules, SScript and NxScript are all supported.\n\n**How do I check the API in the build I'm running?**\nIn-game, call `LuaSlice.api.list()` to list the API in your build, or `LuaSlice.api.find('functionName')` to look up one function.\n"},"install":{"title":"Installing mods","md":"# Installing mods\n\n## HTML5/Web (From Funkin' Crew)\n1. Nope\n\n## Windows\n1. Start the game at least once. This will create a `mods` folder if it doesn't already exist, alongside the executable.\n2. Extract the mod you downloaded from its ZIP file, and place the mod folder into the game's `mods` folder.\n3. Restart the game. The game should detect the mod and start with it.\n\n## Linux\n1. Start the game at least once. This will create a `mods` folder if it doesn't already exist, alongside the executable.\n2. Extract the mod you downloaded from its ZIP file, and place the mod folder into the game's `mods` folder.\n3. Restart the game. The game should detect the mod and start with it.\n\n## MacOS\n1. Start the game at least once. This will create a `mods` folder if it doesn't already exist in the game's system files.\n2. Right click `Funkin.app` and select `Show Package Contents`.\n3. Navigate to `Contents/Resources/mods`.\n4. Extract the mod you downloaded from its ZIP file, and place the mod folder into the game's `mods` folder.\n5. Restart the game. The game should detect the mod and start with it.\n\n## Android\n1. Start the game at least once. This will create a `mods` folder deep in your system files.\n2. Get an Android file browser that lets you view the app data files, or use Android Studio and open up the Device Explorer.\n3. In internal storage, open `Android/data/me.luaslice/files/mods`.\n4. Extract the mod you downloaded from its ZIP file, and place the mod folder into the game's `mods` folder.\n5. Restart the game (you may have to [force close](https://support.google.com/android/answer/9079646?hl=en) the app first). The game should detect the mod and start with it.\n\n## iOS\n1. Start the game at least once. This will create a `mods` folder in your system files.\n2. Open the Files app, and navigate to `On My iPhone` -> `Friday Night Funkin` -> `mods`.\n3. Extract the mod you downloaded from its ZIP file, and place the mod folder into the game's `mods` folder.\n4. Restart the game (you may have to [force close](https://support.apple.com/en-us/109359) the app first). The game should detect the mod and start with it.\n\n## Old and Preview 4 asset folders\n\nNative builds index supported old paths under their Preview 4 asset IDs. Mod priority is checked before folder layout: a higher-priority mod using an old path can replace a lower-priority mod using the new path. If one mod contains both copies, the Preview 4 path wins. The game does not move or copy the files.\n\nRegistry data keeps the existing compatibility rules for characters, stages, songs, note styles, playable characters, dialogue, levels, albums, freeplay styles and sticker packs. Known image, audio and UI aliases use the engine's existing path table. An unknown custom image path is not automatically matched by its filename.\n\nFor example, `images/characters/BOYFRIEND.png` can override `gameplay/characters/bf/bf.png`, and `data/characters/custom.json` is indexed as `gameplay/characters/custom/custom.json`. Old `_merge` and `_append` registry patches use the same canonical IDs and mod order.\n\nOriginal Lua song scripts can live in `gameplay/songs/<song>/`, `data/songs/<song>/`, `songs/<song>/` or `scripts/songs/<song>/`. Matching filenames represent the same script; the current layout wins within a mod. `.lua` and `.luag` remain separate script types, and neither is loaded by the Psych `.luap` loader.\n\n## Optional mod photosensitivity warning\n\nMod authors can opt in using the existing custom metadata object inside `_polymod_meta.json`. Keep the other required mod fields and merge this key into any existing `metadata` object:\n\n```json\n\"metadata\": {\n \"photosensitivityWarning\": \"true\"\n}\n```\n\nThe warning is shown before the selected mods' assets and scripts are activated. Players can continue or disable the existing Flashing Lights option and continue. Disabling this option only reduces effects that respect it; other mod visuals can still pose a photosensitivity risk. The option remains available in Options > Performance.\n\nAcknowledgment lasts for the current app session, including song restarts and unchanged hot reloads. Changing a flagged mod's metadata or disabling and re-enabling it requires acknowledgment again. Unflagged mods do not show this warning.\n"},"first-script":{"title":"Your first script","md":"# Your first script\n\nA `.lua` script that prints a message, sets the window title, and pulses the camera every four beats. It runs only on the Tutorial song.\n\n> This page is assembled from the LuaSlice docs and source. The steps haven't been play-tested in-game yet, so treat it as a first draft.\n\n## 1. Make the mod folder\n\nStart the game once so it creates the `mods` folder (see [Installing mods](#install) for where that is on your platform). Then create a folder for your mod:\n\n```\nmods/\n my-first-mod/\n _polymod_meta.json\n data/songs/tutorial/script.lua\n```\n\n## 2. Add the metadata\n\n`_polymod_meta.json` tells the game your mod exists. Disabled mods don't load scripts.\n\n```json\n{\n \"title\": \"My First Mod\",\n \"description\": \"Testing LuaSlice scripts\",\n \"author\": \"You\",\n \"api_version\": \"0.8.6\",\n \"mod_version\": \"1.0.0\",\n \"license\": \"CC BY 4.0\"\n}\n```\n\nSet `api_version` to the FNF version your build targets, not LuaSlice's or Psych's version. The docs use `0.8.6` as the example.\n\n## 3. Write the script\n\n`data/songs/tutorial/script.lua` loads only on Tutorial. Use the song's chart id as the folder name.\n\n```lua\nfunction onCreate()\n debug.info('Loaded ' .. songName)\n window.setTitle('LuaSlice - ' .. songName)\nend\n\nfunction onBeatHit(beat)\n if beat % 4 == 0 then camera.setZoom('game', 1.03) end\nend\n```\n\n`songName` is one of the [globals](#api-hooks) the game sets for you. `onCreate` and `onBeatHit` are [hooks](#api-hooks): the game calls them, you fill them in.\n\n## 4. Run it\n\n1. Open the Mods menu and enable **My First Mod**.\n2. Play the Tutorial song.\n3. Press **F5** after an edit to reload Lua in PlayState without restarting.\n\nIf something breaks, Lua errors are written to `logs/lua`. The error window shows the script path, the hook or API involved, and the line number when it has one.\n\n## Where next\n\n- Add a sprite, a tween or a timer: [Examples](#api-examples)\n- Look up a function: [Helper API](#api-helpers) and [Raw bridge API](#api-raw)\n- Run something at an exact beat or step with `song.atBeat` and `song.atStep`\n- Guard your mod against old builds with `LuaSlice.versionAtLeast('0.1.0')`\n"},"tutorials":{"title":"Tutorials","md":"# Tutorials\n\nAdd a character, a stage, and a song with its own week. Every file format and folder below comes from the LuaSlice source and the bundled base-game assets (`assets/gameplay/...`, `assets/ui/story-mode/levels`).\n\n> These tutorials are written from the source, not play-tested in-game yet. If a step doesn't work, check the game's log first, and report it so the page can be corrected.\n\nAll three go inside a mod folder. If you don't have one yet, follow [Your first script](#first-script) steps 1 and 2 to make `mods/my-mod/` with its `_polymod_meta.json`, and enable it in the Mods menu.\n\nThe base game keeps its data under `assets/`, and a mod mirrors that layout. A file at `assets/gameplay/characters/dad/dad.json` is overridden or extended by `mods/my-mod/gameplay/characters/dad/dad.json`. Older mod layouts (`data/characters/<id>.json`, `images/characters/...`) still work. If one mod has both, the `gameplay/` path wins. See [Installing mods](#install).\n\n## How to add a character\n\nA character is a JSON file plus a spritesheet and a health icon, all in one folder named after the character's id.\n\n```\nmods/my-mod/gameplay/characters/my-char/\n my-char.json\n my-char-sheet.png\n my-char-sheet.xml\n icon-my-char.png\n```\n\nThe folder name and the JSON file name must both be the id (`my-char`). The base game uses the same layout, for example `gameplay/characters/spooky/spooky.json`.\n\n### 1. Write the character JSON\n\n```json\n{\n \"version\": \"1.0.0\",\n \"name\": \"My Character\",\n \"assetPath\": \"gameplay/characters/my-char/my-char-sheet\",\n \"singTime\": 8.0,\n \"offsets\": [0, 0],\n \"cameraOffsets\": [0, 0],\n \"animations\": [\n { \"name\": \"idle\", \"prefix\": \"Idle\" },\n { \"name\": \"singLEFT\", \"prefix\": \"Left\" },\n { \"name\": \"singDOWN\", \"prefix\": \"Down\" },\n { \"name\": \"singUP\", \"prefix\": \"Up\" },\n { \"name\": \"singRIGHT\", \"prefix\": \"Right\" }\n ]\n}\n```\n\n- `assetPath` points at the spritesheet without an extension. By default the character is a Sparrow sprite, so the game reads `my-char-sheet.png` and `my-char-sheet.xml` from that path. Other render types exist (the base game's Daddy Dearest uses `\"renderType\": \"animateatlas\"`).\n- `version` must match `1.0.x`, or the character fails to load. `assetPath` is required for the same reason. A missing `name` just falls back to \"Untitled Character\".\n- Each animation's `prefix` is the start of the frame names inside your `.xml` file. `name` is what the game plays: `idle` and the four `sing` animations are the basics.\n\n### 2. Tune the animations\n\nPer animation you can set these, all optional:\n\n| Field | What it does |\n| --- | --- |\n| `offsets` | `[x, y]` shift for that animation, to line up frames |\n| `frameRate` | Defaults to 24 |\n| `looped` | Defaults to false |\n| `frameIndices` | Use only some frames of a prefix, such as `[0, 1, 2, 3]` |\n\nFor a character that alternates two idle poses (like Spooky Kids), use `danceLeft` and `danceRight` built from `frameIndices`, and set `\"startingAnimation\": \"danceRight\"` on the character. `danceEvery` sets how many beats pass between idles (default 1), and `singTime` how long a sing pose is held.\n\n### 3. Add the health icon\n\nSave the icon as `icon-<id>.png` in the same folder (`icon-my-char.png`). The game looks for `gameplay/characters/<id>/icon-<id>`. To reuse another character's icon, set `\"healthIcon\": { \"id\": \"other-char\" }`.\n\n### 4. Put the character in a song\n\nSet the id in the song's metadata (see [How to add a song and week](#tutorials/how-to-add-a-song-and-a-week)):\n\n```json\n\"characters\": { \"player\": \"bf\", \"girlfriend\": \"gf\", \"opponent\": \"my-char\" }\n```\n\nYou can also swap a character mid-song with the **ChangeCharacter** chart event, or with `changeCharacter` from a Lua script. An optional script at `mods/my-mod/scripts/characters/my-char.lua` loads whenever that character becomes active ([script folders](#api-overview)).\n\n### Using the in-game editor instead\n\nThe original wiki steps, kept as they were:\n\n1. Open the game, go to Controls, scroll all the way down, and set a key for the debug menu.\n2. On the main menu, press that key once.\n3. Go to the Animation Editor and press Enter.\n\n*The rest of the editor workflow isn't written up yet.*\n\n## How to add a stage\n\nA stage is a JSON file listing the background pieces (\"props\") and where the three characters stand, plus the images those props use. Put them all in a folder named after the stage id.\n\n```\nmods/my-mod/gameplay/stages/my-stage/\n my-stage.json\n backdrop.png\n```\n\n### 1. Write the stage JSON\n\nThis one is modeled on the base game's `mainStage`, with a single prop:\n\n```json\n{\n \"version\": \"1.0.0\",\n \"name\": \"My Stage\",\n \"cameraZoom\": 1.0,\n \"props\": [\n {\n \"name\": \"backdrop\",\n \"assetPath\": \"gameplay/stages/my-stage/backdrop\",\n \"position\": [-600, -200],\n \"scale\": [1, 1],\n \"scroll\": [0.9, 0.9],\n \"zIndex\": 10,\n \"danceEvery\": 0,\n \"isPixel\": false,\n \"animType\": \"sparrow\",\n \"animations\": []\n }\n ],\n \"characters\": {\n \"bf\": { \"zIndex\": 300, \"position\": [989.5, 885], \"cameraOffsets\": [-100, -100] },\n \"dad\": { \"zIndex\": 200, \"position\": [335, 885], \"cameraOffsets\": [150, -100] },\n \"gf\": { \"zIndex\": 100, \"position\": [751.5, 787], \"cameraOffsets\": [0, 0] }\n }\n}\n```\n\n- `version` must be `1.0.x`. `props` and `characters` are the two big sections.\n- A prop's `assetPath` points at an image without its extension. Plain images work the same way as in `mainStage`: `animType` `sparrow` with an empty `animations` list.\n- `zIndex` is draw order: higher draws in front. In the example, Boyfriend (300) is in front of Daddy Dearest (200), who is in front of Girlfriend (100), and the backdrop (10) is behind all of them. Give a foreground prop a number above 300.\n- `scroll` is the parallax factor. Below 1 moves slower than the camera (far away), above 1 moves faster (a foreground curtain, like `stageCurtains` at 1.3).\n- `position` is where the character stands, `cameraOffsets` nudges the camera when it focuses on them. Start with the numbers above and adjust while previewing.\n\n### 2. Use the stage\n\nSet it in a song's metadata: `\"stage\": \"my-stage\"`. Mid-song, use the **ChangeStage** chart event, or `stage.change('my-stage')` from Lua (check it exists first with `stage.exists('my-stage')`). You can also add `mods/my-mod/stages/my-stage.lua` for stage-only scripting ([script folders](#api-overview)).\n\n*To preview a stage without playing a song, the Test Debug Editor in the Debug Menu can preview stages (see the [engine changelog](#changelog-engine)).*\n\n## How to add a song and a week\n\nThree things make a song playable: the audio and chart files, a levels file that includes it, and, if you want a Story Mode week, the week's title image.\n\n```\nmods/my-mod/\n gameplay/songs/my-song/\n Inst.ogg\n Voices-bf.ogg\n Voices-my-char.ogg\n my-song-metadata.json\n my-song-chart.json\n ui/story-mode/levels/\n my-week.json\n my-week.png\n```\n\n### 1. Audio\n\n`Inst.ogg` is the instrumental. Vocals are named `Voices-<character id>.ogg`, and the ids are listed in the metadata. The base game's Bopeebo has `Voices-bf.ogg` and `Voices-dad.ogg` for exactly this reason.\n\n### 2. Metadata\n\n`my-song-metadata.json` (`<id>-metadata.json`). This is a trimmed copy of Bopeebo's:\n\n```json\n{\n \"version\": \"2.2.4\",\n \"songName\": \"My Song\",\n \"artist\": \"Me\",\n \"charter\": \"Me\",\n \"playData\": {\n \"songVariations\": [],\n \"difficulties\": [\"normal\"],\n \"characters\": {\n \"player\": \"bf\",\n \"girlfriend\": \"gf\",\n \"opponent\": \"my-char\",\n \"playerVocals\": [\"bf\"],\n \"opponentVocals\": [\"my-char\"]\n },\n \"stage\": \"my-stage\",\n \"noteStyle\": \"funkin\",\n \"ratings\": { \"normal\": 1 }\n },\n \"generatedBy\": \"by hand\",\n \"timeChanges\": [{ \"t\": 0, \"b\": 0, \"bpm\": 100, \"bt\": [4, 4, 4, 4] }]\n}\n```\n\nThe `version` needs to be `2.2.x`. Set `bpm` to your song's tempo. Use `\"bopeebo\"`-style ids in lowercase with dashes for the song id.\n\n### 3. Chart\n\n`my-song-chart.json` (`<id>-chart.json`):\n\n```json\n{\n \"version\": \"2.0.0\",\n \"scrollSpeed\": { \"normal\": 1.3 },\n \"events\": [],\n \"notes\": {\n \"normal\": [\n { \"t\": 0, \"d\": 4 },\n { \"t\": 600, \"d\": 5, \"l\": 400 },\n { \"t\": 1200, \"d\": 0 },\n { \"t\": 1800, \"d\": 1 }\n ]\n },\n \"generatedBy\": \"by hand\"\n}\n```\n\n- `t` is the time in milliseconds, `l` is the hold length in milliseconds (omit it for a normal tap).\n- `d` is the lane. `0` to `3` are the player's strumline, `4` to `7` are the opponent's. `d % 4` picks the arrow within a strumline.\n- Each difficulty listed in the metadata needs its own entry under `notes` and `scrollSpeed`.\n\nWriting a whole chart by hand isn't realistic. Use the Chart Editor, which is where the chart events listed on [Chart events](#api-chart-events) live too. This example is only to show the shape of the file.\n\n### 4. Add it to a week\n\nCreate `ui/story-mode/levels/my-week.json`. The file name is the week's id:\n\n```json\n{\n \"version\": \"1.0.0\",\n \"name\": \"MY WEEK\",\n \"titleAsset\": \"ui/story-mode/levels/my-week\",\n \"background\": \"#00FAFF\",\n \"songs\": [\"my-song\"],\n \"props\": []\n}\n```\n\n- `titleAsset` is the week title image without an extension: `ui/story-mode/levels/my-week.png`.\n- `songs` is the list of song ids, played in order.\n- `props` are the characters shown over the colored background in the Story menu. `[]` shows none. The base game's `week1.json` shows how to set them up with sprite sheets from `ui/story-mode/props/`.\n- Set `\"visible\": false` to hide the week from the Story menu.\n\nFreeplay builds its song list by going through the levels, so a song that isn't in any level's `songs` list will not show up, even in Freeplay.\n\n### 5. Run it\n\nEnable the mod, restart the game if it was already running, then pick your week in Story Mode or your song in Freeplay. To add Lua behavior only for this song, save a script at `mods/my-mod/gameplay/songs/my-song/script.lua` ([Your first script](#first-script)).\n"},"api-overview":{"title":"Overview and folders","md":"# LuaSlice Lua API: overview and folders\n\nThe original LuaSlice API for `.lua` and `.luag` scripts. Where scripts live, how they load, and how reload works.\n\n## Current API Audit\n\n- This page is built from `changelogs/LuaSlice Lua API.md` in the LuaSlice source.\n- `LuaScriptManager.hx` has 247 `Lua.register` calls (244 unique names, aliases included), plus the helper layer in `LuaApiPrelude.hx`.\n- Functions removed from the current bridge are not listed here.\n- Compatibility aliases are listed only when the current helper or native bridge still defines them.\n- Use `LuaSlice.api.list()` inside the game to inspect the API available in the running build.\n- Use `LuaSlice.api.find('functionName')` to inspect one function before depending on it.\n- Native file access and native video playback are unavailable on HTML5.\n\n## Script Types\n\n- `.lua`: isolated script environment.\n- `.luag`: global shared script environment.\n- `.luag` is best for shared modules, global toggles, and compatibility helpers.\n- `.ss`: isolated SScript with Haxe-style syntax.\n- `.ssg`: global SScript loaded for every matching state.\n- `.nx`: isolated NxScript bytecode script.\n- `.nxg`: global NxScript loaded for every matching state.\n\nLuaSlice uses the real SScript and NxScript interpreters. AngelScript is not disguised as another language: `.as` and `.asg` are not loaded unless a genuine, cross-platform AngelScript backend is added.\n\n## Main Script Folders\n\nOn Windows and Linux, `mods/` is next to the game executable. On Android, it's under `Android/data/me.luaslice/files/mods/`. These paths are for LuaSlice's own scripts; see [the Psych API guide](#psych-guide) for `.luap` and `.luapg`.\n\n- `mods/global.lua`\n- `mods/global.luag`\n- `mods/scripts/global.lua`\n- `mods/scripts/global.luag`\n- `mods/scripts/*.lua`\n- `mods/scripts/*.luag`\n- `mods/scripts/lua/*.lua`\n- `mods/scripts/luag/*.luag`\n- `mods/scripts/menu/*.lua`\n- `mods/scripts/menu/*.luag`\n- `mods/scripts/options/*.lua`\n- `mods/scripts/options/*.luag`\n- `mods/scripts/pause/*.lua`\n- `mods/scripts/pause/*.luag`\n- `mods/scripts/freeplay/*.lua`\n- `mods/scripts/freeplay/*.luag`\n- `mods/scripts/story/*.lua`\n- `mods/scripts/story/*.luag`\n- `mods/scripts/results/*.lua`\n- `mods/scripts/results/*.luag`\n- `mods/scripts/characters/CharacterId.lua`\n- `mods/scripts/characters/CharacterId.luag`\n- `mods/scripts/song-SongId.lua`\n- `mods/scripts/song-SongId.luag`\n- `mods/scripts/stage-StageId.lua`\n- `mods/scripts/stages/StageId.lua`\n- `mods/<mod name>/scripts/*.lua`\n- `mods/<mod name>/scripts/*.luag`\n- `mods/<mod name>/scripts/lua/*.lua`\n- `mods/<mod name>/scripts/luag/*.luag`\n- `mods/<mod name>/scripts/menu/*.lua`\n- `mods/<mod name>/scripts/options/*.luag`\n- `mods/<mod name>/scripts/pause/*.luag`\n- `mods/<mod name>/songs/SongId/script.lua`\n- `mods/<mod name>/songs/SongId/script.luag`\n- `mods/<mod name>/data/songs/SongId/script.lua`\n- `mods/<mod name>/data/songs/SongId/script.luag`\n- `mods/<mod name>/gameplay/songs/SongId/script.lua`\n- `mods/<mod name>/gameplay/songs/SongId/script.luag`\n- `mods/<mod name>/scripts/songs/SongId/script.lua`\n- `mods/<mod name>/scripts/states/StateClass.lua`\n- `mods/<mod name>/scripts/states/StateClass.luag`\n- `mods/<mod name>/stages/StageId.lua`\n\nFor gameplay, use `mods/<mod name>/gameplay/songs/<songId>/` and enable the mod. The older `songs/<songId>/`, `data/songs/<songId>/` and `scripts/songs/<songId>/` locations also work. Matching filenames load once: mod priority comes first, then the Preview 4 folder within the same mod. The folder limits when the script runs; the extension controls its Lua environment. A `.luag` inside a song folder still only loads for that song.\n\nIndependent mods each keep their generic global scripts. Inside one mod, `scripts/global.lua` takes precedence over the legacy root `global.lua` alias; the same applies to `.luag`. Character-prefixed scripts only run for that character, not as generic globals.\n\nMenu and class-scoped state scripts also run for each enabled mod, in mod order. Within one mod, the canonical class path wins over its legacy aliases. A disabled mod named `scripts` is not treated as the loose `mods/scripts` directory.\n\nShared `.luag` helpers are also discovered outside songs. Files in `scripts/menu`, `scripts/options`, `scripts/freeplay`, `scripts/story` and `scripts/results` belong to those screens. Class scripts use `scripts/states/<ClassName>.lua` or `.luag`; `PlayState` scripts use the gameplay manager, not a second menu manager.\n\n`onCreatePost` runs after the screen is created. Use it when accessing built-in menu items. Lua-created sprites, text and menus belong to the screen that loaded the script and are removed with it. Shared variables belong to that manager's lifetime; changing screens creates a new environment rather than preserving arbitrary Lua globals forever.\n\n### SScript And NxScript Folders\n\n- `mods/global.ssg` and `mods/global.nxg`\n- `mods/scripts/global.ssg` and `mods/scripts/global.nxg`\n- Global `.ssg` and `.nxg` files anywhere below `mods/scripts`\n- `mods/StateClass.ss` and `mods/StateClass.nx`\n- `mods/scripts/StateClass.ss` and `mods/scripts/StateClass.nx`\n- `mods/scripts/states/StateClass.ss` and `mods/scripts/states/StateClass.nx`\n- `mods/SongId.ss` and `mods/SongId.nx`\n- `mods/scripts/songs/SongId.ss` and `mods/scripts/songs/SongId.nx`\n- Local `.ss` and `.nx` files below `mods/scripts/gameplay` in PlayState\n- The same paths inside every enabled mod folder\n\nSScript and NxScript receive `state`, `game`, and `playState`, plus `FlxG`, `Paths`, `Preferences`, `Conductor`, `Save`, and `Json`. Supported hooks include `onCreate`, `onUpdate`, `onFocusGained`, `onFocusLost`, `onStepHit`, `onBeatHit`, and `onDestroy`.\n\n## Script Folder Rules\n\n- `scripts/lua` loads `.lua` only.\n- `scripts/luag` loads `.luag` only.\n- `scripts/menu` loads in the Main Menu.\n- `scripts/options` loads in Options.\n- `scripts/pause` loads in PlayState and can configure the pause menu.\n- `scripts/freeplay`, `scripts/story`, and `scripts/results` load for their matching screens.\n- `scripts/characters/CharacterId` loads when that Player, Opponent, or Girlfriend becomes active.\n- Chart Editor Playtest's `Enable Song Scripts` controls song-scoped `.hxc` and `.luag` scripts, not `.lua` scripts.\n- PlayState also scans `modules`, `module`, `ui`, `UI`, `gameplay`, `opponent`, `player`, `songs`, `stages`, `characters`, `events`, `notekinds`, `players`, `shaders`, `dialogue`, and `levels` under each scripts folder.\n\n## Require Paths\n\n- `mods/?.lua`\n- `mods/?.luag`\n- `mods/?/init.lua`\n- `mods/?/init.luag`\n- `mods/scripts/?.lua`\n- `mods/scripts/?.luag`\n- `mods/scripts/?/init.lua`\n- `mods/scripts/?/init.luag`\n- `mods/<mod name>/?.lua`\n- `mods/<mod name>/?.luag`\n- `mods/<mod name>/?/init.lua`\n- `mods/<mod name>/?/init.luag`\n- `mods/<mod name>/script/?.lua`\n- `mods/<mod name>/script/?.luag`\n- `mods/<mod name>/scripts/?.lua`\n- `mods/<mod name>/scripts/?.luag`\n\n## Hot Reload\n\n- `F5` reloads Lua in PlayState.\n- `reloadLuaScripts()` requests the same reload from Lua.\n- `onReload()` runs after reload.\n- Lua-created sprites, text, sounds, tweens, timers, menus, shaders, and registered objects are cleaned before reload.\n"},"api-hooks":{"title":"Hooks and globals","md":"# LuaSlice Lua API: hooks and globals\n\nFunctions the game calls in your script, and the variables it sets for you.\n\n## Globals\n\n- `luaSupportVersion`\n- `luaScriptCount`\n- `luaGlobalScriptCount`\n- `luaIsolatedScriptCount`\n- `songName`\n- `songId`\n- `difficultyName`\n- `variationName`\n- `stageId`\n- `curBeat`\n- `curStep`\n- `songPosition`\n- `health`\n- `score`\n- `combo`\n- `botPlay`\n- `practice`\n\n## Hooks\n\n- Lifecycle: `onCreate`, `onReload`, `onUpdate`, `onDestroy`, `onAdded`\n- Timing: `onStepHit`, `onBeatHit`, `onSectionHit`\n- Song: `onSongLoaded`, `onCountdownStart`, `onCountdownStep`, `onCountdownEnd`, `onSongStart`, `onSongEnd`, `onSongRetry`\n- Notes: `onNoteIncoming`, `onNoteHit`, `onNoteMiss`, `onNoteHoldDrop`, `onGhostMiss`, `onNoteGhostMiss`\n- Events: `onEvent`, `onCreateEvent`, `onUpdateEvent`, `onDestroyEvent`, `onSongEvent`\n- State: `onStateCreate`, `onStateChangeBegin`, `onStateChangeEnd`, `onSubStateOpenBegin`, `onSubStateOpenEnd`, `onSubStateCloseBegin`, `onSubStateCloseEnd`\n- Gameplay: `onPause`, `onResume`, `onGameOver`\n- Input: `onKeyDown`, `onKeyUp`, `onFocusGained`, `onFocusLost`\n- Dialogue: `onDialogueStart`, `onDialogueLine`, `onDialogueCompleteLine`, `onDialogueSkip`, `onDialogueEnd`\n- Completion: `onTweenCompleted`, `onTimerCompleted`\n- Menus: `onLuaMenuChange`, `onLuaMenuAccept`, `onLuaMenuCancel`, `onLuaMainMenuAccept`, `onPauseMenuCreate`, `onLuaPauseMenuAccept`, `onLuaOptionChanged`\n- Screens: `onFreeplayCreate`, `onFreeplayUpdate`, `onFreeplayClose`, `onStoryCreate`, `onStoryUpdate`, `onStoryClose`, `onResultsCreate`, `onResultsUpdate`, `onResultsClose`\n"},"api-helpers":{"title":"Helper API","md":"# LuaSlice Lua API: helper API\n\nThe namespaced helpers (`sprite`, `tween`, `camera`, `shader` and friends).\n\n## New Helper API\n\n### Docs\n- `LuaSlice.version`\n- `LuaSlice.versionAtLeast(version)`\n- `requiresLuaSlice(version)`\n- `LuaSlice.api.list(category?)`\n- `LuaSlice.api.find(name)`\n- `LuaSlice.api.docs()`\n- `LuaSlice.api.writeDocs(path?)`\n\n### Debug\n- `debug.print(message)`\n- `debug.info(message)`\n- `debug.warn(message)`\n- `debug.error(message)`\n\n### Properties\n- `property.get(path)`\n- `property.set(path, value)`\n- `property.setMany(target, values)`\n- `property.ref(path)`\n\n### Window\n- `window.setTitle(title)`\n\n### Sprites\n- `sprite.create(tag, data, x?, y?)`\n- `sprite.add(tag, options?)`\n- `sprite.remove(tag)`\n- `sprite.exists(tag)`\n- `sprite.set(tag, values)`\n- `sprite.setAlpha(tag, value)`\n- `sprite.setCamera(tag, camera)`\n- `sprite.setLayer(tag, layer)`\n\nNamed layers:\n- `background`\n- `stage`\n- `characters`\n- `foreground`\n- `hud`\n- `top`\n\n### Groups\n- `group.create(name)`\n- `group.add(name, tag)`\n- `group.each(name, callback)`\n- `group.set(name, values)`\n- `group.setAlpha(name, alpha)`\n- `group.setLayer(name, layer)`\n- `group.tween(name, values, duration, options?)`\n- `group.remove(name, tag?)`\n\n### Camera\n- `camera.setZoom(cameraName, zoom)`\n- `camera.flash(cameraName, color, duration)`\n- `camera.shake(cameraName, intensity, duration)`\n- `camera.tween(cameraName, values, duration, ease?)`\n\n### Characters And Stages\n- `character.exists(target)`\n- `character.playAnim(target, animation, force?, reversed?, frame?)`\n- `stage.exists(id)`\n- `stage.change(id)`\n- `option.exists(key)`\n\n### Shaders\n- `shader.init(name, tag?)`\n- `shader.make(tag, path, vertex?)`\n- `shader.apply(target, tag)`\n- `shader.remove(target)`\n- `shader.exists(tag)`\n- `shader.setColor(tag, property, color)`\n- `shader.tween(tag, property, from, to, duration, ease?, tweenTag?)`\n- `initLuaShader(name, tag?)`\n- `makeLuaShader(tag, pathOrSource?, vertexPathOrSource?)`\n- `setLuaShader(tag, target)`\n- `setShaderOnSprite(sprite, tag)`\n- `removeLuaShader(target)`\n- `setLuaCameraShader(tag, camera?)`\n- `removeLuaCameraShader(camera?)`\n- `setLuaShaderFloatSimple(tag, name, value)`\n- `setShaderColor(tag, property, color)`\n\nNamed stage objects can be targeted with `object:<name>`, for example `setShaderOnSprite(\"object:streetLamp\", \"rim\")`. `DropShadowShader` supports `color`, `angle`, `distance`, `strength`, `threshold`, `antialiasAmt`, `baseHue`, `baseSaturation`, `baseBrightness`, `baseContrast`, and `maskThreshold`.\n\n### Save\n- `save.get(key, fallback?)`\n- `save.set(key, value)`\n- `save.flush()`\n- `getLuaSave(key, fallback?)`\n- `setLuaSave(key, value)`\n- `flushSave()`\n\n### Sound\n- `sound.play(tag, key, volume?, looped?)`\n- `sound.stop(tag)`\n- `sound.exists(tag)`\n\n### Scripts\n- `script.disableHook(name)`\n- `script.enableHook(name)`\n- `script.getName()`\n- `script.getPath()`\n- `script.reload()`\n- `script.stop()`\n- `script.setPriority(priority)`\n- `disableLuaHook(name)`\n- `enableLuaHook(name)`\n\n### Tweens And Timers\n- `tween.to(target, values, duration, options?)`\n- `tween.cancel(tag)`\n- `tween.pause(tag)`\n- `tween.resume(tag)`\n- `timer.after(delay, callback)`\n- `timer.every(delay, callback)`\n\n### Song Events\n- `song.getPosition()`\n- `song.atBeat(beat, callback)`\n- `song.atStep(step, callback)`\n- `song.betweenBeats(firstBeat, lastBeat, callback)`\n- `event.on(name, callback)`\n- `event.once(name, callback)`\n- `event.once(name, value, callback)`\n\n### Options Schema\n- `options.page(id, config)`\n\nThe config accepts `name`, `position`, and an `items` array containing `checkbox`, `number`, or `enum` entries. The older simple option helpers remain supported.\n\n### Menus\n- `addLuaMainMenu(id, position, target, assetPath?, animName?)`\n- `makeLuaMenuSimple(id, items, x?, y?, spacing?)`\n- `makeLuaImageMenuSimple(id, items, x?, y?, spacing?)`\n"},"api-raw":{"title":"Raw bridge API","md":"# LuaSlice Lua API: raw bridge\n\nThe flat functions registered by the native bridge, plus compatibility aliases.\n\n## Raw Bridge API\n\n### Core\n- `debugPrint(message)`\n- `luaTrace(message)`\n- `debugInfo(message)`\n- `debugWarn(message)`\n- `debugError(message)`\n- `reloadLuaScripts()`\n- `setLuaWindowTitle(title)`\n- `getCurrentLuaScriptPath()`\n- `stopCurrentLuaScript()`\n- `setCurrentLuaScriptPriority(priority)`\n- `jsonParse(text)`\n- `jsonStringify(value, indentation?)`\n- `fileExists(path)`\n- `directoryExists(path)`\n- `readTextFile(path)`\n- `writeTextFile(path, text)`\n- `randomFloat(min?, max?)`\n- `randomInt(min?, max?)`\n- `openLuaState(target, args?)`\n- `openLuaSubState(target, args?)`\n\n### Event Control\n- `getCurrentEvent()`\n- `getEventField(path)`\n- `setEventField(path, value)`\n- `cancelEvent()`\n- `stopEventPropagation()`\n\n### Reflection And Objects\n- `getProperty`\n- `setProperty`\n- `setProperties`\n- `getPropertyRef`\n- `setPropertyRef`\n- `objectExists`\n- `getObjectProperty`\n- `setObjectProperty`\n- `callMethod`\n- `classExists`\n- `getStaticProperty`\n- `setStaticProperty`\n- `callStatic`\n- `createInstance`\n- `storeObject`\n- `forgetObject`\n- `addObjectToState`\n- `removeObjectFromState`\n- `destroyObject`\n- `getArrayLength`\n- `getArrayItem`\n- `setArrayItem`\n\n### Input\n- `keyPressed(key)`\n- `keyJustPressed(key)`\n- `keyJustReleased(key)`\n- `mouseX()`\n- `mouseY()`\n- `mousePressed()`\n- `mouseJustPressed()`\n- `mouseJustReleased()`\n\n### Song And PlayState\n- `getSongPosition`\n- `getBeat`\n- `getStep`\n- `getSongName`\n- `getDifficulty`\n- `getVariation`\n- `getStageId`\n- `changeStage`\n- `changeCharacter`\n- `getPlaybackRate`\n- `setPlaybackRate`\n- `getScrollSpeed`\n- `setScrollSpeed`\n- `getChartNotes`\n- `getChartEvents`\n- `setBotplay`\n- `setPracticeMode`\n- `getPreference`\n- `setPreference`\n- `getHealth`\n- `setHealth`\n- `addHealth`\n- `getScore`\n- `setScore`\n- `addScore`\n- `getCombo`\n- `setCombo`\n- `getAccuracy`\n- `getTallies`\n- `setVocalsVolume`\n- `startCountdown`\n- `startConversation`\n- `endSong`\n- `restartSong`\n\n### Strumlines\n- `setStrumlinePosition(target, x, y)`\n- `setStrumlineAlpha(target, alpha)`\n- `setStrumlineVisible(target, visible)`\n- `setStrumlineNotePosition(target, direction, x, y)`\n- `playStrumlineAnimation(target, direction, animation)`\n\nStrumline targets are `player`, `opponent`, or `dad`. Directions use `0` through `3`. Animation names are `static`, `press`, `confirm`, `holdConfirm`, or `splash`.\n\n### Screen\n- `getScreenWidth`\n- `getScreenHeight`\n- `setFullscreen`\n- `getMemoryUsageMB`\n- `getDebugDisplayVisible`\n- `setDebugDisplayVisible`\n\n### Sprites And Text\n- `addSprite(tag, asset, x?, y?, camera?, zIndex?, animated?)`\n- `loadGraphic`\n- `loadSparrow`\n- `makeSolidSprite(tag, x?, y?, width?, height?, color?, camera?, zIndex?)`\n- `removeSprite`\n- `setSpriteCamera`\n- `addText`\n- `setText`\n- `setTextFormat`\n- `removeText`\n- `setObjectCamera`\n- `setObjectPosition`\n- `getObjectX`\n- `getObjectY`\n- `getObjectWidth`\n- `getObjectHeight`\n- `getObjectAlpha`\n- `getObjectVisible`\n- `getObjectAngle`\n- `setObjectScale`\n- `setObjectSize`\n- `setObjectAlpha`\n- `setObjectVisible`\n- `setObjectAngle`\n- `setObjectColor`\n- `setObjectVelocity`\n- `setObjectAcceleration`\n- `setObjectScrollFactor`\n- `setObjectZIndex`\n- `screenCenter`\n- `killObject`\n- `reviveObject`\n- `addAnimByPrefix`\n- `playAnim`\n- `hasAnim`\n\n### Lua Options\n- `defineLuaOption`\n- `getLuaOption`\n- `setLuaOption`\n- `hasLuaOption`\n- `luaStageExists`\n- `removeLuaOption`\n- `getLuaOptions`\n- `createLuaOptionPage`\n- `addLuaCheckbox`\n- `addLuaNumber`\n- `addLuaEnum`\n\n### Lua Menus And Pause\n- `createLuaMenu`\n- `createLuaImageMenu`\n- `addLuaMainMenuItem`\n- `configureLuaPauseMenu`\n- `setLuaPauseOptions`\n- `setLuaPauseOptionsBehavior`\n- `setLuaPauseMenuItem`\n- `setLuaMenuItems`\n- `setLuaMenuPosition`\n- `showLuaMenu`\n- `hideLuaMenu`\n- `removeLuaMenu`\n- `getLuaMenuSelected`\n\nPause item targets include `resume`, `restartSong`, `changeDifficulty`, `practiceMode`, `exitToMenu`, `options`, `callback`, and custom `.hx` or `.hxc` state classes. Pause-opened Options behavior can be configured with `hideExit` and `howExit`.\n\n### Shader Bridge\n- `initLuaShaderRaw`\n- `initLuaShader`\n- `makeLuaShader`\n- `setLuaShader`\n- `setShaderOnSprite`\n- `createShader`\n- `destroyShader`\n- `luaShaderExists`\n- `setShaderFloat`\n- `setShaderFloatArray`\n- `setShaderInt`\n- `setShaderBool`\n- `setShaderColor`\n- `tweenShaderFloat`\n- `applyShader`\n- `clearShader`\n- `applyCameraShader`\n- `clearCameraShader`\n\n### Audio And Video\n- `playSound`\n- `stopSound`\n- `pauseSound`\n- `resumeSound`\n- `setSoundVolume`\n- `soundExists`\n- `playMusic`\n- `stopMusic`\n- `pauseMusic`\n- `resumeMusic`\n- `setMusicVolume`\n- `playVideo`\n- `pauseVideo`\n- `resumeVideo`\n- `finishVideo`\n- `isVideoPlaying`\n\n### Raw Tweens And Timers\n- `tween`\n- `cancelTween`\n- `pauseTween`\n- `resumeTween`\n- `runTimer`\n- `cancelTimer`\n\n### Cameras\n- `setCamZoom`\n- `cameraFlash`\n- `cameraFade`\n- `cameraShake`\n- `setCameraZoom`\n- `setCameraAlpha`\n- `setCameraBgColor`\n- `setCameraVisible`\n- `setCameraPosition`\n- `setCameraFollow`\n- `setCameraBop`\n- `setHealthBarColors`\n- `resetCamera`\n- `tweenCameraZoom`\n- `tweenCameraToPosition`\n- `cancelCameraTweens`\n- `tweenScrollSpeed`\n- `cancelScrollSpeedTweens`\n\n### Paths\n- `pathImage`\n- `pathSound`\n- `pathMusic`\n- `pathFont`\n- `pathFile`\n- `pathJson`\n\n### Compatibility Aliases\n- `makeLuaSprite`\n- `makeAnimatedLuaSprite`\n- `makeGraphic`\n- `addLuaSprite`\n- `removeLuaSprite`\n- `makeLuaText`\n- `setTextString`\n- `removeLuaText`\n- `doTween`\n- `doTweenX`\n- `doTweenY`\n- `doTweenAlpha`\n- `doTweenAngle`\n- `runTimer`\n- `cancelTimer`\n\nLuaSlice warns once when some old aliases are used, then keeps the script running.\n"},"api-examples":{"title":"Examples","md":"# LuaSlice Lua API: examples\n\nCopy these into a `.lua` or `.luag` file. Asset keys omit the file extension unless the example says otherwise.\n\n## Script Examples\n\n### Small Lua Song Script\n\nTo run a script only during Tutorial, place it at `mods/<mod name>/data/songs/tutorial/script.lua` in an enabled mod. Use the song's chart ID for the folder name.\n\n```lua\nfunction onCreate()\n debug.info('Loaded ' .. songName)\n window.setTitle('LuaSlice - ' .. songName)\nend\n\nfunction onBeatHit(beat)\n if beat % 4 == 0 then camera.setZoom('game', 1.03) end\nend\n```\n\n### Lua Sprite\n\n```lua\nfunction onCreate()\n sprite.create('backdrop', 'my-mod/images/backdrop', -100, -50)\n sprite.set('backdrop', { alpha = 0.8, scale = 1.2 })\n sprite.setLayer('backdrop', 'background')\nend\n```\n\n### Lua Timer And Tween\n\n```lua\nfunction onSongStart()\n timer.after(1, function()\n tween.to('camHUD', { alpha = 0.5 }, 0.4, {\n tag = 'hudFade',\n ease = 'quadOut'\n })\n end)\nend\n```\n\n### Lua Save Value\n\n```lua\nfunction onCreate()\n local visits = save.get('visits', 0)\n save.set('visits', visits + 1)\n save.flush()\nend\n```\n\n### Lua Note Kind\n\n```lua\nfunction onNoteHit(event)\n if event.note == nil then return end\n if event.note.kind == 'Heal Note' then addHealth(0.08) end\nend\n\nfunction onNoteMiss(event)\n if event.note == nil then return end\n if event.note.kind == 'Heal Note' then addHealth(-0.12) end\nend\n```\n\n### SScript State Script\n\n```haxe\nfunction onCreate():Void\n{\n trace('LuaSlice state script loaded');\n}\n\nfunction onBeatHit(beat:Int):Void\n{\n if (beat % 4 == 0 && playState != null) playState.camGame.zoom = 1.03;\n}\n```\n\n### NxScript State Script\n\n```nx\nfunc onCreate() {\n trace(\"NxScript state loaded\")\n}\n\nfunc onBeatHit(beat) {\n if (beat % 4 == 0 && playState) playState.camGame.zoom = 1.03\n}\n```\n\n## Advanced Script Examples\n\n### Lua Custom Options Page\n\n```lua\nfunction onCreate()\n options.page('visualOptions', {\n name = 'Visual Options',\n position = 2,\n items = {\n { type = 'checkbox', key = 'particles', name = 'Particles', default = true },\n { type = 'number', key = 'particleCount', name = 'Particle Count', min = 0, max = 100, step = 5, default = 40 },\n { type = 'enum', key = 'color', name = 'Color', values = { 'Pink', 'Blue', 'Green' }, default = 'Pink' }\n }\n })\nend\n```\n\n### Lua Menu\n\n```lua\nfunction onCreate()\n makeLuaMenuSimple('creditsMenu', { 'About', 'Back' }, 80, 120, 44)\nend\n\nfunction onLuaMenuAccept(menuId, index, label)\n if menuId ~= 'creditsMenu' then return end\n if label == 'About' then debug.info('This menu was created from Lua.') end\n if label == 'Back' then removeLuaMenu('creditsMenu') end\nend\n```\n\n### Lua Animated Stage Object\n\n```lua\nfunction onCreate()\n loadSparrow('dancer', 'my-mod/images/dancer', 500, 250)\n addAnimByPrefix('dancer', 'idle', 'Dancer Idle', 24, true)\n addAnimByPrefix('dancer', 'hey', 'Dancer Hey', 24, false)\n setObjectZIndex('dancer', LuaSlice.layers.characters)\n playAnim('dancer', 'idle', true)\nend\n\nfunction onBeatHit(beat)\n if beat % 8 == 0 then playAnim('dancer', 'hey', true) end\nend\n```\n\n### Lua Camera Shader With Cleanup\n\n```lua\nfunction onCreate()\n if not shader.make('gray', 'my-mod/shaders/grayscale.frag') then return end\n setShaderFloat('gray', 'amount', 0)\n setLuaCameraShader('gray', 'game')\nend\n\nfunction onSongStart()\n shader.tween('gray', 'amount', 0, 1, 1, 'quadInOut', 'grayAmount')\nend\n\nfunction onDestroy()\n removeLuaCameraShader('game')\n destroyShader('gray')\nend\n```\n\n### Lua Group Of Objects\n\n```lua\nfunction onCreate()\n group.create('lights')\n for i = 1, 4 do\n local tag = 'light' .. i\n sprite.create(tag, 'my-mod/images/light', 160 * i, 100)\n group.add('lights', tag)\n end\n group.setAlpha('lights', 0.6)\nend\n\nfunction onSongStart()\n group.tween('lights', { alpha = 1 }, 0.5, { ease = 'quadOut', tag = 'lightsIn' })\nend\n```\n\n## Additional Lua Examples\n\nThese examples can be copied into a `.lua` or `.luag` file. Asset keys omit the file extension unless the example says otherwise.\n\n### Basic Song Script\n\n```lua\nfunction onCreate()\n debug.info('Loaded ' .. songName .. ' on ' .. difficultyName)\n window.setTitle('LuaSlice - ' .. songName)\nend\n\nfunction onBeatHit(beat)\n if beat % 4 == 0 then\n camera.setZoom('game', 1.03)\n end\nend\n```\n\n### Create And Configure A Sprite\n\n```lua\nfunction onCreate()\n sprite.create('myBackdrop', {\n image = 'my-mod/images/backdrop',\n x = -100,\n y = -50,\n alpha = 0.8,\n scale = 1.2,\n camera = 'game',\n layer = 'background'\n })\n\n setObjectScrollFactor('myBackdrop', 0.4, 0.4)\nend\n```\n\n### Animated Sparrow Sprite\n\n```lua\nfunction onCreate()\n loadSparrow('dancer', 'my-mod/images/dancer', 500, 250)\n addAnimByPrefix('dancer', 'idle', 'Dancer Idle', 24, true)\n addAnimByPrefix('dancer', 'hey', 'Dancer Hey', 24, false)\n setObjectZIndex('dancer', LuaSlice.layers.characters)\n playAnim('dancer', 'idle', true)\nend\n\nfunction onBeatHit(beat)\n if beat % 8 == 0 then playAnim('dancer', 'hey', true) end\nend\n```\n\n### Groups\n\n```lua\nfunction onCreate()\n group.create('lights')\n for i = 1, 4 do\n local tag = 'light' .. i\n sprite.create(tag, 'my-mod/images/light', 160 * i, 100)\n group.add('lights', tag)\n end\n group.each('lights', function(tag)\n sprite.setCamera(tag, 'hud')\n end)\n group.setAlpha('lights', 0.6)\nend\n\nfunction onSongStart()\n group.tween('lights', { alpha = 1 }, 0.5, {\n ease = 'quadOut',\n tag = 'lightsIn'\n })\nend\n```\n\n### Tweens With Completion Callbacks\n\n```lua\nfunction onCreate()\n sprite.create('logo', 'my-mod/images/logo', 100, 100)\n tween.to('logo', { x = 900, angle = 360 }, 2, {\n tag = 'logoMove',\n ease = 'cubeInOut',\n onComplete = function(tag)\n debug.info(tag .. ' finished')\n tween.to('logo', { alpha = 0 }, 0.4, { tag = 'logoFade' })\n end\n })\nend\n```\n\n### Timers\n\n```lua\nfunction onSongStart()\n timer.after(1, function()\n camera.flash('hud', '#FFFFFF', 0.25)\n end)\n\n local flashes = 0\n timer.every(0.5, function(loopsLeft)\n flashes = flashes + 1\n debug.print('Timer tick ' .. flashes)\n end)\nend\n```\n\n### Beat And Step Scheduling\n\n```lua\nfunction onCreate()\n song.atBeat(16, function()\n camera.shake('game', 0.01, 0.3)\n end)\n\n song.atStep(128, function()\n setHealth(1.5)\n end)\n\n song.betweenBeats(32, 48, function(beat)\n if beat % 2 == 0 then addScore(100) end\n end)\nend\n```\n\n### Named Events\n\n```lua\nfunction onCreate()\n event.on('songStart', function()\n debug.info('The song started')\n end)\n\n event.once('beat', 64, function(beat)\n camera.flash('game', '#FF66CC', 0.5)\n end)\n\n event.on('update', function(elapsed)\n -- Keep update callbacks short because they run every frame.\n end)\nend\n```\n\n### Save Data\n\n```lua\nlocal wins = 0\n\nfunction onCreate()\n wins = save.get('exampleWins', 0)\nend\n\nfunction onSongEnd()\n wins = wins + 1\n save.set('exampleWins', wins)\n save.flush()\nend\n```\n\n### Custom Options Page\n\n```lua\nfunction onCreate()\n options.page('exampleOptions', {\n name = 'Example Mod',\n position = 2,\n items = {\n {\n type = 'checkbox',\n key = 'showParticles',\n name = 'Particles',\n description = 'Show the example particles.',\n default = true\n },\n {\n type = 'number',\n key = 'particleAmount',\n name = 'Particle Amount',\n min = 0,\n max = 100,\n step = 5,\n default = 50\n },\n {\n type = 'enum',\n key = 'particleColor',\n name = 'Particle Color',\n values = { 'Pink', 'Blue', 'Green' },\n default = 'Pink'\n }\n }\n })\nend\n```\n\n### Character And Stage Control\n\n```lua\nfunction onBeatHit(beat)\n if beat == 32 and character.exists('dad') then\n character.playAnim('dad', 'hey', true)\n end\n\n if beat == 64 and stage.exists('spookyMansion') then\n stage.change('spookyMansion')\n end\nend\n```\n\n### Fragment Shader On A Camera\n\n```lua\nfunction onCreate()\n if shader.make('gray', 'assets/preload/shaders/grayscale.frag') then\n setShaderFloat('gray', 'amount', 0)\n setLuaCameraShader('gray', 'game')\n end\nend\n\nfunction onSongStart()\n shader.tween('gray', 'amount', 0, 1, 1, 'quadInOut', 'grayAmount')\nend\n\nfunction onDestroy()\n removeLuaCameraShader('game')\n destroyShader('gray')\nend\n```\n\n### Shader On A Stage Object\n\n```lua\nfunction onCreate()\n if shader.init('rim-light', 'rim') then\n shader.apply('object:streetLamp', 'rim')\n setShaderColor('rim', 'color', '#77CCFF')\n end\nend\n```\n\n### Sound Control\n\n```lua\nfunction onCreate()\n sound.play('rainLoop', 'my-mod/sounds/rain', 0.4, true)\nend\n\nfunction onPause()\n pauseSound('rainLoop')\nend\n\nfunction onResume()\n resumeSound('rainLoop')\nend\n\nfunction onDestroy()\n sound.stop('rainLoop')\nend\n```\n\n### Safe Property Access\n\n```lua\nfunction onCreate()\n local hudAlpha = property.get('camHUD.alpha')\n debug.print('HUD alpha: ' .. tostring(hudAlpha))\n\n property.set('camHUD.alpha', 0.75)\n property.setMany('camGame', {\n zoom = 1.05,\n alpha = 1\n })\nend\n```\n\n### Global `.luag` Helper\n\n```lua\n-- Put this in mods/scripts/luag/helpers.luag.\nfunction pulseCamera(cameraName, amount, duration)\n cameraName = cameraName or 'game'\n amount = amount or 1.05\n duration = duration or 0.25\n camera.tween(cameraName, { zoom = amount }, duration, 'quadOut')\nend\n```\n\n```lua\n-- Any later Lua script can call the global helper.\nfunction onBeatHit(beat)\n if beat % 4 == 0 then pulseCamera('game', 1.04, 0.2) end\nend\n```\n\n### Version Guard And Error Handling\n\n```lua\nfunction onCreate()\n if not LuaSlice.versionAtLeast('0.1.0') then\n debug.error('This mod needs LuaSlice v0.1.0 or newer.')\n script.stop()\n return\n end\n\n local ok, message = pcall(function()\n sprite.create('safeSprite', 'my-mod/images/safe-sprite', 0, 0)\n end)\n if not ok then debug.error(message) end\nend\n```\n\n### Solid Color Sprite Without A Flash\n\n`makeSolidSprite` creates the graphic immediately. It does not run a camera flash.\n\n```lua\nfunction onCreate()\n makeSolidSprite('redPanel', 40, 40, 320, 120, '#D92B3A', 'hud', 100)\n setObjectAlpha('redPanel', 0.8)\nend\n\nfunction onDestroy()\n removeSprite('redPanel')\nend\n```\n\n### Lua Note Type Behavior\n\nPlace the script in a loaded Lua script folder and filter the note payload by `kind`. This example makes a `Heal Note` restore health without adding any screen flash.\n\n```lua\nlocal healAmount = 0.08\n\nfunction onNoteHit(event)\n if event.note == nil then return end\n if event.note.kind ~= 'Heal Note' then return end\n addHealth(healAmount)\nend\n\nfunction onNoteMiss(event)\n if event.note == nil then return end\n if event.note.kind ~= 'Heal Note' then return end\n addHealth(-0.12)\nend\n```\n\nThe note payload can contain `strumTime`, `direction`, `noteData`, and `kind`. Check for `nil` because ghost misses do not always contain a normal note.\n\n### Read The Current Note Event\n\n```lua\nfunction onNoteIncoming(event)\n local current = getCurrentEvent()\n if current == nil or current.note == nil then return end\n\n debug.info('Incoming direction: ' .. tostring(current.note.direction))\n debug.info('Incoming kind: ' .. tostring(current.note.kind))\nend\n```\n\n### Keyboard And Mouse Input\n\n```lua\nfunction onUpdate(elapsed)\n if keyJustPressed('F6') then\n setDebugDisplayVisible(not getDebugDisplayVisible())\n end\n\n if mouseJustPressed() then\n debug.print('Mouse: ' .. mouseX() .. ', ' .. mouseY())\n end\nend\n```\n\n### Health, Score, Combo, And Accuracy\n\n```lua\nfunction onBeatHit(beat)\n if beat % 8 ~= 0 then return end\n\n local tallies = getTallies()\n debug.print('Health: ' .. tostring(getHealth()))\n debug.print('Score: ' .. tostring(getScore()))\n debug.print('Combo: ' .. tostring(getCombo()))\n debug.print('Accuracy: ' .. tostring(getAccuracy()))\n debug.print('Sicks: ' .. tostring(tallies.sick))\nend\n```\n\n### Position And Animate A Strumline\n\n```lua\nfunction onCreate()\n setStrumlinePosition('player', 420, 80)\n setStrumlineAlpha('opponent', 0.9)\n setStrumlineVisible('player', true)\nend\n\nfunction onStepHit(step)\n if step % 16 == 0 then\n playStrumlineAnimation('player', 0, 'confirm')\n end\nend\n```\n\n### Read Chart Notes And Events\n\n```lua\nfunction onSongLoaded()\n local notes = getChartNotes()\n local events = getChartEvents()\n debug.info('Chart notes: ' .. tostring(#notes))\n debug.info('Chart events: ' .. tostring(#events))\nend\n```\n\n### Camera Controls\n\n```lua\nfunction onSongStart()\n cameraFlash('hud', '#FFFFFF', 0.25)\n cameraShake('game', 0.006, 0.2)\n tweenCameraZoom(1.08, 0.35, false, 'quadOut')\nend\n\nfunction onDestroy()\n cancelCameraTweens()\n resetCamera(true, true, true)\nend\n```\n\n### JSON And Text Files\n\n```lua\nfunction onCreate()\n local data = {\n enabled = true,\n amount = 3,\n label = 'LuaSlice'\n }\n\n local encoded = jsonStringify(data, ' ')\n local ok = writeTextFile('mods/my-mod/lua-example.json', encoded)\n if not ok then return end\n\n local text = readTextFile('mods/my-mod/lua-example.json')\n local decoded = jsonParse(text)\n debug.print(decoded.label)\nend\n```\n\nFile paths are native filesystem paths. Keep writes inside your mod folder and check the returned value.\n\n### Script Priority And Hook Control\n\n```lua\nfunction onCreate()\n script.setPriority(50)\nend\n\nfunction onUpdate(elapsed)\n if getHealth() <= 0.25 then\n script.disableHook('onUpdate')\n debug.warn('Low-health update hook stopped.')\n end\nend\n```\n\n### Character And Stage Checks\n\n```lua\nfunction onCreate()\n if stage.exists('mainStage') then\n stage.change('mainStage')\n end\n\n if character.exists('player') then\n character.playAnim('player', 'idle', true)\n end\nend\n```\n\n### Playback And Vocals\n\n```lua\nfunction onSongStart()\n setPlaybackRate(1.0)\n setScrollSpeed(1.15, 'both')\n setVocalsVolume(1.0, 1.0)\nend\n\nfunction onPause()\n pauseSound('ambience')\nend\n\nfunction onResume()\n resumeSound('ambience')\nend\n```\n\n### Safe Shader Cleanup\n\n```lua\nfunction onCreate()\n if not shader.make('heat', 'my-mod/shaders/heat.frag') then return end\n setLuaCameraShader('heat', 'game')\nend\n\nfunction onDestroy()\n removeLuaCameraShader('game')\nend\n```\n\n### Save A Mod Setting\n\n```lua\nfunction onCreate()\n local launches = save.get('launches', 0)\n save.set('launches', launches + 1)\n save.flush()\nend\n```\n\n### Schedule Work Without Per-Frame Polling\n\n```lua\nfunction onCreate()\n timer.after(1.0, function()\n debug.info('One second passed.')\n end)\n\n timer.every(0.5, function()\n addHealth(0.01)\n end)\nend\n```\n"},"api-chart-events":{"title":"Chart events","md":"# LuaSlice chart events\n\nEvents you can place in the Chart Editor without writing a script.\n\n## LuaSlice Chart Events\n\n- `PreloadResource`\n- `ChangeCharacter` with optional `preload`\n- `ChangeStage` with optional `preload`\n- `FocusCamera` with fixed-position or character-follow targeting\n- `ZoomCamera`, `SetCameraBop`, and `SetTargetBopSpeed`\n- `PlayAnimation` for characters and named stage objects\n- `PlayAudio` with `play`, `resume`, `volume`, `pause`, and `stop` actions\n- `Overlay` and `Blackout`\n- `HealthDrain` with Player/Opponent targeting and optional score changes\n- `HUDFade` with Both, Player, and Opponent targeting for icons, notes, and strumlines\n- `PlayDialogue`\n- `PlayCountdown`\n- `CameraFlash` and `CameraShake`\n- `StageObjectControl`\n- `ScrollSpeed` with optional `returnToOriginal`\n\nThese are normal Chart Editor events. File fields use explicit paths and start at `assets/` by default. Character targets use BF, Dad, or GF choices and named stage objects use the Object target. Play Dialogue lists available conversation JSON files, preloads their music, speakers, and dialogue boxes, then releases them when the conversation closes. F5 and song retries remove active event effects before the song is restored. Change Character reloads the character script when the same slot changes more than once. The removed Shader chart event is not part of this list; Lua shader APIs remain available to scripts.\n\n### Following a moving character\n\nIn a Focus Camera event, enable **Camera Follow Character** and choose Player, Opponent, or Girlfriend. The camera keeps the character's camera offsets and follows position changes from scripts and tweens, including while the event's camera transition is running. Leaving the checkbox off keeps the fixed-focus behavior used by older charts.\n\nAnother Focus Camera event replaces the target. Explicit scripted camera positioning takes over from character tracking.\n\n### Play Animation notes\n\nChoose `play_animation` in Note Data. Set Character Target, the exact Animation Name (or its configured atlas prefix), and Force Animation. Auto targets the owner of the note; Player, Opponent, and Girlfriend select a particular character. Existing named-prop targets in charts are still supported.\n\nForce Animation restarts the requested animation immediately. With it off, the character's normal interruption rules apply. The note keeps normal scoring and does not also trigger the usual directional singing animation. Missing characters or animations are logged without stopping the song. Holds trigger the animation on the initial hit, not on each hold segment.\n\nSaved parameter names remain `target`, `animation`, and `force`. Older charts using numeric force values still load.\n"},"api-whatsnew":{"title":"What changed","md":"# LuaSlice Lua API: recent changes\n\nNewest first.\n\n## Scripting events — 2026-10-20\n\nGameplay and menu events reach the original Lua API through `onEvent(type, payload)` and their named hooks, including note, song, countdown, pause and dialogue callbacks. Beat, step and focus hooks retain their existing arguments and are not dispatched twice. Payloads contain plain data rather than live scene objects; arrays and string-keyed Maps are copied, and cyclic/deep values are limited.\n\n`onNoteHoldDrop(payload)` includes `payload.holdNote` with `strumTime`, numeric `direction`, `sustainLength`, `fullSustainLength`, `hitNote` and `missedNote`. It is a snapshot, not the live sustain sprite.\n\nHScript can send a custom event:\n\n```haxe\nimport funkin.modding.events.ScriptEvent.CustomScriptEvent;\nimport funkin.play.PlayState;\n\nvar event = new CustomScriptEvent(\"my-mod:phase\", true);\nevent.data.set(\"phase\", 2);\nPlayState.instance.dispatchEvent(event);\ntrace(event.eventCanceled);\n```\n\nReceive it in `.lua` or `.luag`:\n\n```lua\nfunction onCustom(id, data, payload)\n if id == 'my-mod:phase' and data.phase == 2 then\n cancelEvent()\n end\nend\n```\n\n`stopEventPropagation()` stops later event recipients. Cancellation alone does not. Lua data is a snapshot; use existing event helpers to change or cancel the native event. Psych scripts use the separate `onCustom(id, data)` hook and return `Function_Stop` to cancel.\n\nSScript and NxScript receive `onCustom(event)` with the native event and its mutable `data` Map. HScript subclasses override `onCustom(event)` in the same way.\n\nScripted characters may override `getAssetPath()`, `getCharacterAnimations()`, `getBaseScale()` and `getHealthIconData()` without replacing the shared character configuration. These hooks are used by Sparrow, Packer, Animate Atlas, Multi-Sparrow and Multi-Animate renderers. For example:\n\n```haxe\nimport funkin.play.character.SparrowCharacter;\n\nclass SmallSenpai extends SparrowCharacter\n{\n public function new(id)\n {\n super(\"senpai\");\n }\n\n override function getBaseScale()\n {\n return 3;\n }\n}\n```\n\n## Native scripting update — 2026-09-28\n\nWindows, Linux and Android use LuaJIT through `hxluajit` and `hxluajit-wrapper`. The old/raw API, Psych-style aliases, and LuaSlice helpers remain supported. Helpers do not require a new language or rewritten scripts. `.lua` stays isolated, `.luag` keeps its shared environment, and the separate Psych `.luap`/`.luapg` loader keeps its existing rules. NxScript is unchanged.\n\n### Properties: all three styles work\n\n```lua\nsetProperty('boyfriend.x', 700)\nsetProperties('boyfriend', {x = 700, alpha = 0.4})\nsetProperties({\n ['boyfriend.x'] = 700,\n ['boyfriend.alpha'] = 0.4,\n ['camGame.zoom'] = 1.1\n})\n\nlocal values = getProperties({'boyfriend.x', 'camGame.zoom'})\ndebugPrint(values['boyfriend.x'])\nproperty.setMany('boyfriend', {alpha = 1})\nproperty.setMany({['camGame.zoom'] = 1})\nlocal health = property.ref('health')\nhealth.set(1)\ndebugPrint(health.get())\n```\n\nBulk setters return false if an assignment fails, report its path, and continue the remaining assignments. Getters omit missing/nil values from Lua tables. Paths are resolved against current objects each time; character replacements do not leave stale cached object references. `property.getMany` is the same bulk getter.\n\n### Sprite, sound, shader, and tween helpers\n\n```lua\nsprite.create('background', {\n image = 'stage/bg', x = -400, y = -200, scale = 1.2,\n alpha = 0.8, visible = true, antialiasing = true,\n camera = 'game', layer = 'background'\n})\nsound.play('confirm', 'confirmMenu', 0.8, false)\nsound.play('confirm', 'confirmMenu', {volume = 0.8, pitch = 1.2, looped = false})\nshader.configure('glitch', {amount = 0.4, enabled = true})\ntween.to('boyfriend', {alpha = 0.5}, 1, {ease = 'quadOut', tag = 'fade'})\ntween('rawFade', 'boyfriend', {alpha = 1}, 1, 'linear')\n```\n\nShader configuration uses already-created shaders and their actual uniform names. Numbers use float setters, booleans use boolean setters, and numeric tables use float-array setters; use the existing raw integer/color setters where those types are required. Positional sound arguments, raw tween calls, `doTweenX`, timers, sprite aliases, and shader APIs remain available.\n\n### SScript helpers (optional)\n\nThe pinned SScript interpreter supports string-keyed Haxe Map literals. `.ss` and `.ssg` retain their existing loading rules; each script still has its own interpreter. Their global suffix controls where they load, not a newly shared variable namespace.\n\n```haxe\nfunction onCreate():Void\n{\n playState.camGame.zoom = 1.1;\n boyfriend.alpha = 1;\n setProperties([\n \"boyfriend.x\" => 700,\n \"boyfriend.alpha\" => 0.4,\n \"camGame.zoom\" => 0.5\n ]);\n setProperties(\"boyfriend\", {alpha: 1});\n configure(playState.camGame, {zoom: 1.1, alpha: 1.0});\n tween(playState.camGame, {zoom: 1}, {duration: 0.5, ease: \"quadOut\"});\n var values = getProperties([\"boyfriend.x\"]);\n trace(values.get(\"boyfriend.x\"));\n}\n```\n\nDirect Haxe-style access and `state`, `game`, `playState`, `FlxG`, `Paths`, `Preferences`, `Conductor`, `Save`, and `Json` remain available. Character/camera aliases are refreshed before hooks. Helper tweens are cancelled when their script is destroyed. A failing hook is reported with its script path and disabled for that script instance; other scripts continue.\n\n### Coroutine tasks\n\n```lua\nlocal id = task.run(function()\n task.wait(1)\n character.playAnim('boyfriend', 'hey', true)\n task.wait(0.5)\n property.set('camGame.zoom', 1.1)\nend)\n```\n\n`task.wait` yields a real Lua coroutine; it does not block the game thread. Delays use update time in seconds. `task.wait(0)` resumes on a later update, not recursively in the same tick. `task.cancel(id)` cancels a pending task. Tasks disappear on script-manager reload/destruction; errors stop only the affected task and report its script path. Tasks do not make arbitrary non-yielding Lua code asynchronous.\n\n### Runtime information, profiling, and editor definitions\n\n```lua\ndebugPrint(LuaSlice.runtimeInfo().runtime, LuaSlice.runtimeInfo().jit)\nLuaSlice.profiler.start()\nlocal measurements = LuaSlice.profiler.snapshot()\nLuaSlice.profiler.stop()\nLuaSlice.api.writeDocs('LuaSlice Lua API.md')\nLuaSlice.api.writeLuaLS('LuaSlice API.d.lua')\n```\n\nProfiling is off by default. Snapshots contain cumulative hook timings (`totalMs`, `averageMs`, `calls`, `errors`), LuaSlice bridge-call counts, and property read/write counts. `averageMs` is per hook call, not per rendered frame; counters cover the LuaSlice/SScript services, not the separate Psych bridge. Start resets the counters; stop retains results. SScript can use `ScriptProfiler.start()`, `snapshot()`, and `stop()`. Runtime JIT status is queried from LuaJIT rather than assumed.\n\nLuaLS definitions are generated from the existing helper metadata, including both `setProperties` overloads. They describe the registered helper entries, not an exhaustive typed model of every engine object. No measured performance improvement is implied by switching runtimes.\n\nLuaSlice supports isolated `.lua` scripts and global `.luag` scripts. Lua is enabled by default on native C++ builds. Use `-DNO_LUA` only if you need a build without Lua.\n"},"api-errors":{"title":"Errors and limits","md":"# LuaSlice Lua API: errors and limits\n\nWhere errors go, and what the runtime does not support.\n\n## Error Reports And Logger\n\n- Lua errors are written to `logs/lua`.\n- Error windows include the script path, hook or API, Lua line number when available, report path, suggestions, and a performance warning only when repeated errors could affect FPS or memory.\n- `-DFEATURE_LOGGER` enables the live Lua logger and writes logger builds to `export/logger/<target>/bin`.\n- `-DNO_LUA` disables Lua support. Lua is enabled by default on native C++ builds.\n\n## Current Limits\n\n- Native builds use LuaJIT 2.1 through hxluajit and hxluajit-wrapper. HTML5 does not use this native Lua runtime.\n- Script folders, `.lua`/`.luag` extensions, callbacks and isolated/global behavior are unchanged. Use Lua 5.1-compatible source syntax: Lua 5.4 bytecode, variable attributes, floor-division syntax and native bitwise operators are not supported. `table.pack` and `table.unpack` are supplied for compatibility; use `bit` functions for bitwise operations.\n"},"psych-guide":{"title":"Guide and folders","md":"# Psych Lua API: guide and folders\n\nRun Psych Engine 1.0.4 Lua scripts as `.luap` and `.luapg` files.\n\n## API guide\n\n### LuaSlice custom script events\n\nHScript can dispatch a custom event through the current state:\n\n```haxe\nimport funkin.modding.events.ScriptEvent.CustomScriptEvent;\nimport funkin.play.PlayState;\n\nvar event = new CustomScriptEvent(\"my-mod:phase\", true);\nevent.data.set(\"phase\", 2);\nPlayState.instance.dispatchEvent(event);\ntrace(event.eventCanceled);\n```\n\nReceive it from a `.luap` or `.luapg` script:\n\n```lua\nfunction onCustom(id, data)\n if id == 'my-mod:phase' and data.phase == 2 then\n return Function_Stop\n end\nend\n```\n\nLua receives a snapshot of the data, not a live Haxe Map. HScript, SScript and NxScript receive the event itself and can edit its Map, call `cancel()` or `stopPropagation()`. Cancellation prevents the sender's associated behavior only when the sender checks `eventCanceled`; it does not stop propagation. Ordinary chart events still use `onEvent`.\n\nRequires LuaSlice v0.1.0 or newer. This port follows Psych Engine 1.0.4 while using V-Slice's gameplay and asset formats. The current migration targets FNF Preview 4; `vSliceVersion` reads the version from the running game's metadata.\n\nScripts run on LuaJIT 2.1, using hxluajit 1.0.5 and hxluajit-wrapper 1.0.0. Haxe calls use Iris 1.1.3.\n\nLuaJIT uses Lua 5.1 syntax. If you're moving a Lua 5.4 script over, use `math.floor(a / b)` for floor division and the `bit` library for bitwise operations. Lua 5.4 variable attributes and compiled bytecode won't work. `table.pack` and `table.unpack` are included. Share the script source with your mod; native FFI code may not work on another platform.\n\n## Installation and script folders\n\nPut your mod in `mods`, include `_polymod_meta.json`, and enable it. Disabled mods won't load scripts. Set the metadata's `api_version` to the FNF version, such as `0.8.6`, not the LuaSlice or Psych version.\n\nEach Lua file has its own globals. The following folders are relative to the mod:\n\n| Folder | When it loads |\n| --- | --- |\n| `*.luapg` at the mod root, or `scripts/*.luapg` | Every song |\n| `scripts/*.luap` | Every song, following Psych's folder convention |\n| `data/<song-id>/*.luap`, `data/songs/<song-id>/*.luap`, or `songs/<song-id>/*.luap` | That song |\n| `gameplay/songs/<song-id>/*.luap` | That song, using Preview 4 paths |\n| `stages/<stage-id>.luap` | The current stage |\n| `gameplay/stages/<stage-id>/<stage-id>.luap` | The current stage, using Preview 4 paths |\n| `characters/<character-id>.luap` | Each character used by that stage |\n| `gameplay/characters/<character-id>/<character-id>.luap` | Each active character, using Preview 4 paths |\n| `custom_notetypes/<kind>.luap` | A note kind present in the chart |\n| `custom_events/<event-name>.luap` | An event present in the chart |\n\nRename your Psych scripts from `.lua` to `.luap`. For a script that runs in every song, put a `.luapg` file in the mod root or `scripts/`.\n\nThe song, stage, character, custom-event and custom-note locations also accept `.luapg`. When both layouts contain the same logical script, the Preview 4 path wins within that mod. A higher-priority mod still overrides a lower-priority mod regardless of its folder layout. Disabled mods are not scanned.\n\n`.luapg` means global discovery, not a shared Lua interpreter: each Psych file keeps its own globals, as in Psych Engine. Use `getVar` / `setVar` or explicit script calls to share data during the song. LuaSlice's original `.luag` scripts are a separate runtime.\n\nLua note callbacks receive the Psych scalar arguments. File-based HScript note callbacks receive the live V-Slice `NoteSprite` or `SustainTrail`, not a Psych `Note`: use `note.noteData` for its chart data and `note.direction` (heads) or `note.noteDirection` (holds) for the lane. Do not retain recycled note sprites across songs. Pre-hit hooks run before the hit; normal hit hooks run after the native hit.\n\nGlobal means it loads in every song, not that all scripts share variables. Each Psych script has its own Lua state. Use `setVar`/`getVar` or the cross-script helpers to share values.\n\nMatch your folder and file names to the chart IDs, including capitalization. This matters on Android. `addLuaScript('path/name')` looks for `.luap`; include the extension when loading a `.luapg` file.\n\nAssets go in `images/`, `sounds/`, `music/`, `fonts/`, and `shaders/` inside your mod. Leave off the extension when using image and sound helpers. `require` can load Lua modules from your mod too.\n\nOnly run mods you trust. Lua's standard libraries are still available, so this is not a security sandbox for an entire mod. Haxe imports and reflection through the Psych bridge now respect LuaSlice's existing class and field restrictions; filesystem, process-launching and interpreter internals are not exposed through that bridge.\n\nOn Windows and Linux, `mods/` is next to the game executable. On Android, it's in the app's data folder under `Android/data/me.luaslice/files/mods/`. Use the Mods menu to enable the mod.\n\nTo try a script on Tutorial only, save the example below as `data/songs/tutorial/message.luap` inside an enabled mod.\n"},"psych-examples":{"title":"Examples","md":"# Psych Lua API: examples\n\nSmall scripts that use the Psych-style functions.\n\n## Script examples\n\n### Text and a solid-color sprite\n\n```lua\nfunction onCreate()\n makeLuaSprite('panel', nil, 24, 24)\n makeGraphic('panel', 380, 80, '14243A')\n setObjectCamera('panel', 'hud')\n addLuaSprite('panel', true)\n\n makeLuaText('message', 'Hello from Lua!', 350, 40, 45)\n setTextSize('message', 24)\n setTextColor('message', 'A7E8FF')\n addLuaText('message')\nend\n```\n\n### Tween, timer, and callbacks\n\nAdd this to the text-and-sprite example above.\n\n```lua\nfunction onCreatePost()\n doTweenAlpha('fadePanel', 'panel', 0.5, 0.4, 'quadOut')\n runTimer('changeMessage', 2)\nend\n\nfunction onTimerCompleted(tag, loops, loopsLeft)\n if tag == 'changeMessage' then\n setTextString('message', 'Timer finished')\n end\nend\n\nfunction onTweenCompleted(tag, target)\n debugPrint('Completed', tag, target)\nend\n```\n\n### Custom note type\n\nSave this as `custom_notetypes/Bonus.luap`, then set a note's kind to `Bonus` in the chart editor.\n\n```lua\nfunction goodNoteHit(id, direction, noteType, isSustainNote)\n if noteType == 'Bonus' and not isSustainNote then\n addHealth(0.04)\n addScore(50)\n end\nend\n```\n\n### Moving the camera on a beat\n\n```lua\nfunction onBeatHit()\n if curBeat == 16 then\n triggerVSliceEvent('FocusCamera', {\n char = 0,\n x = 0,\n y = -40,\n duration = 4,\n ease = 'quad',\n easeDir = 'Out'\n })\n end\nend\n```\n\n### Saving mod settings\n\n```lua\nfunction onCreate()\n initSaveData('settings')\n local visits = getDataFromSave('settings', 'visits', 0)\n setDataFromSave('settings', 'visits', visits + 1)\n flushSaveData('settings')\nend\n```\n\n### Reloading\n\nPress **F5** to use the game's normal reload, including Psych scripts. There is no separate Psych reload shortcut.\n\nScripts can still call `reloadLuaScripts()` to reload just the Psych scripts, or `setLuaAutoReload(true)` to check for file changes once per second. The following describes that script-only reload, not F5's full game-state reload.\n\nIf an edited file has a syntax error, the current scripts keep running. Other errors show the script and callback name. Changes a script already made aren't automatically undone.\n\nReload clears the scripts' sprites, text, timers, tweens, sounds, save handles, and Haxe interpreters. It then calls `onCreate`, `onCreatePost`, and `onReload`. The music keeps playing. Values saved with `setVar` survive reload; ordinary Lua globals reset.\n\nIn LuaSlice, `onCreate` runs after the stage, characters, and receptors are ready, before the countdown. This is later than in Psych.\n\n## Advanced script examples\n\n### Calling Haxe from Lua\n\n```lua\nfunction onCreate()\n local result = runHaxeCode('return 6 * 7;')\n debugPrint(result)\n runHaxeCode([[\n function doubleValue(value) {\n return value * 2;\n }\n ]])\n debugPrint(runHaxeFunction('doubleValue', {21}))\nend\n```\n\nIn Haxe code, `game` is the current PlayState. `FlxG`, `FlxSprite`, `FlxText`, `FlxCamera`, `FlxTween`, `FlxEase`, `FlxTimer`, `Paths`, `PlayState`, `Conductor`, `ShaderFilter`, and `FlxRuntimeShader` are already available. The bridge also includes `Assets`, `Preferences`, `Constants`, `FunkinSprite`, `FlxObject`, `FlxMath`, `FlxPoint`, `StringMap`, `IntMap`, `Json` and `Lambda`. `Reflect` and `Type` use the engine's safe reflection helpers.\n\nUse `addHaxeLibrary('TypeName', 'package.name')` for another permitted class compiled into the game. It returns false for a missing or blocked class; it doesn't install libraries. Optional missing imports produce a diagnostic and let the rest of the snippet run. Parse and runtime failures report the script path and snippet line, returning nil so another call can recover. Existing `.hx` and `.hxc` scripts still use Polymod; no extra interpreter is required.\n\nUse `setVar`, `getVar` and `removeVar` to share values with Lua. `createCallback` exposes an HScript function to its owning Lua script:\n\n```lua\nfunction onCreatePost()\n runHaxeCode([[\n setVar('extraPoints', 25);\n createCallback('addExtraPoints', function(points) {\n return points + getVar('extraPoints', 0);\n });\n ]])\n debugPrint(addExtraPoints(100))\nend\n```\n\nIf you add an object directly with `game.add()`, remove it yourself when reloading. Objects made through the Lua helpers are cleaned up automatically.\n\n### Custom pause overlay\n\n```lua\nfunction onUpdate()\n if keyboardJustPressed('F7') then\n openCustomSubstate('info', true)\n end\nend\n\nfunction onCustomSubstateCreate(name)\n if name == 'info' then\n makeLuaText('infoText', 'Press Escape to return', 600, 80, 80)\n setObjectCamera('infoText', 'other')\n addToCustomSubstate('infoText')\n end\nend\n\nfunction onCustomSubstateUpdate(name, elapsed)\n if name == 'info' and keyboardJustPressed('ESCAPE') then\n closeCustomSubstate()\n end\nend\n```\n\nObjects you move into a custom substate are destroyed when it closes. Don't move the game's stage or characters into it.\n\nClosing isn't immediate. Use `onCustomSubstateDestroy` to run code when it closes, rather than checking for deleted objects straight after `closeCustomSubstate()`.\n"},"psych-callbacks":{"title":"Callbacks and globals","md":"# Psych Lua API: callbacks and globals\n\n\n\n## Callbacks and globals\n\nCallbacks: `onCreate`, `onCreatePost`, `onDestroy`, `onReload`, `onUpdate(elapsed)`, `onUpdatePost(elapsed)`, `onStartCountdown`, `onCountdownTick(index)`, `onSongStart`, `onEndSong`, `onPause`, `onResume`, `onGameOver`, `onSongRetry`, `onBeatHit`, `onStepHit`, `onSectionHit`, `onMoveCamera(target)`, `onSpawnNote(id, direction, kind, isSustainNote, strumTime)`, `goodNoteHit`, `opponentNoteHit`, `noteMiss`, `noteMissPress(direction)`, `onEvent(name, value1, value2, time)`, `onTimerCompleted`, `onTweenCompleted`, `onSoundFinished`, and the custom-substate callbacks shown above plus `onCustomSubstateCreatePost`, `onCustomSubstateUpdatePost`, and `onCustomSubstateDestroy`.\n\n`Function_Continue`, `Function_Stop`, `Function_StopLua`, and `Function_StopAll` are available. Stop/StopAll can cancel game events that support cancellation. They can't undo callbacks that already ran.\n\nGlobals include `version` (Psych API reference version), `vSliceVersion`, `scriptName`, `modFolder`, `curBeat`, `curStep`, `curDecBeat`, `curDecStep`, `curSection`, `bpm`, `curBpm`, `crochet`, `stepCrochet`, `songPosition`, `songName`, `songPath`, `songLength`, `curStage`, `screenWidth`, `screenHeight`, `downscroll`, `scrollSpeed`, `score`, `health`, `difficultyName`, `inGameOver`, and `mustHitSection`. The last is derived from native FocusCamera events, because V-Slice has no Psych `mustHitSection` chart sections.\n"},"psych-diff":{"title":"Differences from Psych","md":"# Psych Lua API: differences from Psych Engine\n\nWhat behaves differently because LuaSlice runs on V-Slice.\n\n## Differences from Psych Engine\n\nSong scripts can go in `data/songs/<song-id>/`, such as `data/songs/black-knife/knightscript.luap`. The loader can match `Black-Knife` to `black-knife` if there is only one matching folder. Images and audio have the same fallback, but it's better to fix the capitalization in your files.\n\n`addCharacterToList(id, role)` preloads a V-Slice character. `triggerEvent('Change Character', role, id)` changes the character and health icon. Use `bf`/`boyfriend`/`0`, `dad`/`1`, or `gf`/`2` for the role. The character needs V-Slice JSON and its assets; Psych character JSON isn't converted by these calls.\n\nYou can use `curCharacter`, `imageFile`, and `healthColorArray`. Set `isCameraOnForcedPos` to keep FocusCamera events from overriding your scripted camera position.\n\nSprites made from a current Sparrow character's `imageFile` reuse its frames and animation names, which is useful for ghost trails. Animate and MultiAtlas characters aren't converted to Sparrow sprites.\n\nAdding the Lua API doesn't make a whole Psych mod work unchanged. Songs, characters, stages, events, note styles, and assets still need to work with V-Slice. Scripts that access Psych-only class fields will need changes too.\n\n- `boyfriend`, `dad`, `gf`, `camGame`, `camHUD`, `camOther`, `camFollow`, `notes`, `unspawnNotes`, `playerStrums`, `opponentStrums`, and `strumLineNotes` refer to V-Slice objects. Receptor indexes are 0–3 for the opponent and 4–7 for the player. Active-note indexes can change between frames.\n- Holds use continuous trails, not separate sustain sprites. While a hold is being hit, note callbacks run at step intervals with `isSustainNote = true`.\n- `texture`, `noteSplashTexture`, `antialiasing`, `ignoreNote`, `hitCausesMiss`, `missHealth`, `hitHealth`, and `noteSplashDisabled` work with the group/property helpers. Settings made before a note spawns are applied to its sprite, without carrying over to other notes when that sprite is reused.\n- `ignoreNote` removes miss and dropped-hold penalties. Players can still hit the note, but botplay skips it. `hitCausesMiss` takes away the amount in `missHealth` when hit; zero is allowed.\n- Custom note heads use Sparrow atlases. Hold frames use `<color> hold piece` and `<color> hold end` prefixes; purple also accepts Psych's legacy `pruple end hold` name. The first numerically sorted frame is used for each body and cap; animated hold textures are not supported. Trimmed frames keep their offsets, and missing hold frames leave the native trail in place. For the `pixel` note style, Psych pixel sheets go in `images/pixelUI`: four columns and five rows for the notes, four columns and two rows for `nameENDS.png`. Both formats convert to continuous holds without changing V-Slice's hold timing or scoring.\n- `noteSplashTexture` supports legacy Psych Sparrow splash atlases, with names such as `note splash purple1`. If the atlas is missing, the game keeps the normal splash and logs a warning. Advanced Psych 1.0 splash settings aren't converted.\n- `triggerVSliceEvent` takes a V-Slice event's values as an object. `triggerEvent` passes Psych's `value1` and `value2` to Lua callbacks. Not every built-in Psych event has an implementation.\n- `.hxc` modules still use FNF's HScript system. `runHaxeCode` uses Iris separately for each Lua script. Lua cross-script calls don't call `.hxc` modules.\n- `camOther` is the cutscene camera. Character animation names and the game's default cameras keep their V-Slice names.\n- `saveFile`, `deleteFile`, and directory helpers stay inside your mod folder, even with an old absolute-path flag.\n- Psych achievements, dialogue JSON, FlxAnimate-specific Lua helpers, rating overrides, and Psych-only class fields aren't supported here. Use V-Slice's systems or adjust the script.\n\nUse `isLuaFunctionSupported('callbackName')` to check whether an API function is available. The registered names and signatures are in `source/funkin/modding/psychlua/PsychLuaAPI.hx`.\n\n## Credits\n\nBased on the Lua API from Psych Engine 1.0.4 by Shadow Mario, RiverOaken, and contributors, adapted for LuaSlice and V-Slice. Psych Engine's Apache-2.0 license is in `licenses`.\n\nFNF, LuaJIT, hxluajit, hxluajit-wrapper, and Iris keep their original credits and licenses.\n"},"changelog-engine":{"title":"Engine changelog","md":"# Engine changelog\n\n## v0.1.0 - 2026-10-29\n\n- Psych Engine Lua API is finally fixed!\n\n### Editor fixes\n\n- Character previews now keep the character's original scale, including pixel characters, and update their position when resized. (FNF #8318)\n- Fixed dragging the Offsets playhead or scrolling its preview on songs without player vocals. (FNF #8317)\n- Fixed Offsets waveforms drawing outside their preview after scrolling. (FNF #8313)\n- Aligned the Chart Editor playbar with the window and kept its handle reachable at both ends. (FNF #8314)\n- Closing the Chart Editor restores the LuaSlice window title. (FNF #8311)\n\n### Gameplay and input\n\n- Fixed recycled notes keeping the previous note type's scoring settings.\n- Fixed note-style offsets being lost when updating note hitboxes, and hold offsets not updating when changing styles.\n- Fixed inputs outside the judgement window being counted as successful hits.\n- Fixed song-end updates trying to use music that had already been stopped or cleared.\n- Fixed Game Over music and the retry confirmation timer continuing while the window is unfocused with Pause on Unfocus enabled.\n- Fixed precise input for controller triggers, duplicate controller listeners, and old bindings remaining after input is reinitialized.\n- Fixed removing the last binding in Controls.\n- Added optional note motion blur. It is off by default and leaves pixel notes unblurred.\n- Fixed the song-shader setting not removing stage and camera effects. Max Low Quality also keeps song shaders disabled.\n\n### Chart Editor and converters\n\n- Fixed playtests returning straight to the editor when its opening fade finished late.\n- Fixed playtest audio not starting correctly, including playtests started partway through a song.\n- Reset Pause and Game Over state before starting another playtest.\n- Fixed camera resets happening during a state switch instead of after the new state was ready.\n- Fixed note parameters being shared between copied notes or lost when moving copied notes to another time.\n- Fixed ghost notes, hold previews and event previews staying visible after they were no longer needed.\n- Fixed audio previews, replaced instrumentals, vocals and waveforms not being released properly when importing another chart.\n- Fixed missing character icons crashing the character selector and Metadata toolbox.\n- Stopped audio changes from opening the Offsets or Freeplay toolbox just to refresh a value.\n- Added Set Target Bop Speed to the character preview's supported events.\n- Fixed Psych chart imports accepting the wrong `song` value as the chart, negative hold lengths, invalid scroll speeds and unsorted notes.\n- Added conversion for Psych's older numbered note types, including Alt Animation, Hurt Note, GF Sing and No Animation.\n- Fixed Codename charts wrapped inside a `song` object not importing correctly.\n- Added Codename metadata and event-file lookup for charts stored in `charts/` and variation folders.\n- Fixed Codename imports losing metadata fields, ignoring external BPM changes, or repeating BPM entries at the same time.\n- Added support for Codename's numbered events and single-value event parameters, and corrected the School Evil stage name.\n- Fixed invalid numeric chart values being accepted as BPM, timing or speed values.\n- Added file-read error handling to the import dialogs. An unreadable audio file now reports the problem instead of crashing the picker callback.\n- Fixed instrumental changes destroying the previous track before the replacement had finished loading.\n- A missing or broken waveform no longer stops an otherwise valid vocal track from loading. Invalid audio is still rejected.\n\n### Mods and the Mod Menu\n\n- Fixed removed mods staying in the enabled-mod list and being reported as missing on the next launch.\n- Kept mod order and deliberately disabled mods when rescanning. New valid mods are picked up automatically on mobile; desktop mods remain opt-in.\n- Added a warning for folders missing `_polymod_meta.json`. Only that mod is skipped, and **Make one for me** creates a starter file without replacing an existing one.\n- Mods become available when their missing metadata is added. Creating metadata does not convert the mod's charts or scripts.\n- Set the supported mod API range to FNF 0.8.5 through 0.8.7.\n- Fixed folder and ZIP mod audio loading through a web-request path on native builds. Audio is now read from the mod filesystem and decoded from its bytes.\n- Added clearer errors for missing, empty or unreadable mod audio, and caught failures while queuing song audio.\n- Fixed ordinary PNG mod images being treated as compressed base-game textures on mobile.\n- Fixed Mod Menu entries being clipped out of their lists, and added a fallback for missing or broken mod icons.\n- Restored the Mod Menu on mobile. Tap to move a mod between lists, swipe to scroll, or hold to drag it.\n- Fixed touch scrolling being confused with dragging, taps activating buttons before release, and the Back action being missed with mixed touch/controller input.\n- Fixed rescans interrupting Mod Menu transitions and missing folder changes when the number of installed mods stayed the same.\n- Updated the Mod Menu instructions to match the controls on each platform.\n\n### Scripting\n\n- Switched native Lua from hxlua to LuaJIT through hxluajit and hxluajit-wrapper. Existing LuaSlice `.lua`/`.luag` scripts and Psych `.luap`/`.luapg` scripts keep their separate loading rules.\n- Lua now uses Lua 5.1-compatible syntax. Lua 5.4-only syntax and bytecode need updating; `table.pack` and `table.unpack` remain available.\n- Added the Psych 1.0.4 Lua bridge, mod-relative asset lookup, custom event/note-type scripts, song scripts, Haxe calls, custom substates and script reload support.\n- Fixed song-script routing and kept unrelated songs' scripts from loading together.\n- Fixed NxScript hooks not being retained, including scripts beginning with a UTF-8 BOM.\n- Added bulk property setters/getters, property references, configuration helpers and shared tween helpers for LuaSlice Lua and SScript.\n- Added Lua coroutine tasks with wait/cancel helpers, optional script profiling, runtime information and generated LuaLS definitions.\n- Fixed property helpers retaining old objects after replacement. A failed bulk assignment reports its path without stopping the remaining assignments.\n- Fixed SScript class scripts starting before their state was ready, and added class-script lifecycle hooks to substates.\n- Connected LuaSlice's original Lua API to gameplay and menu events without repeating beat, step or focus callbacks.\n- Added custom script events and `onCustom` hooks for HScript, LuaSlice Lua, Psych Lua, SScript and NxScript. Events support cancellation and stopping propagation.\n- Fixed string-keyed Haxe Maps, including nested custom-event data, not reaching Lua as tables.\n- Fixed stopped events continuing to later script targets, and inherited global Lua hooks running again for each local script.\n- Added character overrides for asset paths, animations, scale and health icons across Sparrow, Packer, Animate Atlas, Multi-Sparrow and Multi-Animate characters.\n- Added stage getters for BF, Dad and GF scroll factors and draw order.\n- Fixed scripted note kinds and active song-event handlers not receiving `onCreate` after gameplay finished creating.\n- Fixed scripts closing their Lua state while a callback was still running, and failed script initialization leaving a Lua state behind.\n- Fixed reloads leaving custom note graphics and splash sprites behind.\n- Added Psych Sparrow hold bodies and caps, including trimmed frames, downscroll and the older purple end-cap name.\n- Reused matching generated hold textures and released them after reload or song cleanup without destroying textures still used by live or pooled notes.\n- Updated `onSpawnNote` to pass strum time as its fifth argument, matching Psych 1.0.4.\n- Script errors now include the mod, callback and traceback. Repeated identical errors are reported once per script instance.\n- Updated both Lua API guides with script folders, examples, reload behavior and compatibility notes.\n\n### Menus, editors and saves\n\n- Fixed mobile Freeplay swipes not moving the song list, tracked the active finger through a drag, and kept flick scrolling separate from difficulty selection.\n- Fixed Freeplay mouse-wheel/trackpad scrolling and stale highlighting after changing a song filter.\n- Fixed option rows using the wrong camera or hitbox, which could toggle a different setting from the one being pressed.\n- Moved Subtitles, Camera Zooms, Loading Screens, Flashing Lights and the mobile Pause Button to Performance.\n- Added **Hit now!** on desktop and **Tap now!** on mobile above the calibration receptor when an input is due.\n- Corrected the early/late direction and input timing used by lag calibration.\n- Added trackpad panning to the Animation and Stage editors, with Ctrl+scroll for zooming.\n- Fixed the Stage Editor keeping its file-drop listener after closing.\n- Cleaned up Animation Editor character exports so unchanged default fields are left out, without changing the character being edited.\n- Fixed save-version data sharing the default version object. Failed writes now report an error, and clearing a save stops if its recovery copy could not be written.\n- Restored LuaSlice's Discord application ID when no custom ID is set.\n\n### Builds and files\n\n- Replaced the old setup batch file with `Setup LuaSlice.bat`, including Windows, Android, both, or setup-only choices.\n- Windows and Android builds use a temporary short path to avoid long-path compiler and linker errors.\n- Fixed Android release setup creating a broken signing configuration when keystore details were missing.\n- Added Linux build instructions and a Linux x64 release build. The runtime checks also run on Linux.\n- Added an iOS build workflow that produces an unsigned iPhone IPA and a simulator package. The IPA still needs Apple signing before installation on a phone.\n- Fixed iOS simulator linking against the video library by using an ARM64 Mac runner and matching ARM64 tools.\n- Removed the upstream Apple signing team from the local project. Signed builds can use `IOS_TEAM_ID` instead.\n- Included the engine, FNF and Psych API changelogs and the LuaSlice API guide in the build's documentation assets.\n- Stopped warning about missing optional Newgrounds environment values, while still checking values required by enabled features.\n\n## [0.0.9] - 2026-09-08\n\n- Updated to v0.0.9.\n\n## [0.0.8] - 2026-08-23 | Funkin v0.8.6 Port\n\n### Changed\n\n- Ported LuaSlice to Funkin v0.8.6, and added and removed some stuff.\n\n## [0.0.7] - 2026-07-29 | Story Mode and Chart Editor Bugfixes\n\n### Added\n\n- Added the Animation Editor. Made by the Nova Utils Team.\n- Added the Level Editor. Made by the Nova Utils Team.\n- Added a Automatic update system before the title intro when a newer LuaSlice version comes out.\n- Added a Stage Editor conversion window for converting stage layout data between the Base Game, Psych Engine v1.0.4, and Codename Engine.\n- Added support for Base Game `.fnfs` packages and JSON, Psych Engine JSON, and Codename Engine XML stage files in the converter.\n- Added a Middle Scroll gameplay preference that centers the Player strumline and splits the Opponent notes along the sides.\n- Added a one-click Windows setup and build batch file that installs everything you need to build the engine, before running `lime test windows`.\n\n### Changed\n\n- Improved Lag Adjustment with precise input timestamps, outlier-resistant averaging, and rounded final calibration values.\n- Reworked gameplay input handling so keyboard, controller, and touch presses and releases are processed in their original timestamp order.\n- Moved judgement ratings and combo numbers farther right when Middlescroll is enabled on desktop, or when Strumline Background is between 90% and 100% on all builds.\n- Split the Opponent strumline background across its left and right lanes when Middlescroll is enabled.\n- Replaced the unreleased trace only GitHub version check with an in-game release check that quietly continues when offline.\n- Updated the main menu and Lua API version to `0.0.7`.\n\n### Fixed\n\n- Fixed Retry and F5 HUD-effect resets making Middlescroll Opponent receptors and notes fully opaque instead of restoring their 90% visibility.\n- Fixed large mod textures causing gameplay audio to buffer-loop and song progression to stall when memory optimization ran immediately after playback began.\n- Fixed duplicate bindings and keyboard, controller, and touch source-ID collisions causing lost, repeated, or mismatched inputs.\n- Fixed fast inputs judging against the current frame instead of the input's actual song position, and made stacked note selection favor the closest valid note.\n- Fixed input offset compensation being applied inconsistently to early inputs.\n- Fixed normal and Chart Editor options reverting because a repeated save load could leave the active preferences attached to an outdated save object.\n- Restored the original mobile HUD positions for the health bar, health icons, score, subtitles, ratings, and combo numbers.\n- Restored the Freeplay rank glow, colored trail, and vignette after completing a song on Android.\n- Fixed Shader events failing for animated fragment shaders, scripted HXC shader updates, `_amount` uniforms, case-sensitive shader names, and the Remove Existing Shaders option.\n- Fixed rapid multi-touch Hitbox input leaving mobile strumline receptors falsely pressed or retriggering duplicate press animations.\n- Fixed Chart Editor auto-save only counting from the first edit instead of restarting after each new change.\n- Fixed Chart Editor metadata, BPM, time-signature, difficulty, audio-offset, and Freeplay-preview changes not consistently activating auto-save.\n- Fixed a failed Chart Editor backup clearing the unsaved state instead of keeping the chart dirty and scheduling another auto-save attempt.\n- Fixed a fatal crash in the Chart Editor when importing or loading `.mp3` files due to waveform generation failure.\n- Fixed a fatal crash on Mobile devices when single or double-clicking notes and events in the Chart Editor.\n- Fixed the Chart Editor Auto-Save preferences having overly restrictive minute bounds and failing to update the timer in some cases.\n- Fixed Story Mode rejecting weeks that use only one or two custom difficulties instead of Easy, Normal, and Hard.\n- Fixed Story Mode selecting an invalid remembered difficulty when changing to a week with a different difficulty list.\n- Fixed the mobile Chart Editor requiring mouse hover to open Mirror Notes, Note Snapping, and Live Input Mode.\n- Fixed Live Input Mode touch selections not reliably updating the active input style.\n- Fixed F5 bypassing the Chart Editor reload path and failing to hot-reload a PlayState opened as a Chart Editor playtest substate.\n- Fixed F5 only rescanning Lua scripts during normal gameplay instead of reloading the current song and its assets.\n- Fixed note splashes being shifted left by an extra half-sprite offset.\n- Fixed the Chart Editor character selector crashing when a character has a missing or invalid animated Freeplay icon.\n- Fixed the Chart Editor character selector opening below the health icons and becoming hidden while using Downscroll.\n- Fixed the Stage Editor converter accepting files that do not match the selected source engine.\n- Fixed the Stage Editor Test Stage button being blocked by its own UI focus.\n- Fixed the mobile Hitbox layout removing the press and release events required to hit notes.\n- Repositioned and resized the mobile Hitbox layout into a safe lower-screen touch pad, with the receptor line kept above it instead of overlapping the notes.\n- Fixed mobile Hitbox touches lighting up without reaching the gameplay note input queue.\n- Kept Freeplay difficulty names and dots visible in Minimal and Max low-quality modes while hiding the difficulty selector arrows.\n- Fixed the split Opponent receptors and incoming notes staying at the top of the screen when using Downscroll with Middlescroll.\n- Fixed the split Opponent strumline backgrounds not lining up with their receptor pairs.\n- Fixed Chart Editor Instrumental, Player Vocals, Opponent Vocals, and playback-speed preferences sometimes being overwritten by temporary minimum UI values.\n- Restored the glowing selected song text in Freeplay on Android. HAPPY LEN?? HUH???\n- Replaced the broken mobile Hitbox layout with four full-screen touch lanes that keep the normal strumline and Up/Downscroll layout.\n- Fixed mobile Arrow and Hitbox controls changing the gameplay strumline layout, and force Arrow controls while an external keyboard or controller is connected. ops\n- Fixed Chart Editor audio, playback, note snapping, input mode, Downscroll, theme, hitsound, and subtitle preferences not saving immediately on mobile.\n- Fixed the Difficulty toolbox Load Metadata, Load Chart, Save Metadata, and Save Chart buttons doing nothing on mobile.\n- Added 0% to the mobile Hitbox Transparency range so its resting lanes can be completely invisible.\n- Fixed the mobile Chart Editor Metadata toolbox crashing when opened before an instrumental was loaded.\n\n## [0.0.6.5] - 2026-07-23 | Small Bugfix Update\n\n### Added\n\n- Added `.mp3` support when loading Chart Editor instrumentals and vocals, including the Psych Engine import flow.\n- Added a Chart Editor Preferences submenu with an auto-save interval from 6 to 29 minutes.\n- Added an enabled-by-default mobile preference for double-tap deletion of notes and events.\n\n### Changed\n\n- Updated the main menu and Lua API version to `0.0.6.5`.\n\n### Fixed\n\n- Fixed Chart Editor preferences such as theme, metronome, hitsound, audio, playback, Downscroll, and note settings not always being flushed when leaving or reloading the editor.\n- Fixed Downscroll waveforms rendering in the wrong direction and bouncing with animated Player/Opponent icons.\n- Fixed a Title Screen input bug reported by `that0neidiotgb` and `characterfilemissing` where rapid clicks could skip past the logo and GF screen.\n- Fixed vocal lookup used by the Chart Editor and song loading failing to find valid unsuffixed Player, Opponent, and legacy vocal files when a variation-specific file was unavailable.\n- Fixed Chart Editor Downscroll waveform and Player/Opponent icon alignment, keeping the icons above the playbar and each waveform connected to its matching icon.\n- Fixed deleted Chart Editor events leaving stale sprite and tooltip references that could crash the game.\n- Fixed the Chart Editor Preferences submenu requiring mouse hover on mobile; tapping it now opens the submenu.\n\n## [0.0.6] - 2026-07-22 | planned from 2026-06-18 :sob:\n\n### Added\n\n- Added `Preload Resource` for images, sounds, music, characters, stages, stage objects, shaders, and dialogue data.\n- Added `Play Audio` with actions for playing, resuming, changing volume, pausing, and stopping tagged audio.\n- Added `Shader` support for applying and removing `.hxc` and `.frag` shaders, including multiple properties in one event.\n- Added reusable Overlay and Blackout events with colors, gradients, images, animated atlases, cameras, blend modes, opacity, and fading.\n- Added `Play Dialogue`, HUD Fade, Camera Flash, Camera Shake, and Stage Object Control as normal Chart Editor events.\n- Added `Play Countdown`, which shows and plays the normal countdown without restarting or resyncing the song.\n- Added `Return to Original Speed` to the Scroll Speed event.\n- Added an approximate Overlay and Blackout preview to the Chart Editor event toolbox.\n- Added a layered HUD Fade preview for the strumline, notes, health bar, and icons.\n- Added dedicated Chart Editor icons for Play Audio, Shader, Blackout, Stage Object Control, and HUD Fade.\n- Added `Create Solid Block` below Find Object in the Stage Editor. The block can be edited through Object Properties.\n- Added native mobile Chart Editor support, accessible from `Options > Chart Editor`.\n- Added number, whole-number, on/off, X/Y, and color controls for Shader event properties.\n- Added `Health Drain` with persistent per-second Player/Opponent draining, amount `0` to stop, optional score changes, and a `Die?` toggle (visible when Player is selected) so health can drain without killing the player when disabled.\n- Added target compatibility filtering for `Shader` events. Shaders can declare supported target types, camera targets, and character targets (or restrictions like `//@no-hud`), automatically hiding unsupported choices in the Chart Editor dropdowns.\n- Added a mobile-only hot-reload button in the top-right corner of the Main Menu with a cyan tint and 60% resting opacity to trigger a state reload (F5).\n- Added softcoded Lua state and substate opening for scripted and built-in state classes.\n- Added object shader targets to the Haxe and Lua APIs, including `DropShadowShader` support for named stage objects.\n- Added a Difficulty toolbox action for deleting a non-default variation and every difficulty inside it.\n- Added a secret when there's an error with a script.\n- Added Lua helpers for reading GC memory usage and temporarily hiding or restoring the built-in debug display.\n\n### Changed\n\n- Removed the `Pause Gameplay` option from `Play Dialogue` event settings.\n- Reworked gameplay memory cleanup to release finished song audio and CPU-side copies of large textures without destroying live Flixel graphics.\n- Updated the main menu and Lua API version to `0.0.6`.\n- `Play Dialogue` now lists real conversation JSON entries, preloads its music and visuals, and releases them after the dialogue closes.\n- `Shader` now lists both `.hxc` classes and `.frag` files, reads their uniforms, provides BF, Dad, and GF targets, and can ignore fully transparent sprite pixels.\n- File-based events now use explicit paths, starting at `assets/` by default.\n- F5 and song retries now clear event-created audio, shaders, overlays, dialogue, tweens, and timers before restoring the song.\n- Centered the Chart Editor menu buttons.\n- Renamed the HUD Fade `Receptors` label to `Strumline`.\n- Changed HUD Fade duration to use beats so chart timing is easier to control.\n- Replaced hex color text fields in the new Chart Editor events with color-wheel pickers.\n- Changed event blend modes from text fields to a list of supported modes.\n- Moved the layered HUD Fade preview assets into the shared Chart Editor HUD folder.\n- Score text now fades with the health bar instead of using a separate HUD Fade target.\n- Split Play Audio into an audio folder path and audio filename while keeping tagged controls.\n- Reordered Chart Editor events so the most commonly used camera, speed, resource, shader, character, and stage events appear first.\n- Shift-clicking a placed event now selects it and opens its Event Data toolbox, including events missing from a stale dropdown.\n- Shader property controls now use one clean slider with an integer value display. Values move by 1 normally and by 5 while Shift is held.\n- Debug builds now identify both LuaSlice and FNF before the branch, commit, modified state, and prototype label.\n- Overlay image events now preload their PNG and animated XML/TXT atlas data before gameplay.\n- Reworked Psych Engine imports into a step-by-step flow for up to eight difficulty charts, optional events, and required instrumental, Player Vocals, and Opponent Vocals files. Android uses its native document picker for every step.\n- Startup now keeps only commonly reused textures and sounds permanently cached instead of loading nearly every UI texture into memory.\n- Reworked state caching so song assets survive loading while unused assets are retired before Flixel's state cleanup and released as soon as the old state is destroyed.\n- Low Quality Minimal now avoids loading hidden Freeplay capsule details and disables off-screen stage sprites at a low update rate.\n- Low Quality Max now skips heavy album, difficulty-star, flame, score-number, note-splash, hold-cover, and combo-number assets instead of loading and hiding them.\n- Optimized Philly Streets and Philly Streets Erect by skipping disabled rain-shader updates, sharing mist calculations, sorting added mist layers once, and reducing Erect mist layers under Low Quality.\n- On mobile, the Chart Editor now opens only from its Options entry.\n- Low Quality Minimal and Max now skip video and dialogue cutscenes, while None keeps the normal cutscene flow.\n- Reorganized the Lua implementation into focused files under `source/lua` so its APIs, menus, options, shaders, logging, and script discovery are easier to maintain.\n- Replaced the mobile Upgrade menu item with the Merch item.\n- Updated the LuaSlice logo and the platform build icons.\n- Added a Discord item after Options on the Main Menu using the supplied Discord atlas and invite link.\n- Locked `Remove Existing Shaders` on for this release because I can't get it to work, I'm sorry! \n\n### Fixed\n\n- Fixed the Discord Main Menu item leaving menu navigation disabled after opening the invite link.\n- Fixed F5 rebuilding the hidden PlayState while Game Over owned the player character, which shifted the death sprite and left a duplicate idle frame behind it.\n- Fixed the volume-key plugin crashing during reload frames where player controls were temporarily unavailable.\n- Fixed F5 triggering both the global asset reload and Lua hot reload in PlayState, which destroyed the song audio and caused a null-reference crash in the same frame.\n- Fixed Shader event slider persistence and real-time number display updates so values remain correct across editor sessions.\n- Fixed Shader slider dragging rebuilding note displays and HaxeUI layouts unnecessarily.\n- Added null safety across `SoundGroup` operations to prevent crashes while switching states or cleaning up PlayState audio.\n- Fixed shared Animate Atlas textures being destroyed while another live character or stage still referenced them, preventing compatible mod characters from crashing during rendering.\n- Reworked the Psych Engine 1.0.4 importer around its real `psych_v1` format, including player/opponent lanes, GF camera sections, BPM sections, animation targets, note types, embedded events, and companion `events.json` files.\n- Fixed Psych charts with an empty stage field by applying Psych Engine's normal song-to-stage fallback.\n- Added a clear import error when `events.json` is selected instead of a Psych song chart.\n- Fixed selecting HUD Fade crashing when stale event fields were still stored by the Chart Editor toolbox.\n- Fixed HUD Fade opacity removing its preview image. Each HUD target now previews independently while the background remains visible.\n- Fixed HUD Fade Sine and Quad easing previews not updating after Linear.\n- Fixed F5 or asset reload crashing while a Play Dialogue conversation was active.\n- Fixed Play Dialogue not opening during Chart Editor playtests.\n- Fixed Play Dialogue, conversation music, and tagged audio volume fades crashing because `FlxSound.volume` could not be reflected by `FlxTween`.\n- Fixed Overlay preview opacity hiding the preview and color-picker changes not refreshing it correctly.\n- Fixed Overlay color-wheel values not reaching the in-game solid and gradient colors.\n- Fixed HUD Fade target opacity changes not refreshing the layered preview.\n- Fixed Blackout leaving uncovered screen space when used on a zoomed camera and removed its unnecessary Chart Editor preview.\n- Fixed Chart Editor color pickers updating the preview without saving the new color into the event data.\n- Fixed Play Dialogue portraits, dialogue boxes, and typing sounds failing when a Week 6 conversation runs in another song.\n- Fixed Play Dialogue music not resolving from the Week 6 asset library.\n- Fixed gradient overlays rendering as a few large bands instead of a smooth gradient.\n- Fixed shader cleanup skipping some characters, sprites, or cameras after restarting a song or reloading with F5.\n- Fixed normal Android release builds enabling advertisements when `.env` only contained signing information.\n- Fixed existing Chart Editor event icons not refreshing after their event type changed.\n- Prevented missing event resources, Lua files, audio tags, shaders, targets, dialogue, stage objects, and animations from crashing gameplay.\n- Prevented repeated tagged audio, shader, overlay, tween, and timer resources from leaking after retries or leaving PlayState.\n- Fixed Blackout's `Keep HUD Visible` option so the blackout renders on the game camera.\n- Fixed shader fade-out starting from the wrong value when no fade-in ran first.\n- Fixed Stage Editor local image loading by decoding the selected image directly instead of copying an incomplete preview frame.\n- Added Stage Editor support for loading and preserving Animate Atlas spritemaps and their atlas settings.\n- Fixed missing stage images hard-crashing the Stage Editor; affected objects now use a visible placeholder and report the missing path.\n- Fixed Psych Engine imports so the song chart is selected first and the optional `events.json` file is selected second. Difficulty-suffixed and unsuffixed chart names are supported.\n- Fixed Android Chart Editor chart, instrumental, vocals, metadata, and import boxes not opening the document picker. Imported, opened, and new `.fnfc` charts now save under the top-level `Charts` folder beside `mods`.\n- Fixed mobile Chart Editor theme selection not applying reliably by placing Light and Dark directly in the touch-accessible View menu.\n- Fixed HUD Fade Player/Opponent targeting for icons, strumlines, note heads, sustain trails, hold covers, and incoming notes.\n- Fixed HUD Fade side previews reusing a stale cached frame after changing target or opacity.\n- Fixed overlapping Both, Player, and Opponent HUD fades fighting over the same stored target.\n- Fixed Shift-clicking a placed event crashing when its event type was not already present in the Event Data dropdown.\n- Fixed Shader event tooltips listing controls that do not apply to the selected target or property type.\n- Fixed disabling `Ignore Transparent Pixels` still preserving fully transparent pixels instead of processing the complete sprite texture.\n- Fixed HUD Fade values remaining on note heads, sustains, hold covers, strumlines, icons, or the health bar after retrying or pressing F5.\n- Fixed Health Drain applying only one health change instead of remaining active until another Health Drain event changes or stops it.\n- Fixed helper-based fragment shaders such as `rain.frag` failing to compile through the normal runtime shader path.\n- Fixed simultaneous Shader properties cancelling each other's tweens when they shared one shader tag.\n- Fixed song-cache cleanup trying to unload a missing `songs` asset library.\n- Fixed Low Quality changing the saved Shaders option instead of temporarily overriding it during gameplay.\n- Fixed Low Quality Max disabling the hidden Freeplay difficulty controls and preventing difficulty changes.\n- Fixed stage changes retaining references to culled sprites from the destroyed stage.\n- Restored the original A-Bot visualizer after automatic audio-source switching stopped VIZ bars from working.\n- Restored the original cached instrumental and vocal loading path so completed songs reliably leave gameplay again.\n- Reverted the recent Character Select icon tint changes to the original behavior.\n- Stabilized Character Select analyzer reconnects and limited its updates to 30 Hz without changing its visible behavior.\n- Fixed failed or interrupted week cutscenes leaving video, dialogue, conductor, music, or black-screen objects alive.\n- Fixed cache retirement destroying source atlases still used by combined Chart Editor note and event-icon frame collections.\n- Fixed repeated Freeplay, Story Mode, and Options visits retaining a Freeplay rank camera, faded Story backgrounds, and the previous Options state.\n- Fixed Philly Streets rain filters replacing unrelated camera filters, remaining registered after the stage closed, or returning when song shaders were disabled.\n- Fixed Shader events leaving native character, object, stage, and camera shaders active. Removed shaders are restored safely after retry, reset, or F5.\n- Fixed LuaSlice camera shaders replacing unrelated existing camera filters instead of preserving and restoring them.\n- Fixed variation headers not becoming active before `Remove Variation`, which incorrectly tried to remove the Default variation.\n- Fixed delayed memory cleanup destroying Freeplay album artwork that was still in use.\n\n## [0.0.5] - 2026-07-12\n\n### Added\n\n- Added a `Psych Engine (V1.0.4)` Chart Editor importer for notes, sustains, BPM changes, characters, stages, note types, embedded events, and companion `events.json` files.\n- Added a macOS GitHub Actions workflow that builds both the iOS Simulator app and an unsigned ARM64 IPA for physical iPhones. The Windows batch file starts the build and downloads both artifacts automatically.\n- Added a working Downscroll view to the Chart Editor, including notes, hold notes, events, grid navigation, playhead controls, measure markers, and the note preview.\n- Added `Change Stage`, which replaces the active stage and loads its JSON, scripts, shaders, character positions, and camera data.\n- Added `Change Character`, which replaces the Player, Opponent, or Girlfriend and loads matching `.lua`, `.luag`, `.hx`, and `.hxc` character scripts when the event runs.\n- Added Chart Editor icons for `Change Stage` and `Change Character` events.\n- Added optimized Lua helpers for namespaced sprite, camera, debug, property, save, shader, script, timer, song, and event usage.\n- Added batch property updates and cached property refs so scripts can avoid repeated string-path work in `onUpdate`.\n- Added lazy event helpers like `song.atBeat`, `song.atStep`, `event.on`, and `event.once` so scripts can use event-based logic instead of polling every frame.\n- Added a Performance tab in Options.\n- Added a song shader toggle for stage and character shaders.\n- Added Low Quality modes: `None`, `Minimal`, and `Max`.\n- Added a live Lua API registry with `LuaSlice.api.list`, `LuaSlice.api.find`, `LuaSlice.api.docs`, and `LuaSlice.api.writeDocs`.\n- Added Lua group/layer helpers so scripts can organize sprites and apply shared alpha, layer, property, and tween changes.\n- Added `LuaSlice Lua API.md` as a full Lua API reference beside the engine changelog.\n- Added safer namespaced helpers for window titles, characters, stages, options, tween pause/resume, camera tweens, beat ranges, script information/control, shader checks, and table-configured option pages.\n\n### Changed\n\n- Updated the main menu and Lua API version to `0.0.5`.\n- Moved FPS, Unlocked/Unlimited FPS, VSync, Debug Display, and Debug Display BG from Preferences into the Performance page.\n- Removed unused and unnecessary development assets and images to reduce the release size.\n- Successful builds now create a timestamped summary and print `Build Log located at: PATH` when they finish.\n- Optimized Chart Editor redraws by reusing render lists, avoiding unchanged HaxeUI updates, and skipping repeated event-icon and sorting work. (Paused around 800~ FPS, while song playing around 630~700.)\n- Updated the optional pause Options example to return to the song through `howExit` without hiding the Options `EXIT` item.\n- Optimized Lua hook dispatch so isolated `.lua` hooks are cached when scripts load, and unused hooks are skipped instead of being searched every call.\n- Updated `mod-example.zip` with examples for save, debug, property refs, event helpers, timers, and namespaced shader usage.\n- Low Quality `Minimal` now trims heavier Freeplay UI, disables song shaders, hides HUD icons, and culls fully off-camera stage sprites during gameplay.\n- Low Quality `Max` now hides the health bar, combo numbers, hold covers, extra Freeplay decorations, and the rare alternate pause route.\n- Updated `mod-example.zip` with clearer optimized API and Performance Options examples.\n- Low Quality `Max` now keeps the DJ background/backcard visible like `Minimal`.\n- Low Quality `Max` now keeps rating popups such as `Sick` and `Good`, while still hiding combo numbers.\n- Updated `mod-example.zip` with a group/layer/API docs example.\n- Updated `mod-example.zip` with an example covering the latest safe API helpers.\n\n### Fixed (From V0.0.5 and Before)\n\n- Fixed Android Unlimited FPS appearing inconsistently and only changing LuaSlice's software cap without requesting the display's highest supported refresh mode.\n- Replaced the mobile Save Data Options `EXIT` list item with the normal touch back button.\n- Fixed Nene's A-Bot visualizer being hidden by Low Quality off-screen culling and made Char Select reconnect its music analyzer reliably.\n- Reworked Player and Opponent Preview bounds for regular, pixel, spritesheet, and atlas characters. Idle and active animations are measured once, cached, and added to a stable envelope that preserves animation offsets without rescanning every frame.\n- Fixed `Change Stage` support for Erect stages by fully unloading the old stage, creating a fresh scripted stage, clearing stale shaders, and rerunning the new stage's `.hxc` setup and character positioning.\n- Fixed broken stage or character scripts repeatedly opening error windows. Invalid scripts are skipped and scripted characters/stages fall back to their data implementation when possible.\n- Fixed failed global `.luag` files leaving partially registered hooks active.\n- Fixed stage and character changes not resetting correctly after restarting or reloading Lua with F5.\n- Fixed Nene's A-Bot support objects and visualizer not attaching or initializing when `Change Character` replaces Girlfriend mid-song.\n- Fixed pausing after repeated character changes crashing when pause music could not allocate or load.\n- Fixed Chart Editor Playtest's `Enable Song Scripts` only controlling `.hxc`; it now also controls song-scoped `.luag` scripts without adding `.lua` to the toggle.\n- Fixed saved Chart Editor Downscroll reopening with an upscroll waveform and note overview.\n- Fixed shader cleanup failing Windows compilation because of Haxe null-safety checks.\n- Fixed oversized and unreliable mobile Main Menu touch boxes by matching touches against the rendered menu artwork on Android and iOS.\n- Fixed Android Preferences touch checks after scrolling and stabilized Unlimited FPS visibility by caching the device's maximum supported refresh rate.\n- Fixed Downscroll cursor placement snapping one note-snap level too early.\n- Fixed multi-note mouse dragging reusing the previous drag offset.\n- Fixed Lua shader application still being allowed in PlayState when song shaders are disabled by Performance settings.\n- Fixed Freeplay becoming stuck after Low Quality hid objects before the Freeplay intro finished setting up input.\n- Fixed the Performance tab becoming hard to navigate when Low Quality disabled the Shaders row.\n- Fixed Low Quality `Max` still allowing note splashes.\n- Fixed Low Quality `Max` Freeplay album art, album titles, stars, highscore digits, and clear percent being able to reappear after later Freeplay updates.\n- Fixed Low Quality `Max` Character Select still showing the crowd and nametag while keeping the character/GF visualizer visible.\n\n## [0.0.4] - 2026-06-27\n\n### Added\n\n- Added `configureLuaPauseMenu({...})` so Lua can edit built-in pause items, hide items, add custom entries, and change item positions.\n- Added `setLuaPauseMenuItem(matchOrId, label, position, target, hidden)` for simple base/custom pause menu edits.\n- Added pause menu targets for `resume`, `restartSong`, `changeDifficulty`, `practiceMode`, `exitToMenu`, `options`, `callback`, and custom `.hx/.hxc` state classes.\n- Added pause-opened Options support so Lua can hide the Options `EXIT` item and control where exiting Options goes.\n- Added a configurable Lua pause menu shortcut example.\n- Added `initLuaShader(name)` for loading a shader by name.\n- Added `setShaderOnSprite(sprite, tag)` for simple sprite shader assignment.\n- Added `getLuaSave(key, fallback)` and `setLuaSave(key, value)` for persistent Lua data.\n- Added Freeplay, Story Menu, and Results Lua hooks.\n- Added `-DFEATURE_LOGGER` for cleaner live Lua script/error/variable logging during dev builds.\n- Added `-DNO_LUA` as a simple way to build LuaSlice without Lua support.\n- Added `setLuaPauseOptions(howExit)` so pause-opened Options return behavior is set through a clear API instead of item config fields.\n- Added pause item config so targets like Options can have pause-only behavior without changing the normal menus.\n- Added timestamped build logs under `BuildLogs/<target>/` so new logs do not overwrite older ones.\n- Added one naming pattern for build logs: `BuildLogs/<target>/log-<target>build-YYYY-MM-DD-HH-MM-SS[-label].txt`.\n- Added a Save Data Options page for clearing all data, song data, options, or controls separately.\n- Added an Android Unlimited FPS option for displays that report support above 60 Hz.\n\n### Changed\n\n- Updated the main menu version text to `V-slice: v0.8.5 | LuaSlice: v0.0.4`.\n- Reworked Lua shader helpers so simple scripts can use `initLuaShader`, `makeLuaShader`, `setLuaShader`, or `setShaderOnSprite`.\n- Reworked Lua error popups so useful suggestions show in the popup, not only in the report file.\n- Made the Lua API default for normal native builds, so `lime build windows` and `lime test windows` include it without extra defines.\n- Changed `-DFEATURE_LOGGER` builds to output under `export/logger`.\n- Updated the pause menu example so custom item ids can target actions like `practiceMode`, `restartSong`, or `options`.\n- Updated the example Modifiers options page with health drain and watermark controls.\n- Replaced the old pause add/hide example with a config-based `.luag` example.\n- Reworked pause menu config so scripts can define it once and LuaSlice applies it whenever the pause menu opens.\n- Added an isolated `.lua` pause shortcut example beside the `.luag` copy so global hook conflicts cannot hide the Options entry.\n- Added the missing example script folders to `mod-example`.\n- Added simple menu and shader example scripts to `mod-example`.\n- Updated the health drain example so it stops draining while the player is singing.\n- Updated example scripts to use the simpler pause/menu/shader helper functions.\n- Replaced the old Options-only pause example with a target-based pause menu example.\n- Organized engine changelogs into `changelogs/`.\n- Organized build logs into `BuildLogs/<target>/`.\n- Organized extra/source packaging files into `other/`.\n- Organized icon and art files under `art/` and `art/icons/`.\n- Organized setup docs under `docs/setup/`.\n- Kept the example mod package at `example_mods/mod-example.zip` and removed the old RAR package.\n- Restored Android as a playtest target after fixing the startup and orientation problems.\n- Made the Android forced-landscape patch run from the project postbuild step, so it survives clean Android exports.\n\n### Fixed\n\n- Fixed returning from Main Menu targets resetting selection back to Story Mode.\n- Changed Android package/save branding from Funkin defaults to LuaSlice branding, using Fla-man-OFFICIAL for save path and LuaSlice for company/app metadata.\n- Fixed Lua table conversion so reading mixed/sparse tables does not corrupt Lua iteration or drop numeric entries.\n- Fixed Lua-created objects not being destroyed outside PlayState during reload/cleanup.\n- Fixed F5 hot reload being able to run twice in the same frame.\n- Fixed duplicate Lua main menu items leaving old sprites behind.\n- Fixed Lua option pages being able to collide with built-in Options pages.\n- Fixed Lua shader camera filters stacking when reapplied.\n- Fixed Lua note payload fields turning null values into the string \"null\".\n- Hardened Lua number argument reads so non-number values fall back safely.\n- Fixed Lua pause menu config positions so very low values clamp to the top and very high values clamp to the bottom.\n- Cleaned up PlayState Lua folder reload rules so F5 keeps `scripts/lua`, `scripts/luag`, menu, and options behavior consistent.\n- Fixed pause menu config only working during the pause hook instead of from normal script setup.\n- Hardened the pause shortcut example so it reapplies config from `onCreate`, `onReload`, and `onPauseMenuCreate`.\n- Fixed pause-opened Options leaving keyboard input disabled, which broke retry and back controls after returning or dying.\n- Updated Lua error-window suggestions for v0.0.3-v0.0.4 APIs, including pause menu, options, menus, shaders, reload, and event APIs.\n- Fixed Lua error suggestions being hidden from the popup even when the report had one.\n- Fixed missing direct API bindings for the simple shader helper names.\n- Improved Lua error popups so FPS/memory warnings only show for hooks that can spam errors, while reports still use `None` when no useful suggestion exists.\n- Moved Android build/runtime logs into `BuildLogs/android` and kept the clean log split into `# Info` and `# Error/s`.\n- Updated project paths for organized `other`, `changelogs`, and `art/icons` folders.\n- Fixed hold-cover cleanup/reuse so recycled sustain notes do not keep stale cover links or crash when a cover ends without a valid hold note.\n- Fixed pause-opened Options hiding `EXIT` leaking into normal Main Menu Options.\n- Removed noisy per-frame perf spam from the Lua logger.\n- Simplified the pause Options example so it only adds the Lua Options shortcut instead of replacing the whole pause menu.\n- Updated the pause Options example to configure the pause-opened Options screen directly with `hideExit` and `howExit`.\n- Verified the Windows Lua-enabled build still compiles after the latest fixes.\n- Verified the Windows build after removing the Android export folders.\n- Fixed Android startup crashes caused by early mobile rendering and asset loading paths.\n- Fixed Android main menu rendering so late or missing menu graphics do not crash the app.\n- Fixed Android Freeplay backcard loading so missing bitmap data does not kill the state.\n- Fixed Android packaging so the APK uses fixed landscape orientation.\n- Verified the Android APK installs, opens, plays music, and reaches the main menu in landscape.\n- Fixed Android/emulator menu input being blocked when an external input device is detected.\n- Hardened Android song audio loading so failed instrumental or vocal loads log cleanly instead of breaking PlayState.\n- Fixed Stage Editor `.fnfs` zip loading for asset names with dots in the filename.\n- Fixed Stage Editor animated object exports saving stale animation data after replacing or failing to add an animation.\n- Fixed Stage Editor animated object JSON ordering so saved animations follow the real animation list.\n- Fixed Stage Editor animation editing so graphic/frame/animation changes mark the stage as unsaved.\n- Hardened Stage Editor object loading against missing animation fields, missing bitmap entries, and null offsets.\n- Fixed the Android x86_64 Lime/SDL Java mismatch that caused an immediate startup crash in the emulator.\n- Reduced Android-only menu and Freeplay rendering costs without changing desktop visuals.\n- Fixed Android Unlimited FPS freezing the app by replacing the invalid zero-rate path with a safe high software ceiling.\n- Removed the unintended built-in Options entry from the pause menu; Lua scripts can still add one when requested.\n- Made the pause Options example opt-in so installing `mod-example` does not change the pause menu by default.\n- Fixed Android Open Data Folder to open LuaSlice's external data directory through the system file picker.\n- Updated Android Unlimited FPS detection to check all refresh rates supported by the display and hide the option on 60 Hz-only devices.\n- Hardened Stage Editor stage and animated-object loading against missing props, scroll values, and animation arrays.\n- Verified the Android title screen, main menu, Options, Freeplay, gameplay, and improved FPS in the emulator.\n- Verified the Windows Stage Editor build after the latest fixes.\n- Verified final Android and Windows builds with Save Data Options, refresh-rate detection, ZIP-only examples, and the Open Data Folder fix.\n- Fixed Clear Songs Data leaving Story Mode level and Tutorial scores behind while only clearing Freeplay scores.\n- Fixed Main Menu input remaining active during item transitions, which allowed another item to be selected before the first transition finished.\n- Fixed Android launcher icons so builds use `art/icons/builds/android/IconAndroid.png` instead of expecting a missing adaptive-icon resource pack.\n\n## [0.0.3] - 2026-06-18\n\n### Added\n\n- Added a cleaner Lua manager layer for options, menus, shaders, and Lua error windows.\n- Added real Lua Options menu support, including saved checkboxes and page positioning.\n- Added Lua main menu support so scripts can insert real main menu entries and open base game menus or custom `.hx/.hxc` states.\n- Added Lua image menu helpers for simple custom menu layouts.\n- Added `mod-example.zip` alongside the RAR example package for easier sharing.\n\n### Changed\n\n- Updated the main menu version text to `V-slice: v0.8.5 | LuaSlice: v0.0.3`.\n- Reworked the Lua support notes into `CHANGELOG - ENGINE.md` so the API list and engine changes live in one place.\n- Improved Lua error reports with cleaner Lua-only formatting, source file lists, and practical suggestions.\n\n### Fixed\n\n- Fixed Lua hot reload so F5 and `reloadLuaScripts()` both rescan scripts safely.\n- Fixed Lua API errors from bad fields, missing optional event fields, broken hooks, and unsafe reflection calls.\n- Fixed Lua-created objects not always cleaning up correctly after reloads or script errors.\n- Fixed menu and options Lua scripts loading in PlayState instead of only in their matching menus.\n- Fixed Lua main menu entries with bad atlases or custom state targets failing too hard.\n- Fixed Lua error reports so they show script line numbers when Lua provides them.\n- Reduced repeated Lua error popups so bad scripts do not keep hurting FPS or memory.\n- Improved Lua error popup wording so it clearly says which script file needs fixing.\n- Fixed title screen cleanup and reduced extra work during title/menu updates.\n\n## [0.0.2] - 2026-06-17\n\n### Added\n\n- Added direct Lua scripting support through hxlua.\n- Added `.lua` isolated scripts.\n- Added `.luag` global scripts.\n- Added F5 Lua hot reload in PlayState.\n- Added `reloadLuaScripts()` for hot reload from Lua.\n- Added Lua error popup windows instead of hard crashes.\n- Added Lua crash/error reports in `logs/lua`.\n- Added safer `setEventField()` behavior so bad fields do not break the engine.\n- Added more example scripts to `mod-example.rar`.\n- Added LuaSlice credits:\n - `Fla-man_OFFICAL`\n\n### Changed\n\n- Documented how the engine finds and loads `.lua` and `.luag` scripts.\n- Renamed `All the things Supported - Engine.txt` to `Lua API Support - Engine.txt`.\n- Made the Lua support document more professional.\n- Changed the main menu version text for LuaSlice.\n\n### Removed\n\n- Removed the visible `Login to NG` option from the options menu.\n\n### Fixed\n\n- Fixed several Lag Adjustment / Offset Calibration bugs.\n- Fixed the first calibration notes not appearing correctly.\n- Fixed broken Lua scripts being able to hard-crash the game in more cases.\n\n## [0.0.1] - 2026-06-16\n\n### Added\n\n- Started LuaSlice as a V-Slice `v0.8.5` engine fork.\n- Added the first LuaSlice source/package cleanup work.\n- Added the first Lua API planning notes.\n"},"changelog-psych":{"title":"Psych API changelog","md":"# Psych API changelog\n\nChanges to the Psych Lua API in LuaSlice.\n\n## [0.2.0] - 2026-10-26\n\n### Added\n\n- `addHScript`, `removeHScript`, `callOnHScript`, and `setOnHScript`. Loaded HScript files receive gameplay hooks, and `callOnScripts` and `setOnScripts` reach them too.\n- `addToGroup` and `removeFromGroup`.\n- Adobe Animate atlas functions: `makeFlxAnimateSprite`, `loadAnimateAtlas`, `addAnimationBySymbol`, and `addAnimationBySymbolIndices`.\n- `loadMultipleFrames`, `insertToCustomSubstate`, `exitSong`, `loadSong`, `getModSetting`, `startVideo`, `startDialogue`, and `updateScoreText`.\n- Rating setters, `onRecalculateRating`, and the rating, miss, hit, combo, botplay, and practice globals from Psych 1.0.4.\n\n### Compatibility\n\n- V-Slice has no Psych time bar. `setTimeBarColors` reports an unsupported-feature error; `isLuaFunctionSupported('setTimeBarColors')` returns `false`.\n- `startDialogue` uses V-Slice conversations, not Psych dialogue JSON. A path uses its file name as the conversation id.\n- `getModSetting` reads saved values or defaults from the mod's `data/settings.json`.\n- `loadSong` uses V-Slice song ids; spaces become dashes and names are lowercased.\n- File-based HScript keeps LuaSlice's existing import restrictions and error reporting.\n- Animate atlases use the standard `Animation.json` and spritemap filenames. Custom JSON filenames are not supported.\n- Videos use the engine's skippable, non-looping cutscene playback. Unsupported video options report an error rather than being silently ignored.\n\n## [0.1.5] - 2026-10-22\n\n### Added\n\n- LuaSlice custom script events call `onCustom(id, data)`. Return `Function_Stop` to cancel a cancelable event. This is a LuaSlice extension, separate from Psych chart events.\n- Haxe string-keyed Maps, including nested custom-event data, convert to Lua tables.\n- Sparrow hold bodies and end caps convert to continuous trails, preserving frame trim offsets, proportions and downscroll.\n\n### Fixed\n\n- Closing or unloading a script inside a callback waits until that callback returns before closing its Lua state.\n- Failed initialization and reload validation release their Lua states instead of leaving them registered.\n- Reloading clears old note overrides and owned splash sprites, and restores native note graphics.\n- Custom note-type scripts load in a consistent order.\n- Generated hold textures are reused by matching notes and released after their final user is gone during reload or song cleanup.\n- `onSpawnNote` receives the note's strum time as its fifth argument, matching Psych 1.0.4.\n\n### Changed\n\n- Script errors include the runtime, mod path, callback and Lua traceback. Identical errors are reported once per script instance.\n\n## [0.1.0] - 2026-09-28\n\n### Added\n\n- Added the Psych Engine 1.0.4 Lua API to LuaSlice.\n- Added `.luap` and `.luapg` scripts for songs, stages, characters, custom events, and note types.\n- Added script hot reload, including F5 and automatic file watching.\n\n### Changed\n\n- Switched from hxlua to hxluajit and hxluajit-wrapper.\n- LuaSlice's existing `.lua` and `.luag` scripts still use their own API.\n"}}};