Set Global Variable

Create or update a global variable
Preview
Preview
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 create or modify

Variable Name must be entered in camelCase (the first letter must be lowercase)
Sourcerequired
Select
default:Argument

Select the source for the value to assign to the global variable

  • Argument - Use the value of an argument
  • Value - Assign any arbitrary value
  • Increment - Add to an existing int variable
  • Decrement - Subtract from an existing int variable
Valuerequired
Text

Enter the value to assign to the global variable, depends on the selected Source type, detailed above

  • Argument - Enter the name of an existing argument to assign its value to the global variable
  • Value - Enter any value
  • Increment - Enter any int
  • Decrement - Enter any int

Variables

This sub-action does not populate any variables.

C# Usage

Set the value for a global variable

public void SetGlobalVar(string varName, object value, bool persisted = true)