Get Global Variable

Fetch the value of a global variable and populate a local argument

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

Select the source type for the global variable

  • 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 fetch
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 differet name than the global variable name
Default Value
Text

Optionally set a default value to apply if the global variable does not exist

This will also set the value of the global variable

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)