$(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.
Use it
Section titled “Use it”!command add !deaths $(channel.display_name) has died $(count) 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.
Examples
Section titled “Examples”Basic usage — increments the command’s own counter by 1 each time:
!cmd add !deaths $(count)Named counter with a custom modifier:
!cmd add !bossfails $(count bossfails +5)Parameters
Section titled “Parameters”[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
Configuration
Section titled “Configuration”Counters are automatically created when first used and persist across stream sessions. You can manage counters in the StreamElements dashboard under the Chatbot section.
Related Variables
Section titled “Related Variables”$(getcount): Display the current value of a counter
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).