Skip to content

Scripting

TheRealJake_12 edited this page Apr 19, 2024 · 11 revisions

How To Use HScript Modcharts. (Introduced In Version 1.7).

Cannot Be Used In Menus Or States.

Notice Regarding Modcore

Lua Modcharts Cannot Be Used With Modcore. The Game Scans Using FileSystem Instead Of OpenFlAssets. This Means That The Game Cannot Detect Modcharts Using Modcore.

How Does It Work?

The Game Will Scan A Chart Folder And See If It Contains A .hx File. It Shouldn't Matter What The Script Is Named (i.e : test.hx, script.hx).

If You Want To Have A Script On Every Song, You Can Put A Script In Assets/Shared/Data/Scripts.

You Cannot Use Scripts In Other States. No MainMenuState. No FreeplayState. No Nothing.

Basic Functions

Functions. You Need Them. In Your Script, You Need These 4 Functions As A Base.

function create()
{
    
}

function update()
{
    
}

function beatHit()
{
	
}

function stepHit()
{
   
}

These Functions Will Be Executed Depending On The Function (i.e : update will update every frame. stepHit will update every step. etc.).

A Neat Function To Call Whenever Debugging Is Debug.logTrace();. The Trace Will Appear In The Logs Folder In The Current Log.

Note : There Are Other Functions That Exist Too.

A Complete List Of Functions That Can Be Used With HScript. (With Arguments.)

create
createPost
update(elasped)
stepHit(curStep)
beatHit(curBeat)
sectionHit(curSection)
countdown
countTick(3,2,1)
ghostTap(what key was pressed)
startSong
notesUpdate
noteMiss(note)
updateAccuracy
opponentNoteHit(note)
goodNoteHit(note)
playerOneTurn
playerTwoTurn

A Complete List Of Variables Already Defined.

bpm
step
mustHitSection
PlayState
game
health
camGame
camHUD
camFollow
camZoom
boyfriend
dad
gf
notes
strumLineNotes
unspawnNotes

Some Of These May Be Broken. You Can Also Get Variables / Call Functions From PlayState That Aren't Listed By Doing game.FUNCTION Or game.VARIABLE