Squiso è uno strumento di automazione gratuito e potente che ti consente di personalizzare il tuo streaming Twitch utilizzando semplici script.
Come creare un contatore di morte con effetto sonoro nella chat di Twitch
Questo esempio di script ascolta gli aumenti (o le diminuzioni) di un contatore di morti e riproduce un effetto sonoro audio ascoltando specifici comandi della chat di Twitch. Il contatore di morti viene salvato in un file in modo che OBS Studio possa visualizzarlo facilmente in streaming.
Guarda il video
Esempio di script
import com.squiso.*;
import com.squiso.exception.*;
import com.squiso.scripting.*;
import com.squiso.scripting.data.*;
import com.squiso.keyboard.*;
import com.squiso.twitch.*;
import com.squiso.datatypes.*;
import com.squiso.utils.*;
import com.squiso.sysinfo.*;
// Important - Please do not change the row below - otherwise you will get a compilation error!
public class Script_Example extends SquisoScript {
    
    // Create a death counter integer variable, assign it to 0 as default
    SquisoInteger deathCounter = new SquisoInteger(0);
    // When the script is initiated
    @Override
    public void onInitiated(API api) throws SquisoException {
        // If the file "death_counter_value.txt" exists
        if (FileUtil.exists("death_counter_value.txt")) {
            // Get the numeric value from the file "counter.txt"
            deathCounter = SquisoInteger.readFromFile("death_counter_value.txt");
        }
    }
    @Override
    public void onTwitchChatMessage(OnTwitchChatMessageData data, API api) throws SquisoException {
        // If the user is NOT the broadcaster and is NOT a moderator
        // End here by doing a return
        if (!data.isUserBroadcaster() && !data.isUserModerator()) {
            return;
        }
        // If the message is "!dc" or "!dc up"
        if (data.getMessageText().equals("!dc") || data.getMessageText().equals("!dc up")) {
            // Increase the counter
            deathCounter.increment();
            // Play a dramatic death sound
            api.playAudio("mario_death.mp3");
        }
        // If the message is "!dc down"
        if (data.getMessageText().equals("!dc down")) {
            // Decrease the counter
            deathCounter.decrement();
        }
        // Write the numeric file in case we restart Squiso
        deathCounter.writeToFile("death_counter_value.txt");
        
        // Compose what should be in the file for OBS Studio
        SquisoString contents = new SquisoString("Deaths: " + deathCounter);
        // Write the file that is displayed to OBS Studio
        contents.writeToFile("death_counter_obs.txt");
    }
}