Advanced Scene Switcher

Advanced Scene Switcher 1.28.1

Mark Weiss

Member
Three macros and one variable for the main logic, plus a couple of "helper macros":
  • Program Transition:
    • Set the variable to 2
    • Play the bumper
  • Every 15-minutes regardless, AND variable not 0:
    • Decrement the variable (must decrement here, don't set it to a constant)
  • Variable is 0:
    • Set the variable to 1
    • Play the bumper
Think that through, maybe with some scratch paper, and see if it works for you.

The hotkey is just a placeholder. Use whatever condition you want to change programs.
View attachment 99866


The condition to Play the Bumper is intentionally blank, so it only runs when another macro calls it.
The action here is also a placeholder. Replace it with whatever you actually do to play the bumper.

The Return from Bumper macro is entirely a placeholder. You can do what you like with it too. I use this structure a lot because I normally have live cameras, and I want to return automatically to the same camera after a video.
I'm building these macros now. The hot key part is confusing since I am letting this do its thing unattended--there's no hotkey input.

Can you explain the first macro in more detail? Perhaps it isn't needed for my application?
 

AaronD

Active Member
I'm building these macros now. The hot key part is confusing since I am letting this do its thing unattended--there's no hotkey input.
That's a placeholder. I wanted to differentiate it from the others that legitimately have no condition, and the hotkey is handy for manual testing.

Don't just blindly copy it, but understand what it does and adapt my low-effort guess to what you actually need.

Can you explain the first macro in more detail? Perhaps it isn't needed for my application?
If you already have a macro to change programs, then that one gets merged with it. You need its actions to be done at that time somehow...

Again, step through it yourself, probably with some scratch paper, and see both what it all does and how it does it. Keep track of what value the variable has at each point.
In other words, this is a programming language, and you should run the program *yourself* in simulation, not on the machine for real yet, to see that it actually works or how it doesn't.
 

Mark Weiss

Member
What I'm having difficulty understanding is the variable part. Is that like poking a bit into a register and then later reading it based on a conditional branch? What is the purpose of the variable?

I think if I could modify my macros to be aware of what the other macro is doing with regard to the break/bumper, I could avoid having bumpers accidentally playing back to back. It happens when the bumper plays, triggered by the end of one program and the start of another, but then 15 minutes is also coming to a close and the 15 minute macro executes too, causing the bumper to play again too soon. The idea is for the 15 minute timer to reset when a program ends and starts another. But I don't know if one macro can modify/reset the timer on another macro.
 

Laczkó

New Member
But I don't know if one macro can modify/reset the timer on another macro.
It can. You can use "Timer" action (shown below) and set it to "Reset timers on Commercial Timer". In the condition part of the macro you check if a program change happens, so every time it happens, your timer in your "Commercial Timer" macro going to reset.
Reset timer.png
 

AaronD

Active Member
You can use "Timer" action (shown below) and set it to "Reset timers on Commercial Timer". In the condition part of the macro you check if a program change happens, so every time it happens, your timer in your "Commercial Timer" macro going to reset.
View attachment 99964
That can work too. Like I've said a number of times, "This is a programming language. There are lots of different ways to do the same thing, and all of them have different side-effects."

If you really care about the details, and you know what you're doing, then you'll likely have several different ways in your head at the same time, already simulated, and you'll spend more effort designing the side-effects for various reasons, than you spend on the main function.

---

As an example of designing the side-effects, Laczkó's version guarantees that there will always be exactly 15 minutes between the program change and the first break, while mine doesn't have that guarantee. Mine is "free-running", as we say, similar to your first example, and only causes some of the timer events to do nothing, depending on the value of the variable at that moment. Most of my logic, then, is to manage the value of that variable.

It might be hard to see that, because I'm using the value alone as the direct trigger for the break, but it should emerge when you consider *when* that particular value appears, and what else also happens in that context, both before and after, as all of the macros do what they're set for.
 
Hey, guys, i have been told to post my question over here, so here goes:



I am running a makro on Win 11 with Obs 30.0.0 that checks for text in video and works fine as long as i hit "Run macro". It finds the text and executes the makroactions just like i want.

I would like it to continuously check for that condition and execute said makro if conditions are true. I took the general page with "check conditions every x ms" to do just that (compare added screenshot, i tried variants of 50-500ms). Apparently it doesn't? Can i make it do that? Does it even make sense to do that?

The scenario is literally me queuing a game. Queue Pops at an undetermined point in time ("accept" or some variant appears, which i am confident i can find) and then i would like the makro to execute.

Thanks for your help in advance! <3
 

Attachments

  • Screenshot 2023-12-09 195441.png
    Screenshot 2023-12-09 195441.png
    36.3 KB · Views: 25
  • Screenshot 2023-12-09 233625.png
    Screenshot 2023-12-09 233625.png
    53.4 KB · Views: 26

Warmuptill

Active Member
works fine as long as i hit "Run macro"
Hitting the "Run macro" button runs the actions for the selected macro regardless of the current condition state.
So it does not attempt to find any text in that case.

You will have to tweak the OCR settings so the text can be detected.
Without knowing what the text looks like it is very difficult to say what would need to be adjusted exactly, but I assume you will have to adjust the text color.
Note that depending on what the text looks like it might also be an option to simply rely on pattern matching instead of OCR.
 
Hitting the "Run macro" button runs the actions for the selected macro regardless of the current condition state.
So it does not attempt to find any text in that case.

You will have to tweak the OCR settings so the text can be detected.
Thank you for your response!

I believe i have done that. I am trying to make a simpler version of my idea work first, so i am capturing the normal editor with the text "Switch". Please find attached screenshot of proof it is indeed finding the only word "Switch". Im comfortable with finding the right colour scheme and everything.

I understand the entire thing to be: "Upper screen" of the macro with "if" condition clause and the bottom to be a "then" clause with whatever i want it to do. Is that correct?

The only part that doesn't seem to work is either the makro not caring about the condition, not connecting condition with action or not even checking continuously for the action as far as i can tell and i do not know how to check for any of these things at this point.
 

Attachments

  • Screenshot 2023-12-10 170935.png
    Screenshot 2023-12-10 170935.png
    76.1 KB · Views: 14

Warmuptill

Active Member
I understand the entire thing to be: "Upper screen" of the macro with "if" condition clause and the bottom to be a "then" clause with whatever i want it to do. Is that correct?
Yes, that is correct.

The only part that doesn't seem to work is either the makro not caring about the condition, not connecting condition with action or not even checking continuously for the action as far as i can tell and i do not know how to check for any of these things at this point.
Can you export your macros to a file so I can test it on my end?
What also could be useful is a verbose OBS log of the time when the actions are not performed while you expect them to.
You can find the log files in OBS under Help > Log Files.
 
Can you export your macros to a file so I can test it on my end?
What also could be useful is a verbose OBS log of the time when the actions are not performed while you expect them to.
You can find the log files in OBS under Help > Log Files.
settings are uploaded.


logs are returning this:

23:58:47.729: [adv-ss] Macro Dota Picking Screen Macro is paused
23:58:47.729: [adv-ss] Macro Normal Dota Scene is paused
23:58:47.738: [adv-ss] condition video returned 0
23:58:47.738: [adv-ss] Macro Testmacro returned 0
23:58:47.739: [adv-ss] try to sleep for 490
23:58:48.229: [adv-ss] Macro Dota Picking Screen Macro is paused
23:58:48.229: [adv-ss] Macro Normal Dota Scene is paused
23:58:48.238: [adv-ss] condition video returned 0
23:58:48.238: [adv-ss] Macro Testmacro returned 0
23:58:48.240: [adv-ss] try to sleep for 490

i guess try to sleep is the intervall i entered in general as 500ms

The text under "Show match" is being found the way i typed it i would expect condition video to return a 1 in this situation.

i guess another thing i could try is removing all the individual scenes and make it vanilla (i have like 20 scenes for different games/scenarios, idk if that affects anything), but it shouldnt cause the obs main output is being scanned agaik.

i believe the scene switcher version is 1.23.1 atm.

thank you for your help!
 

Attachments

  • Scene switcher settings.txt
    10.7 KB · Views: 12
Latest update is causing OBS to crash on start here. Removed Advanced Scene Switcher and OBS starts fine. tested multiple times.

I see the message from Advanced Scene Switcher asking to backup settings on launch of PBS, but do not see OBS itself. It then crashes.

Unhandled exception: c0000005
Date/Time: 2023-12-11, 09:20:30
Fault address: 7FFADDD80B7D (c:\program files\obs-studio\bin\64bit\qt6widgets.dll)
libobs version: 30.0.0 (64-bit)
Windows version: 10.0 build 22631 (release: 23H2; revision: 2792; 64-bit)
CPU: 13th Gen Intel(R) Core(TM) i9-13900K

Maybe the issue is the backup message itself.

I put the plugin files back and now OBS starts but there was no backup message from Advanced Scene Switcher and all my Macros have gone.
 

Warmuptill

Active Member
Latest update is causing OBS to crash on start here. Removed Advanced Scene Switcher and OBS starts fine. tested multiple times.

I see the message from Advanced Scene Switcher asking to backup settings on launch of PBS, but do not see OBS itself. It then crashes.



Maybe the issue is the backup message itself.

I put the plugin files back and now OBS starts but there was no backup message from Advanced Scene Switcher and all my Macros have gone.
Strange - I am not able to reproduce that behavior.
The backup message would only be shown if there is a version change.
If you have uninstalled the plugin and started OBS and then re-installed the plugin there will be no backup message.

I doubt that it will help, but can you share the full crash log?
If you start OBS without the plugin installed then the plugin settings are gone, unfortunately.
 
Strange - I am not able to reproduce that behavior.
The backup message would only be shown if there is a version change.
If you have uninstalled the plugin and started OBS and then re-installed the plugin there will be no backup message.

I doubt that it will help, but can you share the full crash log?
If you start OBS without the plugin installed then the plugin settings are gone, unfortunately.

Hi thanks for the reply.

Yes I can share one of the logs. I still have it on clipboard. (Attaching).

I downloaded and installed the latest update released (yesterday)
I started OBS a number of times, OBS just disappeared and one or two times I saw the Advanced Scene Switcher backup message (which I always see after updating Advanced Scene Switcher to the latest version). But could not interact with that message.
The message stayed up front even after OBS had crashed but could not be interacted with.

Advanced Scene Switcher was the only thing I had changed since my last OBS session so I figured this may be the issue.

I dragged the plugin files away and OBS started fine.
Put them back and OBS started fine but as you say, settings all gone.

Restored settings from backup. All OK now.

I did also have a little trouble restoring from backup. Some settings were not restored. I had to remove all Advanced Scene Switcher settings again and then restore.

While I am here, you mention that opening OBS without the plugin, it is expected that the settings are gone. is there anything that can be done about this? And where are those settings stored? (Yes, we can Export backup but it would be good to be able to actually backup the entire settings just in case).

Cheers,
 

Attachments

  • log.txt
    150 KB · Views: 13

AaronD

Active Member
...opening OBS without the plugin, it is expected that the settings are gone. is there anything that can be done about this? And where are those settings stored? (Yes, we can Export backup but it would be good to be able to actually backup the entire settings just in case).
They're part of the Scene Collection. All one chunk of data that contains everything that is loaded at that moment. If a plugin doesn't load, then neither are its settings from the old Collection, and so the new Collection doesn't have them.

I really don't like how that works, especially since the change from OBS v27 to v28 was automatic for a lot of people, and the change of graphics engines at that specific point meant that almost all plugins failed to load. No warning, and no recourse. And it affected *all* plugins, not just this one. Hope you backed everything up before the unwarned automatic upgrade, because it's gone otherwise!
 
They're part of the Scene Collection. All one chunk of data that contains everything that is loaded at that moment. If a plugin doesn't load, then neither are its settings from the old Collection, and so the new Collection doesn't have them.

I really don't like how that works, especially since the change from OBS v27 to v28 was automatic for a lot of people, and the change of graphics engines at that specific point meant that almost all plugins failed to load. No warning, and no recourse. And it affected *all* plugins, not just this one. Hope you backed everything up before the unwarned automatic upgrade, because it's gone otherwise!
Ahh got it, thanks for the info. yes I always have lots of backups.

(Oh... OBS now updating... 30.0.2 fwiw.)

All running fine now anyway.
 

Warmuptill

Active Member
settings are uploaded.


logs are returning this:

23:58:47.729: [adv-ss] Macro Dota Picking Screen Macro is paused
23:58:47.729: [adv-ss] Macro Normal Dota Scene is paused
23:58:47.738: [adv-ss] condition video returned 0
23:58:47.738: [adv-ss] Macro Testmacro returned 0
23:58:47.739: [adv-ss] try to sleep for 490
23:58:48.229: [adv-ss] Macro Dota Picking Screen Macro is paused
23:58:48.229: [adv-ss] Macro Normal Dota Scene is paused
23:58:48.238: [adv-ss] condition video returned 0
23:58:48.238: [adv-ss] Macro Testmacro returned 0
23:58:48.240: [adv-ss] try to sleep for 490

i guess try to sleep is the intervall i entered in general as 500ms

The text under "Show match" is being found the way i typed it i would expect condition video to return a 1 in this situation.

i guess another thing i could try is removing all the individual scenes and make it vanilla (i have like 20 scenes for different games/scenarios, idk if that affects anything), but it shouldnt cause the obs main output is being scanned agaik.

i believe the scene switcher version is 1.23.1 atm.

thank you for your help!
I think the issue might simply be that the OCR library appends a new line character at the end of the detected text and thus your input pattern does not match the detected text.
You can either add the new line to your input pattern or you can enable regular expression support to allow partial matches.

1702328920195.png


Hi thanks for the reply.

Yes I can share one of the logs. I still have it on clipboard. (Attaching).

I downloaded and installed the latest update released (yesterday)
I started OBS a number of times, OBS just disappeared and one or two times I saw the Advanced Scene Switcher backup message (which I always see after updating Advanced Scene Switcher to the latest version). But could not interact with that message.
The message stayed up front even after OBS had crashed but could not be interacted with.

Advanced Scene Switcher was the only thing I had changed since my last OBS session so I figured this may be the issue.

I dragged the plugin files away and OBS started fine.
Put them back and OBS started fine but as you say, settings all gone.

Restored settings from backup. All OK now.

I did also have a little trouble restoring from backup. Some settings were not restored. I had to remove all Advanced Scene Switcher settings again and then restore.

While I am here, you mention that opening OBS without the plugin, it is expected that the settings are gone. is there anything that can be done about this? And where are those settings stored? (Yes, we can Export backup but it would be good to be able to actually backup the entire settings just in case).

Cheers,
Thanks for sharing the crash log!
It seems to somehow be related to the OBS websocket library attempting to display a system tray notification.
That will help me figure out what went wrong.
 
I think the issue might simply be that the OCR library appends a new line character at the end of the detected text and thus your input pattern does not match the detected text.
You can either add the new line to your input pattern or you can enable regular expression support to allow partial matches.

View attachment 100019
You, Sir, are a god. I did not even see the buttons on the right there, because the window opens in a smaller size or else i would have been able to help myself - probably. Well done and many thanks!
 
Top