Skip to content

$(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.

!command add !hugstats The !hug command has been used $(getcount hugs) times so far.
Example chat
ViewerName:!hugstats
partner badgemoderator badgeStreamElements:The !hug command has been used 42 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.

Displaying the current death count without changing it:

!command add !deathcheck We're at $(getcount deaths) deaths so far. It could be worse!
Example chat
ViewerName:!deathcheck
partner badgemoderator badgeStreamElements:We're at 13 deaths so far. It could be worse!

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.
  • $(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.