Codename LogoCodename Logo

funkin.backend.scripting.ScriptPack

APIWikiTools

Used to group multiple scripts together, and easily be able to call them.

Constructor

View on GitHub

new(name:String)

Variables

additionalDefaultVariables:Map<String, Dynamic> = []

parent:Dynamic = null

publicVariables:Map<String, Dynamic> = []

scripts:Array<Script> = []

Methods

View on GitHub

add(script:Script):Void

Adds a script to the pack, and sets the parent/this of the script.

View on GitHub

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

Calls a function on every single script. Only calls on scripts that are active.

Parameters:

func

Function to call

parameters

Parameters to pass to the function

View on GitHub

contains(path:String):Bool

Checks if the script pack contains a script with a specific path.

Parameters:

path

Path to check

View on GitHub

destroy():Void

Destroys all scripts in the pack.

View on GitHub

inlineevent<T>(func:String, event:T):T

Sends an event to every single script, and returns the event.

Parameters:

func

Function to call

event

Event (will be the first parameter of the function)

Returns:

(modified by scripts)

View on GitHub

get(val:String):Dynamic

Gets the first script that has a variable with a specific name.

Parameters:

val

Name of the variable

View on GitHub

getByName(name:String):Script

Gets a script by name.

Parameters:

name

Name of the script

View on GitHub

getByPath(name:String):Script

Gets a script by path.

Parameters:

name

Path to the script

View on GitHub

importScript(path:String):Script

Imports a script by path.

Parameters:

path

Path to the script

Throws:

Error

if the script does not exist

View on GitHub

insert(pos:Int, script:Script):Void

Inserts a script into the pack, and sets the parent/this of the script.

View on GitHub

load():Void

Loads all scripts in the pack.

View on GitHub

reload():Void

Reloads all scripts in the pack.

View on GitHub

remove(script:Script):Void

Removes a script from the pack. Does not reset the parent/this.

View on GitHub

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

Sets a variable in every script.

View on GitHub

setParent(parent:Dynamic):Void

Sets the parent/this of every script in the pack.

Inherited Variables

Defined by Script

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.

Inherited Methods

Defined by Script

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

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

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.