From 4dd5fd95fe787c3fc764d3db9861cf3e84659cd1 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Wed, 9 Oct 2024 12:31:11 +0200 Subject: [PATCH] Add prints --- AutoOBSRBRestart.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/AutoOBSRBRestart.lua b/AutoOBSRBRestart.lua index fdd2ec2..7d9d30d 100644 --- a/AutoOBSRBRestart.lua +++ b/AutoOBSRBRestart.lua @@ -18,8 +18,7 @@ function script_load() long long last_input_received(void); ]] monitor = ffi.load(script_path() .. "monitor.dll") - - obs.timer_add(check_restart, wait_time * 1000) + start_loop() end function script_unload() @@ -28,9 +27,17 @@ function script_unload() monitor.stop_hook() end +function start_loop() + print("Start idle") + obs.timer_add(check_restart, wait_time * 1000) +end + function check_restart() obs.timer_remove(check_restart) + + print("Start check every " .. idle_time .. "secs") + monitor.start_hook() obs.timer_add(check_idle, idle_time * 1000) end @@ -43,6 +50,7 @@ function check_idle() if current_time - last_input_time >= idle_time then monitor.stop_hook() + print("No activity detected, restart replay buffer") obs.obs_frontend_replay_buffer_stop() obs.timer_add(start_replay_buffer, 2000) else @@ -54,5 +62,5 @@ function start_replay_buffer() obs.timer_remove(start_replay_buffer) obs.obs_frontend_replay_buffer_start() - obs.timer_add(check_restart, wait_time * 1000) + start_loop() end