Skip to content
This repository was archived by the owner on Jan 2, 2023. It is now read-only.

Script API 1: All Preset Variables

lunarcleint edited this page Nov 9, 2022 · 10 revisions

All Preset Variables

Script Functions (Added By Default)

  • function new() Called when script is created.
  • function destroy() Called when script is destroyed.
  • function update(elapsed:Float) A function that is called every frame.
  • function trace(_) This function will trace any objects you put in it, trace("hi", "t") //prints hi,t
  • function import(path:String, ?as:Null<String>) Will import as the haxe function would work, this only imports classes. It is important to treat the haxe classes you import carefully since they maybe be turned into another type depending on the platform.
  • function addScript(scriptName:String):Dynamic This will add any script in scripts/, this functions also returns getScript(scriptName)
  • function getScript(scriptName:String):Dynamic This will give the script's local functions and variables as a Dynamic object.
  • ScriptReturn a shortcut to the enum ScriptReturn

Haxe Classes (Added By Default)

HaxeFlixel and OpenFL: Classes, Variables, and Functions (Added By Default)

Classes

Variables

Functions

FNF's Classes

Game/PlayState: Classes, Variables, and Functions (Added When in PlayState)

Classes

  • PlayState A shortcut to the PlayState Class. Please note that this is not the current instance of Playstate, for that use PlayState.instance.

Variables

  • var curStep:Int A shortcut to PlayStates's curStep.
  • var curBeat:Int A shortcut to PlayStates's curBeat.
  • var bpm:Float A shortcut to PlayStates's bpm.
  • var camGame:FlxCamera A shortcut to PlayStates's camGame.
  • var camHUD:FlxCamera A shortcut to PlayStates's camHUD.
  • var camOther:FlxCamera A shortcut to PlayStates's camOther.
  • var camFollow:FlxPoint A shortcut to PlayStates's camFollow.
  • var camFollowPos:FlxObject A shortcut to PlayStates's camFollowPos.
  • var boyfriend:Boyfriend A shortcut to PlayStates's boyfriend.
  • var dad:Character A shortcut to PlayStates's dad.
  • var gf:Character A shortcut to PlayStates's gf.
  • var boyfriendGroup:FlxSpriteGroup A shortcut to PlayStates's boyfriendGroup.
  • var dadGroup:FlxSpriteGroup A shortcut to PlayStates's dadGroup.
  • var gfGroup:FlxSpriteGroup A shortcut to PlayStates's gfGroup.
  • var notes:FlxTypedGroup<Note> A shortcut to PlayStates's notes.
  • var strumLineNotes:FlxTypedGroup<StrumNote> A shortcut to PlayStates's strumLineNotes.
  • var playerStrums:FlxTypedGroup<StrumNote> A shortcut to PlayStates's playerStrums.
  • var opponentStrums:FlxTypedGroup<StrumNote> A shortcut to PlayStates's opponentStrums.
  • var unspawnNotes:Array<Note> A shortcut to PlayStates's unspawnNotes.

Functions

  • function startCountdown() Called when PlayState's startCountdown is called, you can use return ScriptReturn.PAUSE to stop the function.
  • function create() Called when the end of PlayState's create (createPost).
  • function countdownTick(tick:Int) Called when a count down tick happens.
  • function updateScore(missed:Bool) Called when PlayState's updateScore is called.
  • function songStart() Called when PlayState's startSong is called.
  • function eventEarlyTrigger() Called when PlayState's eventEarlyTrigger is called, return the amount of time (miliseconds) you want a event to be early by.
  • function resume() Called when PlayState resumes the game.
  • function pause() Called when PlayState pauses the game, you can use return ScriptReturn.PAUSE to stop the function.
  • function spawnNote(note:Note) Called when PlayState creates a note.
  • function updatePost(elapsed:Float) Called at the end of PlayState's update.
  • function gameOver() Called when PlayState sends player to game over, you can use return ScriptReturn.PAUSE to stop the function.
  • function event(name:String, val1:Dynamic, val2:Dynamic) Called when PlayState's triggerEventNote is called.
  • function endSong() Called when PlayState's endSong is called, you can use return ScriptReturn.PAUSE to stop the function.
  • function ghostTap(key:Int) Called when PlayState's detects a ghostTap.
  • function noteMiss(note:Note) Called when PlayState's noteMiss is called.
  • function noteMissPress(dir:Int) Called when PlayState's noteMissPress is called.
  • function opponentNoteHit(note:Note) Called when PlayState's opponentNoteHit is called.
  • function goodNoteHit(note:Note) Called when PlayState's goodNoteHit is called.
  • function stepHit(step:Int) Called when PlayState's stepHit is called.
  • function beatHit(beat:Int) Called when PlayState's beatHit is called.
  • function recalculateRating() Called when PlayState's is called, you can use return ScriptReturn.PAUSE to stop the function.
  • OVERRIDE function add(obj:FlxBasic, ?front:Bool = false) Adds a object behind the characters, use front to add on top.