Custom Variable Effects
The Custom Variable effect allows you to store data for use in Firebot later. This is useful for creating dynamic, personalized effects for your stream.
You can find it in the “Select New Effect” box when adding a new effect. It’s listed under the “ALL,” “Advanced,” and “Scripting” tabs. Custom Variables function similarly to variables in programming but can always be overwritten (they cannot be made constant).
By leveraging Custom Variables, you can make your stream more interactive and tailor effects to your viewers. For more advanced logic, check out the Conditional Effects guide.
Configuring a Custom Variable
Variable Name
This is where you name your variable. Use a descriptive name without spaces (e.g., randomViewer
) to avoid issues and make the variable's purpose clear. A common practice is using CamelCase, where each word starts with a capital letter except the first (e.g., contestWinner
).
Variable Data
Here, input the data you want to save. This can be any type of data, including Firebot's built-in variables accessed via the $vars
button.
Property Path (Optional)
This is used for accessing or modifying specific parts of complex data structures like arrays or objects. Most users can skip this section, but here’s a quick overview:
-
Array Example:
["apple", "banana", "cherry"]
Access "banana" with$$myArray[1]
. -
Object Example:
{"fruit":"apple", "color":"red"}
Access "apple" with$$myObject.fruit
. -
Array of Objects Example:
[{"fruit":"apple"}, {"fruit":"banana"}]
Access "apple" with$$myArray[0].fruit
.
You can use the Property Path field to update a specific part of the variable without overwriting the entire structure.
Example: To change the color of a fruit from red to yellow in {"fruit":"apple", "color":"red"}
, set Variable Name
to your object’s name, Variable Data
to yellow
, and Property Path
to color
.
Duration (Optional)
Set how long Firebot should retain the variable (in seconds). By default (0
), variables persist until Firebot is closed. Enable Settings > Advanced > Persist Custom Variables to retain them across sessions.
Example: Set 90
to store a variable for 1 minute and 30 seconds, useful for timed events like competitions.
Using a Custom Variable
Custom Variables are placeholders for text data that you can reuse in other effects. Examples include saving usernames, answers, timestamps, or messages.
Accessing a Custom Variable
You can access a Custom Variable in any effect by using one of the following replace variables:
$customVariable[variableName]
$$variableName
(shortcut)
Example: If you save a contest winner’s name as contestWinner
, you can use $$contestWinner
in any effect to display the name.
Example: Chat Contest
Premise: Let's say we start a contest for chat members and the first person to write the correct answer in chat to a riddle wins a prize, and we want to save the persons name for later.
-
Save the Winner:
Set up a chat event to check messages. Use a Conditional Effect (More on those here) to detect the correct answer.
When triggered:- Turn off the chat event with a Toggle Event effect.
- Save the winner’s username using a Custom Variable. Set:
Variable Name
:contestWinner
Variable Data
:$user
(Firebot’s built-in variable for the triggering user’s name)
-
Announce the Winner:
Use a Chat Effect with:
"Congratulations to $$contestWinner for guessing correctly! You win today's prize!"
Custom Variable Inspector
The Custom Variable Inspector is a useful tool for viewer and debugging your variables. You can access it under the “Tools” menu in Firebot.