Variables
Introduction
When a trigger executes an action, it will automatically generate a set of variables specific to that event source and type, and make them available to that action via the argument stack. You can use subsequent sub-actions to populate additional arguments, or even to manipulate existing arguments on the stack.
Arguments only exist within the scope of the current action. Once the action finishes execution, they can not be referenced by any other action. To share variables across multiple actions, or to persist them across restarts, you can store them as Global Variables.
Types
Arguments
The argument stack contains all local variables accessible by an action and its sub-actions.
These variables can be utilized in most sub-action configuration text fields.

To replace a variable name with its value from the current argument stack, wrap the variable name with % symbols:
%userName%
Global Variables
Global variables allow you to share data between multiple actions, or even persist it across multiple restarts of Streamer.bot.
Set Global Variable sub-actionThis does not also make the global variable's value available in your action
Get Global Variable sub-actionTo directly access the value of a persisted global variable, wrap the variable name with ~ symbols:
~myPersistedGlobalVariable~
User Global Variables
User global variables function as global variables, but store values per user.
Generic
The following variables are always available:
yyyy/MM/ddFormatting is supported, e.g. %date:yyyy/MM/dd% or %date:dddd, dd MMMM yyyy%hh:mmFormatting is supported, e.g. %time:HH-mm%hh:mm:ss1725936677yyyyMMdd.hhmmss\r\nFormatting
Variables can be formatted inline using standard C# notation
Numbers
For example, to format a numeric variable %tipAmount% as a currency with 2 decimal places, we can use the following syntax: %tipAmount:c2%
Date and Time
Similarly, %time% can be formatted in short notation with AM/PM using the following syntax: %time:t%
Inline Functions
Anywhere you can do a variable replacement, you can also execute inline functions to manipulate them.
math()
Leveraging the mXparser library, you can evaluate mathematical equations directly inline with variable replacements.
// Expected output: 20
$math(10+10)$
// Multiply %x% by 1.25
$math(%x% * 1.25)$
// Multiply %tier% by 10
$math(%tier% * 10)$
// Divide %duration% by 1000
$math(%duration% / 1000)$
length()
Obtain the length of arbitrary text or a given variable.
// Expected output: 69
$length(Lorem ipsum dolor sit amet consectetur adipisicing elit. Commodi, ut.)$
// Obtain the length of %rawInput%
$length(%rawInput%)$
parse()
Fetches the value of the argument named by parse's parameter, which itself can be the result of parsing variables. In other words, it lets you "double parse" a value. This is often useful in a While loop to access an array of numbered arguments with an index variable.
// Same results as %user%
$parse(user)$
// First, Set Argument %i% to 0
$parse(line%i%)$
// ==> returns value of %line0% (the first line of the file)
// Set Argument %i% to $math(%i% + 1)$ (i.e., 1)
$parse(line%i%)$
// ==> returns value of %line1% (the second line of the file)
%arguments% and ~persistedGlobalVariables~ will be parsed in parse's parameter, but not other $inline()$ functions or formatting. If you wish to use another function, set another argument to the output of the function, and use that argument in parse instead.Global Variable Viewer
The global variable viewer in Streamer.bot provides a convenient location to view, modify, and create all types of global variables, including per-platform user global variables.
You can open the global variable viewer at any time by clicking Global Variables on the Streamer.bot toolbar:

You will be greeted with a popup window:

Options
Add/Edit Global Variables
Selecting Add or Edit from the context menu will greet you with the following options:

string variables.Enable Auto Type to automatically determine the type for the entered value.For example:0can be auto-typed to a numeric type such asintorlongtrueorfalsecan be auto-typed to abool
Global Variables Context Menu
The Right-Click context menu provides the following options:
Inspecting Arguments
Action Queues > Action History in Streamer.botFrom the Action History view, you can Right-Click an action execution to inspect all variables from that action's argument stack:

Variables Dialog
When you select one of these options, you will be greeted with a dialog containing the respective variables:
