Resource icon

Scene automation script 2020-09-13

This is a Lua script that turns on / off banners and also moves and / or activates cameras for various scenes. Each scene is a part of our church worship service. I wrote this to simplify operation of OBS during the service but I imagine that it could be used as a template for automating any stream that consists of a fairly constant set of scenes each time.
I would love to get feedback on improvements. This is my first Lua script and I appreciate all the examples that are out there. I used them a lot for code snippets.

We use PTZOptics cameras which can be moved to a Preset via a URL source. I can provide the scene.json file if anyone is interested.

Some questions / comments:
1) Lua doesn't have a built-in "wait" or "sleep" function, so I had to create callbacks to myself and keep a counter going in order to create a delay between scene activities. The counter tells me which callback iteration I'm at in order to step through the automation tasks. This seems kludgy to me, but it works.

2) I don't use any hotkeys in our streaming, but I notice that lots of scripts include hotkey function calls. Should I include those as well?

3) After our stream is over (about an hour long service) I notice that I have 65-90 "detached callbacks".
Here is a log sample:
[Scripting] Total detached callbacks: 88
OBS has never crashed but still wonder if I should find these detached callbacks and remedy them.

4) I also get about 10-12 memory leaks after a session. I'm pretty sure I'm releasing things that I'm supposed to release so this may be just OBS in general.

Again, any feedback is appreciated.
First release
Last update
0.00 star(s) 0 ratings