-
Notifications
You must be signed in to change notification settings - Fork 7
Haxe Script API: General Functions
Creates a custom callback locally within the currently running script.
-
name
- The unique callback name to inherit for later use. -
func
- The given anonymous function code for the callback to utilize with. -
funk
- An optional parameter, unknown use case. Scarce Information; Still Researching
Examples:
Creates a custom callback within itself.
createCallback('getSlotRandomInt', function(min:Int, max:Int,) {
return [FlxG.random.int(min, max), FlxG.random.int(min, max), FlxG.random.int(min, max)];
}, 'hscript');
debugPrint( getSlotRandomInt(3, 5) );
Creates a custom callback within the interpreted HScript.
runHaxeCode([[
createCallback('getSlotRandomInt', function(min:Int, max:Int) {
return [FlxG.random.int(min, max), FlxG.random.int(min, max), FlxG.random.int(min, max)];
});
]])
debugPrint( getSlotRandomInt(3, 5) );
Creates a custom global callback that can be call within multiple currently running scripts.
-
name
- The unique callback name to inherit for later use. -
func
- The given anonymous function code for the callback to utilize with.
Example:
Creates a custom global callback, and calls it from different scripts.
createCallback('getSlotRandomBool', function(chance:Float = 50) {
return [FlxG.random.bool(chance), FlxG.random.bool(chance), FlxG.random.bool(chance)];
});
debugPrint( getSlotRandomBool(80) );
debugPrint( getSlotRandomBool(80) )
Sets a stored global variable to allow different scripts either from Lua scripts or HScripts to be utilize with it. Either it sets the stored variable with a new value or initializes the creation of a variable with the inherit value. If the said saved variable currently doesn't exists.
The said stored variable will be stored within the game, mainly from the MusicBeatState
class by utilizing a safe cast. Allowing every scripts either in Lua or Haxe to utilize the stored variable.
-
storeVar
- The stored global variable to set a new value to or unique name to inherit. -
value
- The new value to be set to or inherit from.
Example:
Creates a stored variable, that will allow different scripts to utilize with it. (copy paste lmaooo)
runHaxeCode([[
setVar('awesomeFormula', 100 / 34);
]])
Gets the stored variable's current value.
-
storeVar
- The stored global variable to get its current value from.
Example:
Gets the stored variable from a different interpreted HScripts within the Lua script.
runHaxeCode([[
setVar('awesomeFormula', 100 / 34);
]])
runHaxeCode([[
debugPrint( getVar('awesomeFormula') );
]])
Removes the given stored variable.
-
starVar
- The stored global variable to be removed from.
Example:
Removes the said stored variable, that's it.
runHaxeCode([[
removeVar('awesomeFormula');
]])
Displays the passed value at the top-left corner of the screen, usually disappearing in a few seconds.
Tip
If you want to display multiple values at once, use a table array containing each values.
-
text
- The said passed value to be display. -
color
- An optional parameter, the hexadecimal color for the text to rendered; Default value:WHITE
.
Gets the specified element tag from the settings JSON file to utilize.
-
saveTag
- The specified element tag name to get its current saved value. -
modName
- An optional parameter, The given mod folder to locally find the settings JSON file within itself.
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