Main Menu & Freeplay Lua - Dsfan2/PsychEngineDS GitHub Wiki

For Main Menu & Freeplay Lua Scripts, put your scripts into the "scripts/" folder and name it "mainmenu.lua" for the Main Menu, and "freeplay.lua" for Freeplay Most of the Play State Lua functions carry over to Main Menu & Freeplay Luas but there are some differences.


Main Menu Lua Variables

  • curSelected - The number ID of the selection on the Main Menu you're currently hovering over.
  • version - The current build's version of Psych Engine DS.
  • menuItems - The list of Main Menu options.

Freeplay Lua Variables

  • curSong - The currently selected song.
  • curDifficulty - The currently selected difficulty.
  • songList - The list of songs that are currently visible in Freeplay.

NOTE: Not all the functions and callbacks from Play State Lua will work in Main Menu & Freeplay Luas.


Main Menu Lua Callbacks

function onCreate()- triggered when the lua file is started, some variables weren't created yet

function onCreatePost()- end of "create"

function onDestroy()- triggered when the lua file is ended (Song fade out finished)

function onUpdate(elapsed)- start of "update", some variables weren't updated yet

function onUpdatePost(elapsed)- end of "update"

function onSelectionChange(curSelected)- triggered when you switch between menu items

function onItemSelected(curSelected)- tiggered when you select an option by pressing Enter


Freeplay Lua Callbacks

function onCreate()- triggered when the lua file is started, some variables weren't created yet

function onCreatePost()- end of "create"

function onDestroy()- triggered when the lua file is ended (Song fade out finished)

function onUpdate(elapsed)- start of "update", some variables weren't updated yet

function onUpdatePost(elapsed)- end of "update"

function onSelectionChange(curSelected)- triggered when you switch between songs

function onDifficultyChange(curDifficulty)- triggered when you switch between difficulties

function onSongSelected(curSelected)- triggered when you select a song by pressing Enter