Skip to content

scripting

Mily_0 edited this page Jul 18, 2026 · 10 revisions

weepoh

This page is still wip. Sorry if it take too long to finish, we are working on it.




1000014992

IMPORTANT LINKS:

Hscript Iris Page || Haxe API || Psych Engine's Lua API || Lua API

EXTRA LINKS:

PsychWiki (made by MemeFlavor!) || CNE API || NMV Scripting page || Vslice Hscript page




About

  • This section is entirely about the scripting feature of the engine. Highly modified from Psych Engine's system.

    As you may have seen, the engine supports scripting in .lua and .hxc. The paths are almost quite the same and essentially, works by the same.

SUMMARY
on Songs
on Characters
on Notetypes
on Events
on Dialogues (DialoguePlus)
on GameOver
on Dialogue Portraits
on Icons
on StoryMenu
on Pause Screen
Globally
Minor Scripting
API:
Lua API
Hscripting

Scripting on Songs

  • Scripting on songs is quite simple. You just need to add your LuaScript / Hscript at <ModFolder>/songs/<songName>/. Then, it should work normally.

  • All the callbacks and functions work perfectly at song scripts.

  • An example of a working Script for a song:

function onMoveCamera(target:String)
{
    if (target == 'boyfriend' || target == 'player') {
        cameraZoom(0.83, 4, 'elasticInOut', 'nll');
    } else if (target == 'dad' || target == 'opponent') {
        cameraZoom(0.75, 4, 'elasticInOut', 'nll');
    }
}

This script basically changes the camera zoom depending on who is focused.


Scripting on Characters

  • Scripting on Characters is almost the same thing. You just need to add your LuaScript / Hscript at data/characters/<charName>.*.
  • Thankfully by a wonderful person on Psych Mint server, now the characters itself don't have the specific functions for it.
  • What i mean is, instead of:
function onLoad() {
    dad.alpha = 0.6;
    dad.color = 'RED';
    dad.x = var + 445;
}
  • The characters scripts now work with:
function onLoad() {
    alpha = 0.6;
    color = 'RED';
    x = var + 445;
}
  • This is because, once a script is placed inside a character's folder, the engine automatically binds it to that character. From that point on, you no longer need to specify whether it's dad, boyfriend or gf. The script always refers to the character itself, regardless of which slot it is currently using. This means that if the same character is loaded as the opponent, the player, or the girlfriend, the exact same script will work without any changes.

Neutral functions can be seen on the API down below!


Important

Just noticed this was not added to the actual build FOR WAY TOO LONG HOLY SHIT

Scripting on Notetypes

  • Scripting on notetypes are the way custom notes react when they are pressed. Naturally, their path is <modFolder>/data/notetypes/<notetype>.*.

  • Notes work similar to Characters. Their Scripts are binded to the note itself, not needing to nothing but but vars from functions.

  • example script:

function onLoad() {
    // later i put shit on here
}

makes the character sings a different animation prefix.

  • noteData - Note index from 0 to 3. ( l = 0 || image = 1 || image = 2 || image = 3 )
  • noteType - Current note-type of your note.
  • isSustainNote - Whether the notes are a sustain note, or not.
  • strumIndex - which strum index. ( 0 to whatever index of strum. Or image player to Specifically Player's Strum. )

Up-to-date Field

  • missType - Can be either press, miss or both.

deixar aqui cmg pra dps eu coisar em casa bleeehhh

function onNoteHit(noteData:Int, noteType:String, isSustainNote:Float, ?strumIndex:Int)

function onNotePre(noteData:Int, noteType:String, isSustainNote:Float, ?strumIndex:Int)

function onNoteMiss(noteData:Int, noteType:String, isSustainNote:Float, ?missType:Int, ?strumIndex:Int)

function onSpawnNote(noteData:Int, noteType:String, isSustainNote:Float, ?strumIndex:Int)


Hscripting image

  • Hscripting is a way of writing haxe on scripts easier. And also, it's the most recommended way of scripting at the engine, with the supported file formats are .hx, .hxc and .hscript.
  • You can do whatever you want with Haxe scripts. Including, but not limited to: Characters, Stages, States, In-game Scripts, Icons, Notes and etc.

Global Functions

Function About
onLoad() / onCreate() runs immediately upon the script is created.
onCreatePost() runs immediately AFTER super.create();.
onUpdate(elapsed:Float) runs at update function.
onUpdatePost(elapsed:Float) similar to onUpdate(), but it runs AFTER onUpdate().
onDestroy() runs right upon a state is destroyed.
onSubstateOpen() aint got no time
onSubstateClose() fuck

Clone this wiki locally