$(getcount)
- Syntax
$(getcount <counter_name>)- Arguments
- Required
The $(getcount) variable allows you to retrieve the current value of a counter without incrementing it. This is useful for displaying counter values in chat messages or on stream overlays.
Use it
Section titled “Use it”!command add !hugstats The !hug command has been used $(getcount hugs) times so far.To use the $(getcount) variable, you need to provide the name of the counter as a parameter. The syntax is as follows:
$(getcount <counter_name>)The variable outputs the counter’s current value as a plain number, e.g. 42.
Examples
Section titled “Examples”Displaying the current death count without changing it:
!command add !deathcheck We're at $(getcount deaths) deaths so far. It could be worse!Parameters
Section titled “Parameters”The $(getcount) variable takes one parameter:
counter_name: The name of the counter you want to retrieve the value for. This is a required parameter.
Related Variables
Section titled “Related Variables”$(count): Increments a counter and returns its new value
Q: Can I use $(getcount) to create a new counter?
A: No, $(getcount) only retrieves existing counter values. To create a new counter, use the $(count) variable first.
Q: What happens if I try to get the count of a non-existent counter?
A: If the counter doesn’t exist, $(getcount) will return 0.
Q: Is there a limit to how many counters I can have?
A: StreamElements doesn’t specify a limit, but it’s good practice to use counters judiciously to avoid performance issues.