Namespace

Global

Global

Methods

# getGlobal(id) → {Object}

Gets the value of global variable.
Parameters:
Name Type Description
id string The ID associated with the global variable.

View Source rpgcode.js, line 1466

Value of the requested global.
Object
Example
var swordActive = rpgcode.getGlobal("swordActive");
rpgcode.log(swordActive);

# removeGlobal(id)

Removes a globally scoped variable from the engine.
Parameters:
Name Type Description
id string

View Source rpgcode.js, line 2576

# setGlobal(id, value)

Sets a global value in the engine, if it doesn't exist it is created.
Parameters:
Name Type Description
id string The ID to use for this global.
value Object The value this global holds.

View Source rpgcode.js, line 2943

Example
// Store a simple boolean.
rpgcode.setGlobal("swordactive", false);

// Store a string.
rpgcode.setGlobal("name", "Bob");

// Store an object.
rpgcode.setGlobal("shield", {def: 10, price: 100});