OBS Remote Parameters Script.
Change the scenes and control the visibility of the sources using commands from the chat.
Attention!
This material is designed for the fact that you have read the previous articles on SLCB, or have an idea of how to install scripts and the program as a whole.
Streamlabs Chatbot: Basics
Streamlabs Chatbot: Basics pt.2
Streamlabs Chatbot pt. 3
A small lyrical digression
The ability to manage OBS sources is a cool feature that allows you to significantly transform streams and add interactive content. SLCB is not the only tool that can solve this problem. The so-called virtual stream decks are very popular: the freely distributed and very powerful Lioranboard
https://obsproject.com/forum/resources/lioranboard-stream-deck-animator.862/, as well as having the free and paid versions of Touch Portal https://www.touch-portal.com/. The advantage of these programs is that they are able to integrate into other platforms (not just twitch/youtube);
you can assign a large and diverse number of actions to virtual buttons;
you can enable/disable filters for sources;
and, what was important for me: they can respond to the user receiving a Reward for channel points on Twitch. SLCB currently does not know how to interact with Rewards and source filters, but it is possible that in the future developers will add this feature.
Lioranboard, in my case, could not be installed correctly and it constantly gives an error. But, I know several streamers who actively use this application and have no difficulties. I did not deal with this problem and just installed Touch Portal and so far I am content with the functions of the free
version of this program. And I will certainly tell you more about it, but in another article.
The reason why SLCB remains my main tool for managing OBS scenes/sources is in their large number (only about 100 commands for changing the background). And Touch Portal is just an auxiliary tool for processing Channel Rewards. Therefore, if you plan to add OBS management via chat or rewards, but your idea does not involve a large number of sources/scenes, then perhaps the best solution is to choose LioranBoard or TouchPortal, which have much broader functionality. Conversely, if you do not want to install any more additional programs, and you need to switch, for
example, only camera angles without linking to the channel points, then SLCB and the script for it will also be an excellent solution and addition to the main functions of the SLCB.
Installation
I wrote about installing scripts and Web Socket in the first article, but we will briefly run through it again.
First of all, you need the OBS plugin Websocket Remote Control – https://obsproject.com/forum/resources/obs-websocket-remote-control-obs-studio-from-websockets.466/ . By the way, it is possible that starting with a certain version of OBS, it already goes immediately built-in. But just in case, I leave a link.
In any case, after installing the plugin, you need to find the Tools section in the top menu of OBS→Websocket Server Settings. In the pop-up window, we set the checkboxes to “Enable WebSockets server” – we set the port, for example, 4444 and “Enable authorization” – we invent and enter a password.
Go back to SLCB and find the OBS Remote section in the Connections section. If you have OBS running on the same computer as SLCB, then leave the IP string 127.0.0.1 unchanged . If you have OBS on the second PC, then you need to enter its IP here. Enter the password that we came up with in OBS, put the same port (4444) as in OBS and click Connect.
Attention! You need to connect to OBS every time you launch the program!
Next, we set the script for SLCB-OBS Remote Parameters – https://github.com/Consoletation/OBSRemoteParameters. In the Scripts section, import it, then right-click on it in the list and select Insert API key and reload/refresh the entire list of scripts with the button at the top right
(this procedure is necessary for most scripts. Also, after making changes in the script settings, it is also recommended to update the list so that the revisions take effect).
The script does not have any settings — in its description there is only a button with a call to the Readme file with instructions for composing the command syntax. That’s what we’ll look at next.
Commands and what the script can do
The required functions are specified by a specific code in the Response of the specified command. All you need to do is copy the code and substitutethe names of your scenes/sources and time parameters (if any). Important point: scene names and parameters should always be enclosed in quotation marks! Also, the names of the scenes/sources must exactly match their names in OBS, up to the uppercase / lowercase characters. And you can’t give OBS scenes/sources names with apostrophes and double quotes.
It is noteworthy that in addition to this code, you can add other text to the command, if necessary (for example, emoticons were printed in the chat, a message or an audio file was played).
1) CHANGE TO SCENE
$OBSscene(“scene”)
Specify the scene that OBS should switch to after the command appears in the chat.
For example:
We have a scene in OBS called MAIN . Creating a command !main and in Response we write:
$OBSscene(“MAIN”)
2) CHANGE TO SCENE WITH OPTIONAL DELAY
$OBSscene(“scene”, “delay”)
For example:
We need to switch to the scene not immediately, but after 2 minutes.
Writing:
$OBSscene(“MAIN”, “120”)
3) SET VISIBILITY OF SOURCE IN ACTIVE SCENE
$OBSsource(“source”, “visible”)
Specify the name of the source and set its visibility parameter (true- visibility is enabled, false-visibility is disabled).
For example:
We have an image source CinemaPanel.
The command !cinema_on will enable its visibility:
$OBSsource(“CinemaPanel”, “true”)
The command !cinema_off will disable its visibility:
$OBSsource(“CinemaPanel”, “false”)
4) SET VISIBILITY OF SOURCE IN TARGET SCENE
Almost the same as step 3, but a parameter is added indicating the
scene where the source is located. This is useful in cases where in OBS you
use a scene within a scene.
$OBSsource(“source”, “visible”, “scene”)
For example:
$OBSsource(“CinemaPanel”, “true”, “MAIN”)
5) CHANGE TO SCENE THEN TO ANOTHER SCENE AFTER A SET
$OBStimedScene(“scene1”, “scene2”, “delay”)
For example:
We have the MAIN and CatCam scenes. We need the command to
switch from the active scene (let’s say MAIN) to CatCam, which should be
active for a minute and then return back. Writing:
$OBStimedScene(“CatCam”, “MAIN”, “60”)
6) SET TIMED VISIBILITY OF SOURCE IN ACTIVE SCENE
$OBStimedSource(“source”, “mode”, “delay”)
The Mode parameter determines what should happen to the source’s
visibility: onoff – enable and then disable. Offon-disable, and then enable.
For example:
We have a GIF with an animation of applause-Clap . We need to get on
the command !clap this gif was visible for 3 seconds and then disappeared
from the screen. Writing:
$OBStimedSource(“Clap”, “onoff”, “3”)
Important: in this case, of course, in OBS, the source must be initially
located with visibility turned off.
7) SET TIMED VISIBILITY OF SOURCE IN TARGET SCENE
Everything is the same as in step 6, only the scene parameter is added.
$OBStimedSource(“source”, “mode”, “delay”, “scene”)For example:
We need the command to turn off the visibility of the CinemaPanel
source located in the MAIN scene for 10 seconds, and then to make it appear
on the screen again. Writing:
$OBStimedSource(“CinemaPanel”, “offon”, “10”, “MAIN”)
8) STOP STREAMING
$OBSstop
You can also make a command (for example, for trusted moderators) to disable the stream. If you suddenly forgot to do it, or for some other reason.
So we have analyzed all the available functions of this wonderful script. With this arsenal and creative approach, you can bring a lot of new and interesting things to your streams.
Try, experiment, create!