Advanced Scene Switcher

Advanced Scene Switcher 1.28.1

AaronD

Active Member
In an effort to simplify thing I am trying to do wondering if there is a way to do the equivalent of a "While loop"?
So do a compare on a video source looking for a number or letter in the selected area. Numbers / letters are numerous and a png file of what to use for the compare is used. So if say #1 is not found it moves on to #2 and so on until it matches.

so "while" video area "does not match" image file loop through all compare files until match is found. When match is found go switch scene, display something, etc.

Is something like that possible?
Sounds like you need a diagram first. Draw out what you really want, not necessarily how to do it yet, with examples if applicable, and then see what the tools can do with that. Maybe post the diagram here for some more eyes on the problem.
 

DougCPilot

New Member
You will have to introduce additional macros and pause / unpause the sequence macro you created already.

First create a macro that does whatever should happen when you start streaming.
In this example it will switch to a given scene and wait there for a fixed amount of time.
Make sure to add an additional action to the end of the macro handling the stream start that "unpauses" the sequence macro you created previously.

View attachment 91229

Next add one more macro that pauses the Sequence macro when you start the plugin.

View attachment 91228

There are of course many other ways of doing the same thing which might be better suited to your set up, but I still hope this example helped! :)
After a bit of trial and error, I was able to troubleshoot it and get it working on my PC by setting the conditions for each macro to "Plugin restarted". I will change as needed for a live stream trial and let you know if I run into problems.

As you said, there may be other/better ways to do this. If I was more involved in streaming and working with OBS, it would be worth spending more time getting to know the other options. At the moment that is not my priority. Maybe in the future...

Thanks so much for your help!
 

AaronD

Active Member
He is referring to looping for different conditions, not checking over and over again for a condition
In that case, would one of these work?:
  • Conditions
    • If Match A
    • Or Match B
    • Or Match C
    • Etc.
  • Actions
    • Switch Scene: Match
Or:
  • Macro A
    • Conditions
      • If match A
      • And Not Macro B
      • And Not Macro C
    • Actions
      • Switch Scene: Match A
  • Macro B
    • Conditions
      • If match B
      • And Not Macro A
      • And Not Macro C
    • Actions
      • Switch Scene: Match B
  • Macro C
    • Conditions
      • If Match C
      • And Not Macro A
      • And Not Macro B
    • Actions
      • Switch Scene: Match C
The And Not <other macros> might be optional, depending on how the matches work.

I guess another way to say it is, "Don't forget the plugin's logic in scanning the macros, in addition to the macros themselves." The sum total of everything, might actually do what you want.

If I'm still off, diagram.
 

michaelhagen

New Member
Is there a way to make a macro run when a scene transition starts? Or even before the scene transition starts? I'm using this plugin to toggle recording when I go to a "troubleshooting" or a "we will be right back" screen and it currently records the transition from content to these screens before pausing the recording.
 

Warmuptill

Active Member
Is there a way to make a macro run when a scene transition starts? Or even before the scene transition starts? I'm using this plugin to toggle recording when I go to a "troubleshooting" or a "we will be right back" screen and it currently records the transition from content to these screens before pausing the recording.
You can run a macro when a transition to a given scene / any scene started using the "Scene" / "Transition" condition types.

Regarding the option of detecting the "before the scene transition starts" scenario you would have to provide more details.
Is there anything that the plugin could be able to detect indication that it might be necessary to switch to "troubleshooting" or "we will be right back" scene? Maybe the "OBS stats" condition type might be of use here.
 

AaronD

Active Member
Is there a way to make a macro run when a scene transition starts? Or even before the scene transition starts? I'm using this plugin to toggle recording when I go to a "troubleshooting" or a "we will be right back" screen and it currently records the transition from content to these screens before pausing the recording.
Does it work to have a hotkey for "Technical Difficulties" that:
  • Stops recording
  • Transitions to that scene
in a single macro? Responding immediately to something so that you don't see it, usually works better to have a single macro do the response, and then the action that it was supposed to respond to.

Of course, you'd also have a hotkey for "Returning" that:
  • Transitions back to the previous scene
  • Starts recording
in a single macro.
 

kdarroch

Member
In that case, would one of these work?:
  • Conditions
    • If Match A
    • Or Match B
    • Or Match C
    • Etc.
  • Actions
    • Switch Scene: Match
Or:
  • Macro A
    • Conditions
      • If match A
      • And Not Macro B
      • And Not Macro C
    • Actions
      • Switch Scene: Match A
  • Macro B
    • Conditions
      • If match B
      • And Not Macro A
      • And Not Macro C
    • Actions
      • Switch Scene: Match B
  • Macro C
    • Conditions
      • If Match C
      • And Not Macro A
      • And Not Macro B
    • Actions
      • Switch Scene: Match C
The And Not <other macros> might be optional, depending on how the matches work.

I guess another way to say it is, "Don't forget the plugin's logic in scanning the macros, in addition to the macros themselves." The sum total of everything, might actually do what you want.

If I'm still off, diagram.
Second set is more what I do now but looking for a better way. Because the macros run serially I currently do as follows

If Match A
switch scene A
If Match B
switch scene B
ETC. ........
 

AaronD

Active Member
Second set is more what I do now but looking for a better way. Because the macros run serially I currently do as follows

If Match A
switch scene A
If Match B
switch scene B
ETC. ........
My "guard conditions" are to prevent glitching. But if the macros run serially (the "run in parallel" box is not checked for any of them), then you might have each one write to the same variable, and then have the final macro switch to whatever that variable says by then. That would also not glitch...unless the triggers themselves are unstable, in which case you need to fix that or increase the time that it needs to stay matched.

Code:
If (true)
    scene_name = ""
If (Match A)
    scene_name = "A"
If (Match B)
    scene_name = "B"
If (Match C)
    scene_name = "C"
If (scene_name != "")
    switch_scene(scene_name)
In case of multiple matches, later ones take priority. The first and last ones are to not switch when nothing matches, and to not fill the log with invalid attempts to switch. You might also want to check the "only on change" box for the Match macros, but not the first and last.
 
Last edited:

AaronD

Active Member
Are the macros Turing-complete yet? That'd be a big deal, because it would mean that ANY and ALL logic is possible! Just need to figure out how to do it...and what stupid amount of CPU power it would take to run a Universe sim on it.
 

Freddoccino

New Member
What an awesome plug-in, the Scence Groups in wiki is what im looking for, when i installed it, i only have General + macros tab. Is there somethings im missing?
 

Warmuptill

Active Member
What an awesome plug-in, the Scence Groups in wiki is what im looking for, when i installed it, i only have General + macros tab. Is there somethings im missing?
You can show the other tabs by unchecking the following option on the General tab:
200110831-02c6dce9-4f20-4c91-be41-e8d9fdebcb55.PNG

In general the Scene Groups tab should not be needed anymore however.

Let me know if you have any questions!
 

kdarroch

Member
Ok, this is driving me nuts. So I have loaded the latest and greatest of the OBS and The Advanced Scene Switcher. Almost every time I do pattern matching now OBS crashes.

Is there a specific way to execute a macro based on a video input?
should I look at the source or look at a scene with the source in it?
Does it mater what the source is, camera input, screen capture input, etc.

Previously I would only experience OBS crashes occasionally but now it's like every time I go select an area of the video source to look at

or is it just the new OBS being a pain in the ass
 

Attachments

  • Crash 2023-02-02 14-31-01.txt
    150 KB · Views: 10

Héraès

Member
That should be possible with a setup using a variable:
Oh my gosh... you're a genius. This works !! I had tried the variable, but I missed the "current scene match" and "set to condition" fields.

You can't know how stressful is computing due to devs not investing themselves too deeply in complex stuffs, and here you have prepared all the most useful things before anyone even asking you. Clearly a mark of a professionnal dev.

I want to THANK YOU <3. I'm gonna check your github.

NB : Please everyone give him some force because such a good work and energy in a plugin is rare.
 

Warmuptill

Active Member
Ok, this is driving me nuts. So I have loaded the latest and greatest of the OBS and The Advanced Scene Switcher. Almost every time I do pattern matching now OBS crashes.

Is there a specific way to execute a macro based on a video input?
should I look at the source or look at a scene with the source in it?
Does it mater what the source is, camera input, screen capture input, etc.

Previously I would only experience OBS crashes occasionally but now it's like every time I go select an area of the video source to look at
I apologize for this :(
I will try to look into this further on the weekend.

Just to clarify:
Is the crash / freeze issue only happening when interacting with the setting dialog of the plugin?
Or does this also happen when the settings window is closed?

or is it just the new OBS being a pain in the ass
I think that is unlikely.
 
Last edited:

kdarroch

Member
I apologize for this :(
I will try to look into this further on the weekend.

Just to clarify:
Is the crash / freeze issue only happening when interacting with the setting dialog of the plugin?
Or does this also happen when the settings window is closed?


I think that is unlikely.
Only happens in my experience when the plugin window is open.

It did finally not crash and I was able to set the area to check in but it still crashes 90% of the time.

No need to apologize, I am by no means a programmer so I tend to break things often either by accident or just because I don't know what I am doing and just try stuff till it works
 

kdarroch

Member
New thing I am trying to do
Have enabled Replay buffer and set max replay time to say 7 seconds
In ASS (advanced scene switcher, guess that's a funny acronym) I have a macro that executes when a video changes in a specified area
Macro waits for say 3 seconds with a Wait
Then writes the replay buffer with a Replay Buffer Save

It worked a few times but had different lengths and then all of a sudden it just quit workings, not seeing the input change

What I am trying to do is have a macro that when executed will capture 7 to 10 seconds of video, 7 seconds in past and 3 seconds after the event happened.

Any ideas? Is this doable?
Any help is appreciated
 

Enko63

New Member
You can use a single File condition to match multiple patterns using regular expressions.
For example, the regular expression (pattern1)|(pattern2)|(pattern3) would match if the file only contains either of the following lines:
  • pattern1
  • pattern2
  • pattern3
View attachment 91194

Regular expressions can be very powerful, but also complicated.
I would suggest testing them on https://regex101.com/.

And sorry about the delayed response.
I somehow missed your message.
Thanks. That's exactly what I was looking for.
 

AaronD

Active Member
I am by no means a programmer so I tend to break things often either by accident or just because I don't know what I am doing and just try stuff till it works
I'm a programmer too. People like you are both annoying and necessary to us.
  • Annoying because you break our carefully-crafted house of cards.
  • Necessary because our stuff really needs to be stronger than that, and we're so used to how we thought it should be used that we can't see anything different anymore.
So keep hammering on it and reporting problems. :-)
 
Top