Codename LogoCodename Logo

funkin.backend.scripting.Script

APIWikiTools

Static variables

View on GitHub

staticcurScript:Script = null

Currently executing script.

View on GitHub

staticscriptExtensions:Array<String> = ["hx", "hscript", "hsc", "hxs", "pack", "lua"]

All available script extensions

View on GitHub

staticstaticVariables:Map<String, Dynamic> = []

Use "static var thing = true;" in hscript to use those!! are reset every mod switch so once you're done with them make sure to make them null!!

Static methods

View on GitHub

staticcreate(path:String):Script

Creates a script from the specified asset path. The language is automatically determined.

Parameters:

path

Path in assets

View on GitHub

staticfromString(code:String, path:String):Script

Creates a script from the string. The language is determined based on the path.

Parameters:

code

code

path

filename

View on GitHub

staticgetDefaultImportRedirects():Map<String, String>

Used internally to keep backwards compatibility with old scripts. This gets set on hscript.Interp.importRedirects, if you wanna modify it, please edit hscript.Interp.importRedirects directly.

View on GitHub

staticgetDefaultPreprocessors():Map<String, Dynamic>

Gets the default defines for a script. Includes all of the defines that the build was compiled with.

View on GitHub

staticgetDefaultVariables(?script:Script):Map<String, Dynamic>

Gets the default variables for a script.

Constructor

View on GitHub

new(path:String)

Creates a new instance of the script class.

Parameters:

null

path

Variables

extension:String

Script Extension

fileName:String

Script name (with extension)

path:String = null

Path to the script.

remappedNames:Map<String, String> = []

Remapped filenames. Used for trace messages, to show what mod the script is from.

Methods

View on GitHub

call(func:String, ?parameters:Array<Dynamic>):Dynamic

Calls the function func defined in the script.

Parameters:

func

Name of the function

parameters

(Optional) Parameters of the function.

Returns:

Result (if void, then null)

View on GitHub

error(text:String, ?additionalInfo:Dynamic):Void

Shows an error from this script.

Parameters:

text

Text of the error (ex: Null Object Reference).

additionalInfo

Additional information you could provide.

View on GitHub

get(variable:String):Dynamic

Gets the variable variable from the script's variables.

Parameters:

variable

Name of the variable.

Returns:

Variable (or null if it doesn't exists)

View on GitHub

load():Void

Loads the script

View on GitHub

loadFromString(code:String):Script

Loads the code from a string, doesn't really work after the script has been loaded

Parameters:

code

The code.

View on GitHub

onCreate(path:String):Void

Called when the script is created.

Parameters:

path

Path to the script

View on GitHub

onLoad():Void

Called when the script is loaded.

View on GitHub

reload():Void

Hot-reloads the script, if possible

View on GitHub

set(variable:String, value:Dynamic):Void

Sets the variable variable from the script's variables.

Parameters:

variable

Name of the variable.

Returns:

Variable (or null if it doesn't exists)

View on GitHub

setParent(variable:Dynamic):Void

Sets a script's parent object so that its properties can be accessed easily. Ex: Passing PlayState.instance will allow boyfriend to be typed instead of PlayState.instance.boyfriend.

Parameters:

variable

Parent variable.

View on GitHub

setPublicMap(map:Map<String, Dynamic>):Void

HSCRIPT ONLY FOR NOW Sets the "public" variables map for ScriptPack

View on GitHub

trace(v:Dynamic):Void

Traces something as this script.