Get Global Variable

Fetch the value of a global variable and populate a local argument
Preview
Preview
You can quickly access persisted globals without this sub-action by wrapping the name with ~
~myGlobalVariable~
Read more in Guide > Variables

Parameters

Sourcerequired
Select
default:Global
  • Global - Fetch any general global variable (non user variables)
  • User (redeemer) - Fetch a user global for the current user who activated the action
  • User (target) - Fetch a user global for the targetUser
Persisted
Toggle
default:true

Toggle between Persisted and Non-Persisted variables

  • Persisted - These variables persist across Streamer.bot restarts
  • Non-Persisted - These variables should be considered temporary and will be wiped at shutdown
Ensure you select the correct datastore (persisted or non-persisted) for the variable you are trying to get or set
Variable Namerequired
Text

Enter the name of the variable you would like to fetch

Variable Name must be entered in camelCase (the first letter must be lowercase)
Destination Variablerequired
Text

Enter the name of the local argument you would like to populate

It is recommended to use a different name than the global variable name
Default Value
Text

Optionally set a default value

This will create the global variable if it does not exist and then set it to the given value

Variables

The following variables will be populated after executing this sub-action:

Description
<variableName>

The variable name and type will be depend on the parameters you selected

C# Usage

Fetch a global variable by name

public T GetGlobalVar<T>(string varName, bool persisted = true)