Description

Assigns a value to a variable. Changing a value, you refresh the game events These are influenced by the change in value. They can activate or deactivate a new page and run commands event

Usage

Parameters

  • key {Integer}

    Variable identifier

  • operand {Object}

    • simple constant
    • variable id with the object {variable: ID}
    • random : array with two elements : [0, 10]

  • operation {String} optional

    (optional) Operation to perform

    • set (default)
    • add
    • sub
    • mul
    • div
    • mod

Example

RPGJS.Variables.set(5, 10, "add");

Means: add the value 10 to the variable #5

RPGJS.Variables.set(5, [0, 10]);

Variable #5 is a random value between 0 and 10

RPGJS.Variables.set(5, {variable: 8});

Variable #5 takes the value of variable #8

Discussion