Squiso ir bezmaksas, jaudīgs automatizācijas rīks, kas ļauj pielāgot Twitch straumi, izmantojot vienkāršus skriptus.

Kā izveidot nāves skaitītāju ar skaņas efektu Twitch tērzēšanā

Šis skripta piemērs klausās palielina (vai samazina) nāves skaitītāju un atskaņo audio skaņas efektu, klausoties konkrētas Twitch tērzēšanas komandas. Nāves skaitītājs tiek saglabāts failā, lai OBS Studio to varētu viegli parādīt straumē.

Skatieties Video

Skripta piemērs

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