Methods
# addRunTimeProgram(filename)
Adds a program that will be called at runtime for each frame. You
should avoid doing any lengthy operations with these programs.
Parameters:
Name | Type | Description |
---|---|---|
filename |
string | Filename of the JavaScript file stored in Programs folder. |
Example
rpgcode.addRunTimeProgram("UI/HUD.js");
# endProgram(nextProgram)
Ends the current program and releases control back to the main game loop. If nextProgram is
specified the main loop will not resume. Execution will be immediately passed to the program
the user specified.
Parameters:
Name | Type | Description |
---|---|---|
nextProgram |
string | The relative path to the next program to execute. |
Example
// End the current program and release control back to the engine.
rpgcode.endProgram();
// End the current program, then run another.
rpgcode.endProgram("MyProgram.js");
# getRunningProgram() → {Program.RunningProgram}
Gets the current running program as an Object.
An object with the attributes inProgram (boolean) and the filename of the current running program, if any.
Example
var program = rpgcode.getRunningProgram();
rpgcode.log(program);
# removeRunTimeProgram(filename)
Removes a run time program from the engine, if the program is currently
executing it will be allowed to finish first.
Parameters:
Name | Type | Description |
---|---|---|
filename |
string |
Example
rpgcode.removeRunTimeProgram("UI/HUD.js");
# runProgram(filename)
Runs the requested program, movement is disabled for the programs duration.
Parameters:
Name | Type | Description |
---|---|---|
filename |
string | Program to run, including any subpaths. |
Example
// Run a program at the root of the "Programs"
rpgcode.runProgram("MyProgram.js");
// Run a program in a subpath of "Programs"
rpgcode.runProgram("examples/MyProgram.js");