Count
Count variables let a command store and update a named whole number. Use them for deaths, wins, attempts, rounds or anything else you want to track.
Create a counter
Section titled “Create a counter”- Go to Commands and create or edit a command.
- Choose a short counter name, such as
deaths. - Add a count variable to the command response.
For a !death command, use this response:
The first use creates the counter and changes it from 0 to 1. The response contains the new value.
Counter names identify separate values. {count.inc deaths} and {count deaths} use the same counter, while {count.inc wins} uses a different one. Use lowercase names without spaces to keep them easy to reuse.
Variables
Section titled “Variables”| Variable | Use | Example output |
|---|---|---|
{count <counter_name>} | Shows the current value for a counter. | 6 |
{count.inc <counter_name> [-/+amount]} | Changes the counter by the amount. Defaults to 1; use a negative amount to decrease it. | 7 |
{count.set <counter_name> [amount]} | Sets the counter to an exact value. Use 0 to reset it. | 4 |
A missing counter reads as 0. Incrementing it creates it automatically.
For {count.set deaths}, the amount can also come from the first command argument. For example, !setdeaths 12 sets the counter to 12. Restrict commands that change or reset counters to trusted users.
Show a counter on stream
Section titled “Show a counter on stream”Counters are stored in channel KV as counter:<counter_name>. The deaths counter uses counter:deaths.
Select that key in a Value widget to display it in OBS. The widget updates as soon as a command changes the counter. The Death Counter preset selects counter:deaths automatically.