That one DOES work, using Adv. SS on both ends. At first, I just set up some hotkeys in the Master to brute-force it, and the Slave did change scenes. So that part is good.(if I can also get a WS message from one instance to another on the same machine, when they insist on using the same server settings)
And I eventually got a complete system to work. It's a bit hokey, but it does work. Turns out that only the first instance of OBS gets connected to the WebSocket server, so I can't talk directly to the second one, but a later instance of Adv. SS can still connect to the first one and see its Events. So:
- A reworked Python script (using a different module because OBS 28 uses an updated, incompatible protocol) connects to both Events and Requests, both of which can only see the Master, and registers itself for the "CurrentProgramSceneChanged" event.
- OBS Master changes scenes.
- The Python callback function for the "CurrentProgramSceneChanged" event does the regexes on the scene name and sends a "CallVendorRequest" with the appropriate message for Adv. SS to pick up.
- Master Adv. SS has a macro for each Request (no regex required at this point) that:
- Sends a matching Event.
- Fades the global audio sources.
- Slave Adv. SS has a macro for each Event, that switches to the corresponding scene.
The reworked python script is:
Python:
#!/usr/bin/env python
import re
import sys
import subprocess
import obsws_python as obs
try:
OBS_Event = obs.EventClient(host="localhost", port=4455, password="NotTheRealPassword!")
except:
print("Error: Could not connect to OBS Event")
sys.exit(-1)
try:
OBS_Request = obs.ReqClient(host="localhost", port=4455, password="NotTheRealPassword!")
except:
print("Error: Could not connect to OBS Request")
sys.exit(-2)
def on_current_program_scene_changed(data):
name = data.scene_name
message = ""
if re.match("^Camera.*$", name):
message = "Camera"
if re.match("^Feature.*$", name):
message = "Feature"
if re.match("^Voiceover.*$", name):
message = "Voiceover"
if (message != ""):
OBS_Request.call_vendor_request(vendor_name="AdvancedSceneSwitcher", request_type="AdvancedSceneSwitcherMessage", request_data={"message": message})
OBS_Event.callback.register(on_current_program_scene_changed)
# Expect a dialog command and message, to be passed as arguments to this script
# Closing the dialog is taken as a shutdown command, so this doesn't return until then
if (len(sys.argv) > 1):
subprocess.run(sys.argv[1:])
else:
subprocess.run(["zenity", "--info", "--width=350", "--title=Testing", "--text=Click OK to disconnect."])
sys.exit(0)
And the macros:
Master:
Slave: