Skip to main content

Variables

Variables display dynamic values in your overlay or chat bot. Unlike Functions they take no parameters.

Write them as {{variable_name}}, with no spaces inside the braces. Variables can be used inside Functions but not the other way around.

In the text field of a Text Widget or similar, a variable shows its value and refreshes when the value changes.

Alert variables​

Text widgets inside a Custom Alert Box Widget can read the firing alert's fields through the {{alert.<field>}} namespace, e.g. {{alert.name}}, {{alert.bits}}, {{alert.streak_months}}. The same handles work in the display and TTS message templates in Alert Configuration. See the full alert variable reference.

Alert queue variables​

Any Text widget on a live overlay can show how many alerts your overlays still have to play, in total or for one kind (Super Cheers, TTS, and so on), via the {{alertQueue.<kind>}} namespace. See alertQueue.

Fallbacks and conditions​

A variable can supply a fallback for when it has no value, or pick between two texts, right inside the {{ }}. They work anywhere Community resolves {{variables}}: overlay text and widgets, chat bot messages, alert messages (display and TTS), Flow text, and Chatbox messages.

Fallbacks​

  • {{points ?? "0"}} shows the fallback only when the variable has no value at all (it isn't set). A real 0 or an empty message is kept as-is.
  • {{points || "0"}} shows the fallback when the variable is unset, empty, 0, or false. Use it when a 0 should read as "nothing yet".

The fallback text must be wrapped in quotes. It can contain a Function:

Your roll: {{roll ?? $(random 1 6)}}

The older single-pipe form, {{points | "0"}}, still works. It behaves like ?? but also falls back on an empty message.

Conditions​

Pick one of two texts based on a variable's value:

{{is_subscribed ? "Thanks for subscribing!" : "Consider subscribing!"}}

Both texts are quoted. The variable counts as "yes" unless it is empty, 0, false, no, or off, so the string false reads as "no".

The two texts must be plain quoted strings. A condition can't contain another {{variable}} inside its branches.