Repository navigation
Lua Script API: Variables
Meme1079 edited this page Sep 1, 2024
·
48 revisions
Note
These are the only variables that can be changed using = true or = false; Example: luaDebugMode = true. For now you will have to use the setProperty() function if you want to change the rest of the variables.
-
Function_StopLua- Stops the Lua function from getting called on the rest of the Lua scripts; Must be returned. -
Function_StopHScript- Stops the Haxe function from getting called on the rest of the Haxe scripts; Must be returned. -
Function_StopAll- Stops the Lua and Haxe function from getting called on the rest of the Lua and Haxe scripts; Must be returned. -
Function_Stop- Stops the function that this is used on; Must be returned. -
Function_Continue- Resumes the function that this is used on; Must be returned. -
luaDebugMode- Enables debug mode; Default value:false. -
luaDeprecatedWarnings- Checks if the function or variable is deprecated or not; Only works in debug mode tho. -
inChartEditor- Checks if the Lua script is running inside the Chart Editor's chart playtest.
-
curBpmReturns the current BPM value of the song. -
bpm- Returns the starting BPM value of the song. -
scrollSpeed- Returns the current scroll speed of the song. -
crochet- Returns the interval betweencurBeatvariable. -
stepCrochet- Returns the interval betweencurStepvariable. -
songLength- Returns the maximum song length displayed in milliseconds. -
songName- Returns the current song name. -
songPath- Returns the song's path. -
charPath- Returns the song's chart path to the file. -
startedCountdown- Checks if the countdown has already begun. -
curStage- Returns the current stage of the song. -
isStoryMode- Checks if the song is in story mode or not. -
difficulty- Returns the current difficulty ID number. -
difficultyName- Returns the current difficulty name, value will be affected by language selected. -
difficultyNameTranslation- Returns the translated the difficulty name. -
difficultyPath- Returns the current difficulties path. -
weekRaw- Returns the current week number. -
week- Returns the current week name from the JSON file name. -
seenCutscene- Checks if the cutscene has already been seen. -
hasVocals- Checks if the song has vocals enabled or not.
All Shortcut to:
-
curBpm-getPropertyFromClass('backend.Conductor', 'bpm') -
bpm-getPropertyFromClass('states.PlayState', 'SONG.bpm') -
scrollSpeed-getPropertyFromClass('states.PlayState', 'SONG.speed') -
crochet-getPropertyFromClass('backend.Conductor', 'crochet') -
stepCrochet-getPropertyFromClass('backend.Conductor', 'stepCrochet') -
songLength-getPropertyFromClass('flixel.FlxG', 'sound.music.length') -
songName-getPropertyFromClass('states.PlayState', 'SONG.song') -
songPath-callMethodFromClass('backend.Paths', 'formatToSongPath', {songName}) -
startedCountdown-getProperty('startedCountdown') -
curStage-getPropertyFromClass('states.PlayState', 'curStage') -
loadedSongName-getPropertyFromClass('backend.Song', 'loadedSongName') -
loadedSongPath-callMethodFromClass('backend.Paths', 'formatToSongPath', {loadedSongPath}) -
isStoryMode-getPropertyFromClass('states.PlayState', 'isStoryMode') -
difficulty-getPropertyFromClass('states.PlayState', 'storyDifficulty') -
difficultyName-callMethodFromClass('backend.Difficulty', 'getString', {difficulty, false}) -
difficultyNameTranslation-callMethodFromClass('backend.Difficulty', 'getString', {difficulty, true}) -
difficultyPath-callMethodFromClass('backend.Paths', 'formatToSongPath', {difficultyName}) -
weekRaw-getPropertyFromClass('states.PlayState', 'storyWeek') -
week-getPropertyFromClass('backend.WeekData', 'weeksList['..weekRaw..']') -
seenCutscene-getPropertyFromClass('states.PlayState', 'seenCutscene') -
hasVocals-getPropertyFromClass('states.PlayState', 'SONG.needsVoices')
Deprecated Original Shorcuts:
-
curBpm-getPropertyFromClass('Conductor', 'bpm') -
bpm-getPropertyFromClass('PlayState', 'SONG.bpm') -
songSpeed-getPropertyFromClass('PlayState', 'SONG.speed') -
crochet-getPropertyFromClass('Conductor', 'crochet') -
stepCrochet-getPropertyFromClass('Conductor', 'stepCrochet') -
songName-getPropertyFromClass('PlayState', 'SONG.song') -
songPath-runHaxeCode('Paths.formatToSongPath('..songName..');') -
startedCountdown-getProperty('startedCountdown') -
curStage-getPropertyFromClass('PlayState', 'curStage') -
isStoryMode-getPropertyFromClass('PlayState', 'isStoryMode') -
difficulty-getPropertyFromClass('PlayState', 'storyDifficulty') -
difficultyName-getPropertyFromClass('CoolUtil', 'difficulties['..difficulty..']') -
difficultyPath-runHaxeCode('Paths.formatToSongPath(Difficulty.getString());') -
weekRaw-getPropertyFromClass('PlayState', 'storyWeek') -
week-getPropertyFromClass('WeekData', 'weeksList['..weekRaw..']') -
seenCutscene-getPropertyFromClass('PlayState', 'seenCutscene') -
hasVocals-getPropertyFromClass('PlayState', 'SONG.needsVoices')
-
curStep- The current step per number. -
curBeat- The current beat per number. -
curSection- The current section per number. -
curDecStep- The current decimal step per number. -
curDecBeat- The current decimal beat per number. -
score- The current amount of score inside the song. -
misses- The current amount of note misses inside the song. -
hits- The current amount of note hits inside the song. -
combo- The current amount of note combo inside the song. -
rating- The current song score rating percent; Goes from0to1. -
ratingName- The current song score rating name. -
ratingFC- The current song score rating combo. -
version- The current version of Psych Engine. -
inGameOver- Checks if the player is in the game-over screen or not. -
mustHitSection- Checks if the section is aMust Hit Sectionfrom the Chart Editor. -
altAnim- Checks if the section is anAlt Animationsection from the Chart Editor. -
gfSection- Checks if the section is aGF Sectionfrom the Chart Editor. -
buildTarget- Checks the current OS that the current Psych Engine is running on; Can return:windows,linux,mac,browser,android,switch, orunknown.
All Shortcut to:
-
curStep-getProperty('curStep') -
curBeat-getProperty('curBeat') -
curSection-getProperty('curSection') -
curDecStep-getProperty('curDecStep') -
curDecBeat-getProperty('curDecBeat') -
score-getProperty('songScore') -
misses-getProperty('songMisses') -
hits-getProperty('songHits') -
combo-getProperty('combo') -
rating-getProperty('ratingPercent') -
ratingName-getProperty('ratingName') -
ratingFC-getProperty('ratingFC') -
version-getPropertyFromClass('states.MainMenuState', 'psychEngineVersion') -
inGameOver- (Exclusive to Lua and HScript) -
mustHitSection-getPropertyFromClass('states.PlayState', 'SONG.notes['..curSection..'].mustHitSection') -
altAnim-getPropertyFromClass('states.PlayState', 'SONG.notes['..curSection..'].altAnim') -
gfSection-getPropertyFromClass('states.PlayState', 'SONG.notes['..curSection..'].gfSection')
Deprecated Original Shorcuts:
-
version-getPropertyFromClass('MainMenuState', 'psychEngineVersion') -
mustHitSection-getPropertyFromClass('PlayState', 'SONG.notes['..curSection..'].mustHitSection') -
altAnim-getPropertyFromClass('PlayState', 'SONG.notes['..curSection..'].altAnim') -
gfSection-getPropertyFromClass('PlayState', 'SONG.notes['..curSection..'].gfSection')
-
healthGainMult- The amount of health gain when hitting a note. -
healthLossMult- The amount of health loss when missing/missinputting a note. -
playbackRate- The play-back rate multiplier of the song. -
guitarHeroSustains- Checks if Guitar Hero Sustains are enabled. (Sustains As One Note Option) -
instakillOnMiss- Enables instant death when missing/missinputing a note. -
botPlay- Checks if Botplay is enabled or not. -
practice- Checks if Practice Mode is enabled or not.
All Shortcut to:
-
healthGainMult-getProperty('healthGain') -
healthLossMult-getProperty('healthLoss') -
playbackRate-getProperty('playbackRate') -
guitarHeroSustains-getProperty('guitarHeroSustains') -
instakillOnMiss-getProperty('instakillOnMiss') -
botPlay-getProperty('cpuControlled') -
practice-getProperty('practiceMode')
-
downscroll- Checks if downscroll is enabled or not. -
middlescroll- Checks if middlescroll is enabled or not. -
framerate- Returns the current framerate inside the options menu. -
ghostTapping- Checks if ghost tapping is enabled or not. -
hideHud- Checks if the score txt/health bar/rating elements will be hidden or not. -
timeBarType- Checks the current time-bar txt display type. -
scoreZoom- Checks if the score will do a zoom bop when hitting a note. -
cameraZoomOnBeat- Checks if the camera will do a zoom every section. ("Add Camera Zoom" event will not work if this is disabled) -
flashingLights- Checks if flashing lights are enabled or not. (Disable this, if you have epilepsy!) -
noteOffset- Checks the note offset displayed in milliseconds; Goes from0to500. -
healthBarAlpha- Checks the current amount of alpha/opacity value of the health bar. -
noResetButton- Checks if the reset button is enabled or not. -
lowQuality- Checks if low quality on songs, is enabled or not. (Enable it, if you have a potato computer) -
shadersEnabled- Checks if shaders are enabled or not. (Disable it, if you have motion sickness!) -
scriptName- Returns the script path. -
currentModDirectory- Checks the current mod directory. -
noteSkin- Checks the current noteskin that the player is using. -
noteSkinPostfix- Checks the current noteskin postfix from the current noteskin image name that the player is using. -
splashSkin- Checks the current splashskin that the player is using. -
splashSkinPostfix- Checks the current splashskin postfix from the current splashskin image name that the player is using. -
splashAlpha- The current alpha/opacity value of the splashnote.
All Shortcut to:
-
downscroll-getPropertyFromClass('backend.ClientPrefs', 'data.downScroll') -
middlescroll-getPropertyFromClass('backend.ClientPrefs', 'data.middleScroll') -
framerate-getPropertyFromClass('backend.ClientPrefs', 'data.framerate') -
ghostTapping-getPropertyFromClass('backend.ClientPrefs', 'data.ghostTapping') -
hideHud-getPropertyFromClass('backend.ClientPrefs', 'data.hideHud') -
timeBarType-getPropertyFromClass('backend.ClientPrefs', 'data.timeBarType') -
scoreZoom-getPropertyFromClass('backend.ClientPrefs', 'data.scoreZoom') -
cameraZoomOnBeat-getPropertyFromClass('backend.ClientPrefs', 'data.camZooms') -
flashingLights-getPropertyFromClass('backend.ClientPrefs', 'data.flashing') -
noteOffset-getPropertyFromClass('backend.ClientPrefs', 'data.noteOffset') -
healthBarAlpha-getPropertyFromClass('backend.ClientPrefs', 'data.healthBarAlpha') -
noResetButton-getPropertyFromClass('backend.ClientPrefs', 'data.noReset') -
lowQuality-getPropertyFromClass('backend.ClientPrefs', 'data.lowQuality') -
shadersEnabled-getPropertyFromClass('backend.ClientPrefs', 'data.shaders') -
scriptName- (Idk how to get this one) -
currentModDirectory-getPropertyFromClass('backend.Mods', 'currentModDirectory') -
noteSkin-getPropertyFromClass('backend.ClientPrefs', 'data.noteSkin') -
noteSkinPostfix-callMethodFromClass('objects.Note', 'getNoteSkinPostfix', {''}) -
splashSkin-getPropertyFromClass('backend.ClientPrefs', 'data.splashSkin') -
splashSkinPostfix-callMethodFromClass('objects.NoteSplash', 'getSplashSkinPostfix', {''}) -
splashAlpha-getPropertyFromClass('backend.ClientPrefs', 'data.splashAlpha')
Deprecated Original Shortcuts:
-
downscroll-getPropertyFromClass('ClientPrefs', 'downScroll') -
middlescroll-getPropertyFromClass('ClientPrefs', 'middleScroll') -
framerate-getPropertyFromClass('ClientPrefs', 'framerate') -
ghostTapping-getPropertyFromClass('ClientPrefs', 'ghostTapping') -
hideHud-getPropertyFromClass('ClientPrefs', 'hideHud') -
timeBarType-getPropertyFromClass('ClientPrefs', 'timeBarType') -
scoreZoom-getPropertyFromClass('ClientPrefs', 'scoreZoom') -
cameraZoomOnBeat-getPropertyFromClass('ClientPrefs', 'camZooms') -
flashingLights-getPropertyFromClass('ClientPrefs', 'flashing') -
noteOffset-getPropertyFromClass('ClientPrefs', 'noteOffset') -
healthBarAlpha-getPropertyFromClass('ClientPrefs', 'healthBarAlpha') -
noResetButton-getPropertyFromClass('ClientPrefs', 'noReset') -
lowQuality-getPropertyFromClass('ClientPrefs', 'lowQuality') -
shadersEnabled-getPropertyFromClass('ClientPrefs', 'shaders') -
currentModDirectory-getPropertyFromClass('Mods', 'currentModDirectory')
-
screenWidth- Returns the current width of the window screen; Default value:1280. -
screenHeight- Returns the current width of the window screen; Default value:720. -
cameraX- Returns the current x position of the camera. -
cameraY- Returns the current y position of the camera.
All Shortcut to:
-
screenWidth-getPropertyFromClass('flixel.FlxG', 'width') -
screenHeight-getPropertyFromClass('flixel.FlxG', 'height') -
cameraX-getProperty('camFollow.x') -
cameraY-getProperty('camFollow.y')
Deprecated Original Shortcuts:
-
cameraX-getProperty('camFollowPos.x') -
cameraY-getProperty('camFollowPos.y')
-
boyfriendName- Returns the current boyfriend character name. -
dadName- Returns the current opponent character name. -
gfName- Returns the current girlfriend character name. -
defaultBoyfriendX- The player's default x position, defined by the stage's JSON file. -
defaultBoyfriendY- The player's default y position, defined by the stage's JSON file. -
defaultOpponentX- The opponent's default x position, defined by the stage's JSON file. -
defaultOpponentY- The opponent's default y position, defined by the stage's JSON file. -
defaultGirlfriendX- The girlfriend's default x position, defined by the stage's JSON file. -
defaultGirlfriendY- The girlfriend's default x position, defined by the stage's JSON file.
All Shortcut to:
-
boyfriendName-getProperty('boyfriend.curCharacter') -
dadName-getProperty('dad.curCharacter') -
gfName-getProperty('gf.curCharacter') -
defaultBoyfriendX-getProperty('BF_X') -
defaultBoyfriendY-getProperty('BF_Y') -
defaultOpponentX-getProperty('DAD_X') -
defaultOpponentY-getProperty('DAD_Y') -
defaultGirlfriendX-getProperty('GF_X') -
defaultGirlfriendY-getProperty('GF_Y')
-
defaultPlayerStrumX0- The player's left arrow default x position value; Returns:732. -
defaultPlayerStrumX1- The player's down arrow default x position value; Returns:844. -
defaultPlayerStrumX2- The player's up arrow default x position value; Returns:956. -
defaultPlayerStrumX3- The player's right arrow default x position value; Returns:1068. -
defaultPlayerStrumY0- The player's left arrow default y position value; Returns:50(Upscroll) or570(Downscroll). -
defaultPlayerStrumY1- The player's down arrow default y position value; Returns:50(Upscroll) or570(Downscroll). -
defaultPlayerStrumY2- The player's up arrow default y position value; Returns:50(Upscroll) or570(Downscroll). -
defaultPlayerStrumY3- The player's right arrow default y position value; Returns:50(Upscroll) or570(Downscroll).
All Shortcut to:
-
defaultPlayerStrumX0-getPropertyFromGroup('playerStrums', 0, 'x') -
defaultPlayerStrumX1-getPropertyFromGroup('playerStrums', 1, 'x') -
defaultPlayerStrumX2-getPropertyFromGroup('playerStrums', 2, 'x') -
defaultPlayerStrumX3-getPropertyFromGroup('playerStrums', 3, 'x') -
defaultPlayerStrumY0-getPropertyFromGroup('playerStrums', 0, 'y') -
defaultPlayerStrumY1-getPropertyFromGroup('playerStrums', 1, 'y') -
defaultPlayerStrumY2-getPropertyFromGroup('playerStrums', 2, 'y') -
defaultPlayerStrumY3-getPropertyFromGroup('playerStrums', 3, 'y')
-
defaultOpponentStrumX0- The opponent's left arrow default x position value; Returns:92. -
defaultOpponentStrumX1- The opponent's down arrow default x position value; Returns:204. -
defaultOpponentStrumX2- The opponent's up arrow default x position value; Returns:316. -
defaultOpponentStrumX3- The opponent's right arrow default x position value; Returns:428. -
defaultOpponentStrumY0- The opponent's left arrow default y position value; Returns:50(Upscroll) or570(Downscroll) -
defaultOpponentStrumY1- The opponent's down arrow default y position value; Returns:50(Upscroll) or570(Downscroll) -
defaultOpponentStrumY2- The opponent's up arrow default y position value; Returns:50(Upscroll) or570(Downscroll) -
defaultOpponentStrumY3- The opponent's right arrow default y position value; Returns:50(Upscroll) or570(Downscroll)
All Shortcut to:
-
defaultOpponentStrumX0-getPropertyFromGroup('opponentStrums', 0, 'x') -
defaultOpponentStrumX1-getPropertyFromGroup('opponentStrums', 1, 'x') -
defaultOpponentStrumX2-getPropertyFromGroup('opponentStrums', 2, 'x') -
defaultOpponentStrumX3-getPropertyFromGroup('opponentStrums', 3, 'x') -
defaultOpponentStrumY0-getPropertyFromGroup('opponentStrums', 0, 'y') -
defaultOpponentStrumY1-getPropertyFromGroup('opponentStrums', 1, 'y') -
defaultOpponentStrumY2-getPropertyFromGroup('opponentStrums', 2, 'y') -
defaultOpponentStrumY3-getPropertyFromGroup('opponentStrums', 3, 'y')
Is the page in some way inaccurate? an error, a typo, or outdated data? To report it, use the "Issue Tab". Or do you wish to include a new function or add new information? use the "Pull Request Tab". Help is always appreciated!
- Event Callbacks
- Custom Sprite
- Custom Text
- Object Functions
- General Functions
- Scripting & File Functions
- Game Input Control Functions
- Language Translation
- HScript Functions
- Custom Substates
- Custom Shaders
- Deprecated & Removed Functions
- Sound & Music Functions
- Tweens & Timers Functions
- Reflection Functions
- Variables