Namespace

Program

Program

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.

View Source rpgcode.js, line 222

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.

View Source rpgcode.js, line 1040

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.

View Source rpgcode.js, line 1604

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

View Source rpgcode.js, line 2672

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.

View Source rpgcode.js, line 2782

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");

Type Definitions

Object

# RunningProgram

Properties:
Name Type Description
inProgram boolean
currentProgram string

View Source rpgcode.js, line 3607