Skip to content

Global variables script functions

Functions for C# (Cb.Call) and Python (cb.call). See Script functions for how to use them.

globals.clearTemporary

Deletes every temporary global variable (the ones that are not saved). Saved ones stay.

Gives back: How many variables were deleted.

var answer = await Cb.Call("globals.clearTemporary");
answer = cb.call("globals.clearTemporary")

globals.delete

Deletes a global variable.

Value What to put in
name The variable name, like "deaths".

Gives back: true when the variable existed, false when there was nothing to delete.

var answer = await Cb.Call("globals.delete", new { name = "deaths" });
answer = cb.call("globals.delete", name="deaths")

globals.get

Reads a global variable as text, the same way ~name~ shows it in a message.

Value What to put in
name The variable name, like "deaths".

Gives back: The value as text, or null when there is no such variable.

var answer = await Cb.Call("globals.get", new { name = "deaths" });
answer = cb.call("globals.get", name="deaths")

globals.getValue

Reads a global variable and keeps its type, so a number stays a number and true/false stays true/false.

Value What to put in
name The variable name, like "deaths".

Gives back: The value as a number, true/false or text, or null when there is no such variable.

var answer = await Cb.Call("globals.getValue", new { name = "deaths" });
answer = cb.call("globals.getValue", name="deaths")

globals.increment

Adds to a number in a global variable, like a death counter. A missing variable starts at 0. Fails when the variable holds text that is not a number.

Value What to put in
name The variable name, like "deaths".
amount Optional. How much to add, like 1 or 0.5. Use a negative number to subtract. Leave it out to add 1.
persisted Optional. true (the default) saves it so it is still there after a restart; false keeps it only until Cuebot closes.

Gives back: The new value.

var answer = await Cb.Call("globals.increment", new { name = "deaths", amount = 1 });
answer = cb.call("globals.increment", name="deaths", amount=1)

globals.set

Saves a value in a global variable. Every action can read it, and messages can show it with ~name~. The value is stored as text.

Value What to put in
name The variable name, like "lastRaider".
value The value to store, like "CoolStreamer". Numbers and true/false are stored as text.
persisted Optional. true (the default) saves it so it is still there after a restart; false keeps it only until Cuebot closes.

Gives back: Nothing.

var answer = await Cb.Call("globals.set", new { name = "lastRaider", value = "CoolStreamer" });
answer = cb.call("globals.set", name="lastRaider", value="CoolStreamer")