Advanced Scene Switcher

Advanced Scene Switcher 1.29.3

Warmuptill

Active Member
I can't seem to set the variable to be the text source, which the text source itself is referencing its own file source (not static text, but the text inside the .txt file).
If you are trying to set the value of a variable to be the file path referenced by a text source, you can use a macro like this:
1745079530241.png


If you are then trying to read the contents of that text file and assign it to another macro you can use this setup:
1745079777351.png


I hope I understood your question correctly - I apologise if I did not!

The other thing is, i'm not sure how to ask the macro to skip itself until a new line is created... here is the use case.

The kill feed shows who has died, and stays on that line position for 5-7 seconds then disappears - however, it could get bumped if another player dies within that same window, screenshot below.

https://imgur.com/a/4mETJXW Video example: https://streamable.com/z0yfqt
(you can see deaths go from 8 to 9, because I pattern matched the "continue button"), so I can track my own K/D ratio but trying to track my teammates via the kill feed.

Line 1 on the screen initially is "BoT slain by Baba"
then quickly after another person dies and Line 1 now becomes Line 2, Line 1 is now "cT was slain by Kaal", etc.

So it's like I need the script to not read Line 1 and spam the hotkey counting kills every 1 second, but also be smart enough to read a different line is created.
Not sure if it will work:
Maybe you can limit the area to be check to be only the lowest line like this:

1745080582408.png


Then you are sure that only the most recent death log is being checked and the lines which are pushed up are being ignored.
However with that approach you would have to set up a separate macro for each of the players.

1745081039076.png


The "Within the last X seconds" option in combination with "Perform actions only on condition change" at the top ensures that the increment happens at most every X seconds.
So you will have to tweak that value to your liking.

You can import the example macros shown in this post using this code:
Code:
AAApA3ic7Vrvb9s2E/5XBGIf2s1y9Mt2km+pm3QGmiyr0/bDUhSURElcJFIgqTR5A//v75GSbElxknbL1g2z0aASeXc83j28e+jkDhU4Elyiw9/uEMMFQYfo+AYXZU7QCKWCVyU6THAuyQiVuJJkia/JK5Lha8oFOnSa0Y6MwHlO8vUAZ/MMs3QjIa9oeXxDol/YUmGhNuOKl0eRopzJRXLG1WvONkp64YwLNaciqqg6vsZ5hbVsV2JegY1izllM9dQ8I9HVgikiQHotFz0qdIe0ZdJ5cMbeweAzQuq21FMrWJZRZcJwTYQ0/rgwGvPoakmUoiyV2pYgKZWwxtqLDM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nWB91BXvK9SURKaHW2+rqFjPCrvjjzvvjyf5f7PwcABlTzORTrr8ROMOF9UYTkW0p6rjtAu3+Q24XpOBUPG/IzzOa57SUI+s1houTdQSWwFTHv/rx0yVboc53P9u+Tu4eGOfegelqD7r3U4prLgKVoiLNuV4fe+QCrxz79sxOQ3wwc6Jwhlb/ByrktAA=
You will of course have to re-adjust the source selections etc.

Hope that helps!
 

ArdSagart

New Member
Hi! Could you please advise what should I use as a ${VarName} in the macro to create a welcome message for the latest follower? I can't retrieve the correct value.
 

StadiumPK

New Member
If you are trying to set the value of a variable to be the file path referenced by a text source, you can use a macro like this:
View attachment 112949

If you are then trying to read the contents of that text file and assign it to another macro you can use this setup:
View attachment 112950

I hope I understood your question correctly - I apologise if I did not!


Not sure if it will work:
Maybe you can limit the area to be check to be only the lowest line like this:

View attachment 112951

Then you are sure that only the most recent death log is being checked and the lines which are pushed up are being ignored.
However with that approach you would have to set up a separate macro for each of the players.

View attachment 112952

The "Within the last X seconds" option in combination with "Perform actions only on condition change" at the top ensures that the increment happens at most every X seconds.
So you will have to tweak that value to your liking.

You can import the example macros shown in this post using this code:
Code:
AAApA3ic7Vrvb9s2E/5XBGIf2s1y9Mt2km+pm3QGmiyr0/bDUhSURElcJFIgqTR5A//v75GSbElxknbL1g2z0aASeXc83j28e+jkDhU4Elyiw9/uEMMFQYfo+AYXZU7QCKWCVyU6THAuyQiVuJJkia/JK5Lha8oFOnSa0Y6MwHlO8vUAZ/MMs3QjIa9oeXxDol/YUmGhNuOKl0eRopzJRXLG1WvONkp64YwLNaciqqg6vsZ5hbVsV2JegY1izllM9dQ8I9HVgikiQHotFz0qdIe0ZdJ5cMbeweAzQuq21FMrWJZRZcJwTYQ0/rgwGvPoakmUoiyV2pYgKZWwxtqLDMt3FXtVKaVVlKjqsXMdy3ujECdVybc47IQ1o2mWw49aJOu9yAtRbUImWvsX5AZcRLAearLVGzdrIr2T+3Pv6zGYjXqL1B41Qpv1LSyIpd0e9zROtEOPqRiPtY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u+Tu4eGOfegelqD7r3U4prLgKVoiLNuV4fe+QCrxz79sxOQ3wwc6Jwhlb/ByrktAA=
You will of course have to re-adjust the source selections etc.

Hope that helps!

Ok so it works, except when I changed the value within the text, it doesn't actually update the variable - but if I update anything in the variable command, it does update.

I think the "value changed" is not looking at the text file modification date, or something. Basically if I manually update everything, the variable changes, but I do it via my other bot to adjust the text file value, the variable does not update.

I am going to use this for a different function I believe, more controllable - but amazing help regardless - thank you.
 

Warmuptill

Active Member
Hi! Could you please advise what should I use as a ${VarName} in the macro to create a welcome message for the latest follower? I can't retrieve the correct value.
You can find an example how to set this up here in the wiki:
 

Tallicia

Member
A build with additional options to modify JSON values contained in variables is available here on GitHub:
Note that you will have to be logged in to be able to download it.
If that should be a problem I upload it somewhere else.

For example, let's assume My Variable has the following value:
JSON:
{
    "books":
    [
        {
            "category": "fiction",
            "title" : "A Wild Sheep Chase",
            "author" : "Haruki Murakami",
            "price" : 22.72
        },
        {
            "category": "fiction",
            "title" : "The Night Watch",
            "author" : "Sergei Lukyanenko",
            "price" : 23.58
        },
        {
            "category": "fiction",
            "title" : "The Comedians",
            "author" : "Graham Greene",
            "price" : 21.99
        },
        {
            "category": "memoir",
            "title" : "The Night Watch",
            "author" : "Phillips, David Atlee"
        }
    ]
}

This set of actions actions ...

View attachment 112888

... will then reduce the value to The Night Watch.

Let me know if everything works as expected / if you have feedback.
Thank you so much for this! in my case, it's not quite working.

When I put in a hardcoded "lookup" value I get back the value wrapped in [" and "] - Maybe an option to "strip"/pare down to the value, as it appears it is still in a json form.

1745119529824.png


1745119503882.png


And slightly more important to be usable, the variable is not being used for the value in the query, it's just resulting in an empty set json of []

1745119626409.png

It looks like the
$['${CardId}'] .ShortName
is not being parsed and the variable converted to the Id


======
And for context, I can't use the array index as the entries are not guaranteed to be in order or sequential. there are gaps in the Ids.

1745119794042.png


Hopefully that is sufficiently clear. let me know if further explanation is needed.
 

Warmuptill

Active Member
When I put in a hardcoded "lookup" value I get back the value wrapped in [" and "] - Maybe an option to "strip"/pare down to the value, as it appears it is still in a json form.
A JSONPath query will always return a JSON array, as the query can return multiple results.
I also stumbled over that, which is why I decided to include the option to access JSON array elements.

1745145142309.png


I thought about automatically stripping the array in case only one / no result is found, but decided against it, as deviating from default JSONPath behavior might cause incompatibilities in the future / surprise other potential users of this functionality.

And slightly more important to be usable, the variable is not being used for the value in the query, it's just resulting in an empty set json of []

1745119626409.png

It looks like the
$['${CardId}'] .ShortName
is not being parsed and the variable converted to the Id
I just gave it a try, but unfortunately I am not able to reproduce the problem and the variable values used in the query are resolved as expected.
Maybe "CardId" was not set to the expected value?
This would result in the behavior you described, as the query would return an empty array if the given Id was not found.
Example.gif


Or did I misunderstand the problem?

And thank you a lot for your feedback!
 

PNO

New Member
Hello,

I have a use case I'm attempting to solve for with the use of variables for enabling, pausing, and unpausing of macro actions.

Currently I have 5 OBS scenes. Each scene has 3 respective macros to enable, pause, and un-pause pixel matching. That's 15 macros all performing the same functions just named differently based on the scene name.
Example:
1) Scene1-Pixel-Matching (Video macro matching pattern of png file)
2) Scene1-Pixel-Match ( Macro responsible for taking action if matching pattern)
3) Scene1-Pixel-No-Match ( Macro responsible for taking action if NO pattern match)
(Pixel-Matching, Match, and No-Match macros were once combined into single macro using if/else action, but for other reasons, separated into 3).

Ultimately, I'd like to reduce 15 macros down to 3 total macros to dynamical enable, pause, un-pause these macros.

My initial approach was to create variables with concatenated values to include the "Scene Name" with "-Pixel-Match" or Pixel-No-Match" to produce "Scene1-Pixel-Matching" and so on. I was able to create the desired variables and values but...

It does not appear as though I can pass a variable to pause or un-pause a macro. Am I wrong in my approach? Am I wrong that I cannot pass a variable to macro to pause or un-pause? Is there a better approach to accomplish this?

Thank you all for any assistance!
 

Warmuptill

Active Member
It does not appear as though I can pass a variable to pause or un-pause a macro. Am I wrong in my approach? Am I wrong that I cannot pass a variable to macro to pause or un-pause? Is there a better approach to accomplish this?
Just for clarification / to avoid a misunderstanding:
You are asking if variables can be used in macro selection of the Macro "Pause" action, right?
1745267569090.png

If so, then unfortunately that is indeed not possible at the moment.

I will try to look into making that possible, when I find the time to.
So, thanks for the suggestion!

Without really knowing your macro setup in detail, to work around this limitation you could not pause the macros, and instead add a "Variable value equals" check at the top of each relevant macro to make sure its actions are only executed when the variable has a given value:
1745268398540.png


If you are worried about performance, you can also enable "short circuit evaluation" to ensure that the condition evaluation stops when the overall result of the condition set can no longer result in a match:

1745268618357.png


I hope that helps!
 

kanewesley

New Member
Thanks for sharing the crash log!

If I am interpreting the crash log correctly, I don't see any direct involvement of the advanced scene switcher in the crash.
OBS seems to crash when saving the scene collection data.

By default the plugin triggers the saving of the scene collection data when ...
  • closing the advanced scene switcher settings window
  • switching between macros
Does that match your observations?
If it does, do you know what settings you had changed beforehand?
(Maybe some special text characters are triggering the crash)
Thank you for your response. I will continue to monitor these crash issues.

Meanwhile, I've encountered some new problems to report, which are quite critical for me and might even prevent me from continuing to use adv-ss for similar project designs. Here are the details:

In my game livestreams, I need to use OCR functionality to recognize various elements on the game interface, including names, numerical values, timestamps, and other information. These elements contain English, numbers, symbols, and Chinese characters, requiring different Tesseract language models such as **eng**, **chi_sim**, **digits**, and some custom-trained models. Since there are over 50 areas requiring recognition, many macros rely heavily on OCR, leading to severe lag when switching between macros. This lag is extremely frustrating, and I sincerely hope for a resolution.

Now, addressing the core issue: I’ve noticed significant differences in OCR efficiency across models. For example, **digits** works quickly, allowing multiple OCR scans per second, while **chi_sim** is much slower, taking ~10 seconds per scan. However, when using multiple models simultaneously, something strange occurs—the faster models (like **digits**) slow down to match the speed of the slowest model (e.g., **chi_sim**). When the screen is static (i.e., OCR is inactive), the refresh rate returns to normal. But once OCR activates, all models slow to the worst-case speed. Even adding a 1-second loop timer in the macro fails to improve efficiency. Worse, the OCR results often reflect data from 10 seconds prior, making real-time application impossible.

I hope I’ve explained this clearly. Could you please investigate whether this issue exists?

Thank you so much!
If needed, I’d be happy to demonstrate my setup and use case in real time via a suitable method.
 

Tallicia

Member
A JSONPath query will always return a JSON array, as the query can return multiple results.
I also stumbled over that, which is why I decided to include the option to access JSON array elements.

View attachment 112977

I thought about automatically stripping the array in case only one / no result is found, but decided against it, as deviating from default JSONPath behavior might cause incompatibilities in the future / surprise other potential users of this functionality.


I just gave it a try, but unfortunately I am not able to reproduce the problem and the variable values used in the query are resolved as expected.
Maybe "CardId" was not set to the expected value?
This would result in the behavior you described, as the query would return an empty array if the given Id was not found.
View attachment 112978

Or did I misunderstand the problem?

And thank you a lot for your feedback!
Thank you! as too often, it was just a typo. I had CardId, and should just be CarId. So used to pair programing catching these instantly, lol - Now to clean up a lot of the macros.
 
Top