Skip to content

$(count)

Syntax
$(count [counter_name] [modifier])
Arguments
Optional

The $(count) variable creates, displays, and changes named counters. It’s commonly used for tracking deaths in games, counting command usage, or keeping score of any recurring event.

!command add !deaths $(channel.display_name) has died $(count) times this stream!
Example chat
ViewerName:!deaths
partner badgemoderator badgeStreamElements:CoolStreamer123 has died 13 times this stream!

The basic syntax for using the $(count) variable is:

$(count [counter_name] [modifier])

Where:

  • [counter_name] is an optional name for your counter (by default, the invoking command’s own counter is used)
  • [modifier] can be used to set or modify the counter value

Each use changes the counter and outputs the new value as a plain number. Without a modifier, the counter is incremented by 1.

Basic usage — increments the command’s own counter by 1 each time:

!cmd add !deaths $(count)
Example chat
ViewerName:!deaths
partner badgemoderator badgeStreamElements:13

Named counter with a custom modifier:

!cmd add !bossfails $(count bossfails +5)
Example chat
ViewerName:!bossfails
partner badgemoderator badgeStreamElements:25
  • [counter_name]: (Optional) A unique identifier for your counter. If not specified, the invoking command’s own counter is used.
  • [modifier]: (Optional) The second space-separated token; sets or modifies the counter value:
    • +n: Increment the counter by n (e.g., +1, +5)
    • -n: Decrement the counter by n (e.g., -1, -3)
    • n: Set the counter to a specific value n (e.g., 0, 100) — $(count deaths 0) resets the counter

Counters are automatically created when first used and persist across stream sessions. You can manage counters in the StreamElements dashboard under the Chatbot section.

Q: Can I have multiple counters?

A: Yes, you can create multiple counters by using different names (e.g., $(count deaths), $(count wins)).

Q: How do I reset a counter?

A: You can reset a counter to zero using $(count [counter_name] 0).