如何使用 Twitch 频道点数在 OBS Studio 中切换过滤器
此示例在 OBS Studio 中启用过滤器 10 秒,然后在兑换 Twitch 频道积分奖励时禁用它。
脚本示例
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 {
@Override
public void onTwitchChannelPointRedeem(OnTwitchChannelPointRedeemData data, API api) throws SquisoException {
// If the reward that got redeemed is called "Pixelate Webcam"
if (data.getRewardName().equals("Pixelate Webcam")) {
// Specify the source
SquisoString sourceName = new SquisoString("Webcam");
// Specify the filter
SquisoString filterName = new SquisoString("Pixelate");
// Enable the filter
api.setOBSFilterEnabled(sourceName, filterName, true);
// Specify a wait time of 10 seconds
SquisoInteger waitTime = new SquisoInteger(10 * 1000);
// 10 seconds later, disable the filter again
api.doLater(waitTime, () -> {
// Disable the filter again
api.setOBSFilterEnabled(sourceName, filterName, false);
});
}
}
}