Squiso on tasuta võimas automatiseerimistööriist, mis võimaldab teil kohandada oma Twitchi voogu lihtsate skriptide abil.

Kuidas luua Twitch Chatis heliefektiga surmaloendurit

See skripti näide kuulab, suurendab (või vähendab) surmaloendurit ja esitab heliefekti, kuulates konkreetseid Twitchi vestluskäske. Surmaloendur salvestatakse faili, et OBS Studio saaks seda hõlpsalt voos kuvada.

Vaata videot

Skripti näide

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.*; // 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"); } }