SceneSwitcher
SceneSwitcher copied to clipboard
Message buffer
FYI @Destroy666x, I reworked the websocket and Twitch event sub message handling in this PR. It was done to ensure that each condition has the chance to look at each message.
Didn't do much testing yet but it should work :)
I see, I'll check whenever I'll find time. BTW, too bad https://github.com/WarmUpTill/SceneSwitcher/pull/827 isn't merged yet, as the recent huge changes were like impossible for me to get going with what I had as a branch from that PR due to lots of CMake changes -> conflicts :( So can't quite build locally anymore.
I see, I'll check whenever I'll find time.
Cheers! :)
BTW, too bad #827 isn't merged yet, as the recent huge changes were like impossible for me to get going with what I had as a branch from that PR due to lots of CMake changes -> conflicts :( So can't quite build locally anymore.
Ah damn - sorry about that :( Let me know if there is any way I can help in resolving the conflicts!
Maybe I will find the time to switch to the new plugin template version on the weekend since I put that off for so long already. I never go feedback if that template version is supported on the debian build system - so I will just assume it does.
I don't think this works, unfortunately. Messages sent (1st and last entry):
Processed and relayed - only the 1st again:
Setup:
Also tested with appending to file in case it'd be some Twitch issue - same thing though.
Found the problem I think: The message buffer was not initialized for new conditions.
Should be fixed now. Let me know, if you want to have another look. Otherwise I will merge as I couldn't find any issues in my tests.
Sure, I'll check tonight.
I think the problem occured on old condition as well, when I tested earlier in a different session. But I'll make sure.
Hmm, still the same thing for me. And on top of that few first messages seemed to be ignored (not in this log but in previous session).
Here's the current log, maybe it'll help debugging: https://obsproject.com/logs/5IBo50wRlf8TF3pz
Missed message:
End of standard game: full movement, no time limit, A Community World map (https://geoguessr.com/maps/62a44b22040f04bd36e8a914). Result: 13613 points in 02:29. 23:44:05.208
Receiving it is in logs, displaying systray message not, unlike for others.
Let me know if you need more info.
Hm .. I would have expected to this this version:
19:06:14.008: [adv-ss] version: 1.24.2-112-g42fc21f 19:06:14.008: [adv-ss] version: 42fc21f648da27a3459b18b3362635c1a93c699e
But your log shows:
23:39:52.947: [adv-ss] version: 1.24.2-115-g96db560 23:39:52.947: [adv-ss] version: 96db5607f1d88fe1fa4519fee087baa611d52be4
Are you sure you have shared the correct log file?
Yea. That's just my develop branch now where I test various things. To not lose setups I have. I'll test directly on another scene collection if you want, but pretty sure it'll have the same results.
BTW, looking at the log, it looks like the condition is true as well? But then I have no clue what fails. I'll also retest with appending to file. EDIT: ok, no, that still changes nothing.
EDIT: just a build from this PR artifacts directly doesn't work for me either. As for that specific (merge) commit, it's not in this PR, so maybe this is the issue.
Here's minimal reproducible example on last 3dc0487
commit here. Settings more or less as on screen above:
adv-ss-Test-2024.02.20.22.23.33.txt
Log: https://obsproject.com/logs/NNMLsVILCq6dOrIQ
Again:
End of standard game: full movement, no time limit, A Community World map (https://geoguessr.com/maps/62a44b22040f04bd36e8a914). Result: 12638 points in 05:46.
is missing from the file, 2nd message in quick succession.
I don't know if you need the sending part, but you'll need a GeoGuessr account, Tampermonkey and ngrok to get it to work. If so let me know and I'll PM you the script. This is e.g. how messages are sent:
async function sendOBSMessage(message) {
try {
console.log(message);
await obs.call('CallVendorRequest', {
requestType: 'AdvancedSceneSwitcherMessage',
vendorName: 'AdvancedSceneSwitcher',
requestData: { message: message }
});
} catch (error) {
console.error(`Failed to send AdvancedSceneSwitcherMessage: ${error.message || error.code}`);
}
}
Can you test if unchecking "Perform actions only on condition change" resolves the issue you are facing? :) It seems to work just fine on my end as soon as I disable that option.
This also seems to be the issue in your log - see skip actions for Macro Macro 1 (on change)
:
22:18:57.340: [adv-ss] received message: Plonked Mexico, San Luis Potosí, Rioverde (https://spoo.me/hHPjtt) in 00:37. Result: 106 points, 7147.49km away. Correct loc: Argentina, Mendoza, Distrito La Llave (https://google.com/maps/@?api=1&map_action=pano&viewpoint=-34.601773646190615%2C-68.02403002467157&heading=159.06455993652344&pitch=0.7400000095367432&fov=90)
22:18:57.643: [adv-ss] received message: End of standard game: full movement, no time limit, A Community World map (https://geoguessr.com/maps/62a44b22040f04bd36e8a914). Result: 12638 points in 05:46.
22:18:57.750: [adv-ss] condition websocket returned 1
22:18:57.750: [adv-ss] Macro Macro 1 returned 1
22:18:57.750: [adv-ss] running macro: Macro 1
22:18:57.751: [adv-ss] try to sleep for 500
22:18:57.751: [adv-ss] running actions of Macro 1
22:18:57.751: [adv-ss] performed action variable
22:18:57.751: [adv-ss] performed action "AdvSceneSwitcher.action.file.type.append" for file "C:/Users/User/Desktop/out.txt"
22:18:58.251: [adv-ss] condition websocket returned 1
22:18:58.251: [adv-ss] Macro Macro 1 returned 1
22:18:58.251: [adv-ss] skip actions for Macro Macro 1 (on change)
22:18:58.251: [adv-ss] try to sleep for 500
Oh, so that's what happened and why the condition was shown as true in logs. I forgot this option existed in the 1st place as I always leave it ticked. So I assume it means exactly "if on next tick the condition is the same, process condition (a.k.a. remove the message here) and skip actions"?
A bit confusing in comparison to other conditions but works, thanks. EDIT: still doesn't work with Twitch, but that's another issue. Not rate limiting according to their docs (?) but don't know what else it could be. Ah yeah it is from what I see "Twitch chat notice: Your message was not sent because you are sending messages too quickly." The workaround is just to mod the bot in case someone asks in the future.