Advanced Scene Switcher

Advanced Scene Switcher 1.32.3

Laczkó

Member
Hi,

I've a logic that I couldn't find an automation with ASS for, maybe somebody have an idea.
I've a bunch of scenes:
Scene 1, scene 2, scene 3, ..., scene n
I make a loop of some of the scenes in the following way: a macro starts "scene 1" at a specific time, than an other macro switch to "scene 2" after "scene 1" was played for 10 seconds, after another 10 seconds comes "scene 3" and so on, until "scene m" is played for 10 seconds (m=<n), than a macro not switch to "scene m+1", but to scene 1. This way I can easily change the length of the loop which is necessary, I want to change it quite frequently.
I want the loop to goes on for 1 minute except if more time needed to all the scenes showed at least once (so if more than 6 scenes are in the loop). Currently I have a macro, that cut off the loop at a specific time by switching to a scene that isn't part of the loop, so I have to set up the cut off time manually to one minute later than the loop starts if it has 6 or less scenes in it and to 10 seconds times the number of scenes in the loop later than the loop starts if it has more than 6 scenes in it. Is there a way to define a macro that adjust the cut off time to match the criteria above automatically?
 

Warmuptill

Active Member
Scene 1, scene 2, scene 3, ..., scene n
I make a loop of some of the scenes in the following way: a macro starts "scene 1" at a specific time, than an other macro switch to "scene 2" after "scene 1" was played for 10 seconds, after another 10 seconds comes "scene 3" and so on, until "scene m" is played for 10 seconds (m=<n), than a macro not switch to "scene m+1", but to scene 1. This way I can easily change the length of the loop which is necessary, I want to change it quite frequently.
This part I would implement like so:
  • Setup variables:
    One to handle the counting. (counter)
    One to store the current scene check. (current scene name with counter suffix)
    One to store the name of the scene to switch to (next scene name with counter suffix)
    Optionally one to store the point at which to restart the loop. (restart) This could be hardcoded in the later macro, but you mentioned you will change it frequently.
    1761338671578.png
  • Setup a helper macro to populate the scene name variables based on the counter value:
    1761339047230.png
    It won't need any conditions as we will trigger it from another macro.
  • Add the macro which does the scene switching based on the variable values we set up earlier:
    1761339099431.png
  • Add a final macro to restart the loop:
    1761339936783.png
You can import these example macros using this code:
Code:
AABGGnic7Vzdb9s2EP9XBKIPW2d5kuXESt62NMMMNG0Wp+3DWgy0dJK5ypRBUm5aI//7jtS38+UsbdN1fCigHO+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fEs0v4+tT5Y55m4S345GrvXlo3a23vWtrGdndNvK2lb2O2ll/6cXkb7FNottFtsstn2vH8nc1EtbqLNQZ6HOQt2XhzpA5o8V0H3AiXjNJOsz3hfbtA0WzCyYWTD7vsFsx59X3rVI0vs/SHbusSRdV5uUV6eQ0CJTzWd4nd9vdhtJd9fXXs51ZUZXZPyuUNvSbcn5g9qjZI/cuu/NmHyX7c21KYa5gCooTcyIPwxGQ8+dg6Jo8z9BL/GH

Note that the helper macro is not strictly necessary and you could put that part of the logic in the scene switch macro.
It just think it makes it a bit cleaner to have that part separated and you might want to reuse it to setup up initial values on OBS startup.

I want the loop to goes on for 1 minute except if more time needed to all the scenes showed at least once (so if more than 6 scenes are in the loop). Currently I have a macro, that cut off the loop at a specific time by switching to a scene that isn't part of the loop, so I have to set up the cut off time manually to one minute later than the loop starts if it has 6 or less scenes in it and to 10 seconds times the number of scenes in the loop later than the loop starts if it has more than 6 scenes in it. Is there a way to define a macro that adjust the cut off time to match the criteria above automatically?
For this I would introduce another variable which tracks if all scenes have been visited.
This is the case if the "Restart" macro was executed at least once.
So, simply append something like this to the end of the action list:
1761340171949.png


Then introduce another macro which pauses the scene switch macro if more than 60 seconds have passed or the "every scene was visible" was set to "true".

Hope that helps!
 
Last edited:

NudelForce

New Member
@Warmuptill thank you for the link. Didn't think about looking in the github for a Wik.
Got it to work!

With inline:
Python:
import obspython as obs
from pythonosc.tcp_client import SimpleTCPClient

def run():
  print("Swiching to Table")
  ip = "127.0.0.1"
  port = 16284
  preset_id = 1
  client = SimpleTCPClient(ip, port)
  client.send_message("/OBSBOT/WebCam/Tiny/TriggerPreset", [0, preset_id])
  print(f"Sent OSC message to /OBSBOT/WebCam/Tiny/TriggerPreset with preset_id={preset_id}")
  return True

For using a file i needed to add the script_load stub
Python:
def script_load(settings):
    def run_wrapper(data):
        id = obs.calldata_string(data, "id")
        if id == "path/to/the/script/py-osc-scene-switcher-1.py":
            ret = run()
            obs.calldata_set_bool(data, "result", ret)
    sh = obs.obs_get_signal_handler()
    obs.signal_handler_connect(sh, "advss_run_temp_script", run_wrapper)

What would autogenerate that function?
Also my IDE (VS Code) does not recognize obspython. Can you tell me how to make that one known?
 

Warmuptill

Active Member
What would autogenerate that function?
When you select a path which does not yet exist and click the "Open" button the file will be populated with the auto generated code.
1761503428591.png

Also my IDE (VS Code) does not recognize obspython. Can you tell me how to make that one known?
I believe this file can be found in the obs-scripting directory.
So, for example:
C:\Program Files\obs-studio\data\obs-scripting\64bit\obspython.py
 
Last edited:

vzx

New Member
1761643612200.png
1761643634751.png

Under "Configure Video" for a Video Capture Device source (capture card) there's "SIGNAL STATUS"
Is there a way to use this in a macro to make the Advanced Scene Switcher do things when this changes? It seems my capture card always outputs the "NO SIGNAL" image, so the typical "has no output" etc conditions don't work.
 

Warmuptill

Active Member
View attachment 116324View attachment 116325
Under "Configure Video" for a Video Capture Device source (capture card) there's "SIGNAL STATUS"
Is there a way to use this in a macro to make the Advanced Scene Switcher do things when this changes? It seems my capture card always outputs the "NO SIGNAL" image, so the typical "has no output" etc conditions don't work.
Unfortunately, I don't think there is away to access this information via the OBS API.
So, unless this information is available to the advanced scene switcher via some other way I don't think you can use it in your macros.
 
  • Like
Reactions: vzx

MOONYelper

New Member
Sweet adds! I immediately jumped on those OBS preview actions. It seems like the Disable preview is a little wonky for me, though. If I disable through the action, I can't re-enable using the Enable preview action (which also renders Toggle preview a "disable only"). I also have to click Enable Preview on the OBS window twice in order for the preview to show back up.
Triggering the preview enable/disable via the frontend hotkey does not share this behavior.

Also, it looks like the images on this post are private.

Thanks for this amazing plugin!
 

PaleNimbus

New Member
With the 1.32.0 update, I can no longer select scenes on Linux (flatpak). The drop-down menu is empty. I am on Linux Mint 22.1.
Downgrading to 1.31.0 makes it work again.
 

Attachments

  • obs1.png
    obs1.png
    6.1 KB · Views: 13

Tallicia

Member
Love the updates! Absolutely fantastic!

One/Two quick questions/requests. Can the variables be dockable, able to be opened in a separate window so that the macros can be seen side by side with the variables? - And for icing on the cake, could a search/filter top entry field be added to filter the variables displayed?

Thank you, as always!
 

Warmuptill

Active Member
Sweet adds! I immediately jumped on those OBS preview actions. It seems like the Disable preview is a little wonky for me, though. If I disable through the action, I can't re-enable using the Enable preview action (which also renders Toggle preview a "disable only"). I also have to click Enable Preview on the OBS window twice in order for the preview to show back up.
Triggering the preview enable/disable via the frontend hotkey does not share this behavior.

Also, it looks like the images on this post are private.

Thanks for this amazing plugin!
Ah right ... I remember now why I didn't want to merge those changes ... :D

Unfortunately, that is a bug in the OBS API.
I raised a PR to fix it on OBS side:
The fix was approved but not yet merged into an official OBS release.

So, this issue will be resolved once the behavior is fixed on OBS side.

Sorry about that!

With the 1.32.0 update, I can no longer select scenes on Linux (flatpak). The drop-down menu is empty. I am on Linux Mint 22.1.
Downgrading to 1.31.0 makes it work again.
Sorry about that - I will look into it.

Love the updates! Absolutely fantastic!

One/Two quick questions/requests. Can the variables be dockable, able to be opened in a separate window so that the macros can be seen side by side with the variables? - And for icing on the cake, could a search/filter top entry field be added to filter the variables displayed?

Thank you, as always!
At the moment that is not possible, but I will add it to the list of things to do.
Thanks for the suggestion!
 

Warmuptill

Active Member
With the 1.32.0 update, I can no longer select scenes on Linux (flatpak). The drop-down menu is empty. I am on Linux Mint 22.1.
Downgrading to 1.31.0 makes it work again.
I was able to identify the issue and it should be fixed with the latest release.
Just to be sure, can you please confirm, if everything now works as expected on your side, too?
Thanks!
 

hpanioniv

New Member
Been having a bit of a bug with setting variables from macro properties. It works as intended when first set up, but it seems that every time I relaunch OBS, the property selection is cleared every time. I end up having to reselect the correct property for every variable that uses that method, which is incredibly tedious.

In my case, specifically, I am setting variables to the width and height of specific sources, as seen below:

1761795307230.png


Whenever I relaunch OBS, it appears like below:

1761795473173.png


I have multiple instances like this throughout various macros. Exporting and reimporting settings don't solve the issue.

On a separate subject, any possibility for triggers to be added for Media state conditions such as "next" and "previous"? In my current setup, the Media state "ended" condition is used to trigger actions when videos in a VLC playlist end. This works perfectly fine until I want to manually press "next" or "previous" as those actions don't have any condition triggers associated with them. Is this functionality you have ability to look into on your end, or is that entirely a OBS/VLC caused restriction?

Thanks!
 

Warmuptill

Active Member
Been having a bit of a bug with setting variables from macro properties. It works as intended when first set up, but it seems that every time I relaunch OBS, the property selection is cleared every time. I end up having to reselect the correct property for every variable that uses that method, which is incredibly tedious.

In my case, specifically, I am setting variables to the width and height of specific sources, as seen below:

1761795307230.png


Whenever I relaunch OBS, it appears like below:

1761795473173.png


I have multiple instances like this throughout various macros. Exporting and reimporting settings don't solve the issue.
Sorry about that and thanks for letting me know about the problem!
I think I was able to track down the problem and will release yet another update shortly.

Please let me know this new version resolves the issue on your side! :)

On a separate subject, any possibility for triggers to be added for Media state conditions such as "next" and "previous"? In my current setup, the Media state "ended" condition is used to trigger actions when videos in a VLC playlist end. This works perfectly fine until I want to manually press "next" or "previous" as those actions don't have any condition triggers associated with them. Is this functionality you have ability to look into on your end, or is that entirely a OBS/VLC caused restriction?
Unfortunately, I believe there is no direct "next" / "previous" signal.
But I will have another look once I find the time to.
 

songbirder

New Member
This plugin's been broken for me since OBS 32, and today I tried to update it but now OBS 32.0.2 crashes on every launch until I remove the scene switcher. Is there any way I can find and remove my scene data as well and start it fresh and maybe import my old backups? I have a ton of scripts I've built over the years and am worried they are all basically gone now.
 

Warmuptill

Active Member
This plugin's been broken for me since OBS 32, and today I tried to update it but now OBS 32.0.2 crashes on every launch until I remove the scene switcher. Is there any way I can find and remove my scene data as well and start it fresh and maybe import my old backups? I have a ton of scripts I've built over the years and am worried they are all basically gone now.
Can you share a crash log and OBS log?
Which version of the plug-in are you using?

Backups should automatically created if the version you are using is not too old:

This wiki page also describes where your settings are stored.
 

ArdSagart

New Member
Hi! I just tried the plugin version 1.32.2 on my OBS 32.0.1
Macro which should send a message in twitch chat doesn't work (timestamp issue or something like that). Macro which hides a source works.
OBS cannot be closed normally, window is not responding after the close command.
I switched back to 1.31.0
 
Top