Methods
# getGlobal(id) → {Object}
Gets the value of global variable.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID associated with the global variable. |
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 |
# 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. |
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});