Variables
Keep text, numbers and on/off flags that macros set and read, and use a flag to switch triggers and macros on and off.
A variable is a value CroStream keeps for you: a mood (calm), a score
(12), or an on/off flag (hype mode). It survives restarts. Macros set
and read it, chat messages and overlays can show it, and a flag can switch
whole triggers and macros on and off.
Variables are built in; they need no connection.
Note: Not the same as {variables}
The {placeholders} in a macro’s text, such as {user}, are also called
variables elsewhere in this manual. They live for one run. The variables
on this page are the ones you create on the Variables page: they last
until you change them.
The Variables page
Section titled “The Variables page”Open Variables in the sidebar (under Automate). Each variable is a row showing:
- a type chip (Text, Number or Flag), its label and a copy chip
for
{var.<name>}, to paste into a macro; - a control that fits its type: a switch for a flag, − and + around a box for a number, a box (or a pick list, when it has allowed values) for text. Type a new value and press Enter, or click Set or Save;
- buttons: reset (back to the starting value), Edit and Delete.
A variable that isn’t kept across restarts is tagged Resets when the app starts.
Variable settings
Section titled “Variable settings”| Setting | What it does |
|---|---|
| Name | The variable’s key, used in {var.<name>}. Lowercase letters, digits, - and _, up to 40 characters. It can’t change after you create the variable; to rename it for display, change the label. |
| Label | The name people see, such as Hype mode. Defaults to the name. |
| Description | A note for yourself. |
| Type | Text, Number or Flag. It can’t change after you create the variable. |
| Starting value | What the variable starts at and what Reset returns it to. A flag has Starts on; a number takes any number, including decimals; text takes any text. |
| Allowed values | Text only: one value per line. The variable can then hold only those, and the Variables page offers them as a pick list. The first is the starting value when you give none. Leave empty to allow any text. |
| Keep when the app restarts | On by default. Off: the variable goes back to its starting value each time CroStream starts. |
Text can be up to 1,000 characters. You can have up to 200 variables.
A flag takes on, off, true, false, yes, no, 1 or 0, in any
case, wherever a macro sets one.
Use a variable in a macro
Section titled “Use a variable in a macro”Show it in any text
Section titled “Show it in any text”Write {var.<name>} in any text a macro sends: a chat message, an alert, a
webhook body. It shows the value at the moment that step runs, so a Set a
variable step before it is already counted. A flag shows true or false.
Note: Your own variables win
If the macro sets a value with the same name (a step whose ID is var,
say), that one is used instead.
Variable actions
Section titled “Variable actions”The Variables group of the palette has eight actions:
| Action | What it does | Outputs |
|---|---|---|
| Set a variable | Sets the value. A number can also be added to or subtracted from; the amount is 1 when you give none. | {value}, {previous}, {delta} |
| Toggle a flag | Turns a flag on when it’s off, and off when it’s on. | {value}, {previous}, {delta} |
| Reset a variable | Puts it back to its starting value. | {value}, {previous}, {delta} |
| Read a variable | Reads it and its settings without changing it. | {value}, {label}, {type}, {on}, {default} |
| Create a variable | Makes a variable. If the name exists, it fails or keeps the existing variable, as you choose. | {value} |
| Change a variable’s settings | Edits the label, description, starting value, allowed values or persistence. | {value} |
| Delete a variable | Removes it and its value. | {previous} |
| List variables | Lists every variable. | {names}, {count} |
Every setting accepts {variables}. A value that doesn’t suit the type (text
in a number variable, a word that isn’t a value in a variable with allowed
values) fails the step with a message. Full details are in the
Actions reference.
React to a variable
Section titled “React to a variable”These trigger events run a macro when a variable changes:
| Event | Fires when |
|---|---|
| Variable changed | Any variable, or one you pick, changes. For a flag, pick turned on or turned off; or fire only when the new value equals a value you give. It doesn’t appear in the activity feed. |
| Variable created | A variable is made. |
| Variable deleted | A variable is removed. |
The macro gets {variable}, {label}, {type}, {value}, {previous},
{delta}, {how} and {cause}. See the
Events reference.
Caution: Careful with loops
A macro that changes a variable on the Variable changed event for the same variable fires it again. Guard it with an If step or with the trigger’s turned on / equals filters.
Check a variable in a condition
Section titled “Check a variable in a condition”An If step can check the live values Variable value, Number variable and Flag is on. See Conditions.
Switch triggers and macros with a flag
Section titled “Switch triggers and macros with a flag”Every trigger and every macro has an optional Run only when list. Add a flag and choose is on or is off; the trigger or macro runs only while every flag in the list is as asked.
- On a trigger, the check happens when the event arrives. A trigger that’s held back doesn’t run its macro.
- On a macro, the check happens whenever it starts, whoever starts it: a trigger, a button on the Macros page, a pop-out or the API.
- The Test button on a trigger ignores that trigger’s Run only when, like its role and cooldowns, but the macro’s own list still applies.
- You can list up to 10 flags, each once.
- A flag that doesn’t exist (for example, you deleted it) counts as off, so a trigger gated on it stays quiet instead of running unguarded.
A run that a flag stops shows in the Activity feed as
skipped, with the reason, such as hype is off. It starts no
cooldown. When a channel point reward would have run it, the
redemption is refunded, as for any run that doesn’t happen.
Recipe: an “event mode” switch
Section titled “Recipe: an “event mode” switch”Turn a whole set of triggers on for a special night, and off again, with one switch.
- On the Variables page, make a Flag named
event-mode, label Event mode, off to start. - Open each trigger you want only during the event (a special
!giveawaycommand, a subs alert for the event, a bits shoutout). Under Run only when, click Add a condition and choose Event mode is on. - Flip the switch on the Variables page when the event starts. Flip it off when it ends.
To turn it on from chat, make a Chat command trigger !event, limited to
Moderator or higher, whose macro has a Toggle a flag step on
event-mode and a Send chat message step:
CroStream Event mode is {mode.value}.
Name the toggle step mode so {mode.value} reads its output (true or
false). See
Variables.
Variables in overlays
Section titled “Variables in overlays”Overlays and custom widgets read a variable as the data key var.<name>: a
string for text, a number for a number variable, true or false for a
flag. A deleted variable’s key is cleared. See
Overlay data.
Free plan
Section titled “Free plan”The free plan has 1 variable. Subscribers to Haliebug13 on Twitch have unlimited variables.
If you’re over the limit, for example after a subscription lapses, your variables keep working: macros set and read them, flags keep switching triggers, and you can change values from the Variables page. Editing their settings and adding variables need a subscription. Deleting is always allowed.
Related
Section titled “Related”- Macros, Triggers and Actions.
- Counters for numbers with limits, steps and reset rules.
- Cooldowns and Schedules, the other ways to decide when automations run.
- Overlay data, Config file and API.