Squiso is a free lightweight automation tool for Twitch streamers.

How to Create a Death Counter Using Twitch Chat

This script example listens to all chat messages and if the message is from the broadcaster or a moderator and starts with !dc it either increases and decreases the counter and then writes the counter to a specific file.

Watch the Video

Example Code

import com.squiso.datatypes.SquisoInteger; import com.squiso.datatypes.SquisoString; import com.squiso.exception.SquisoException; import com.squiso.scripting.API; import com.squiso.scripting.Script; import com.squiso.scripting.data.OnTwitchChatMessageData; public class Example_TwitchChatDeathCounter extends Script { SquisoInteger deathCounter = new SquisoInteger(0); @Override public void onTwitchChatMessage(OnTwitchChatMessageData data, API api) throws SquisoException { // If the user is NOT the broadcaster and is NOT a moderator // End here with a return if (!data.isUserBroadcaster() && !data.isUserModerator()) { return; } // If the message is "!dc" if (data.getMessageText().equals("!dc")) { // Increase the counter deathCounter.increment(); } // If the message is "!dc up" if (data.getMessageText().equals("!dc up")) { // Increase the counter deathCounter.increment(); } // If the message is "!dc down" if (data.getMessageText().equals("!dc down")) { // Decrease the counter deathCounter.decrement(); } // Compose what should be in the file SquisoString contents = new SquisoString("Deaths: " + deathCounter); // Write the file contents.writeToFile("death_counter.txt"); } }