diff --git a/AutoOBSRPRestart.lua b/AutoOBSRPRestart.lua index b1927c3..b0e1f33 100644 --- a/AutoOBSRPRestart.lua +++ b/AutoOBSRPRestart.lua @@ -4,7 +4,10 @@ local wait_time = 7200 -- Wait 2 hours before checks local idle_time = 120 -- Wait for any input in the last 2 minutes function script_description() - return "Automatically restarts the replay buffer when IDLE" + return [[ + Automatically restarts the replay buffer when IDLE + Author: Mylloon + ]] end function script_load() @@ -33,7 +36,7 @@ function check_idle() local current_time = os.time() local last_input_time = monitor.last_time_input_received() - if current_time - last_input_time >= wait_time then + if current_time - last_input_time >= idle_time then monitor.stop_hook() obs.timer_remove(check_idle) restart_replay_buffer() diff --git a/monitor.c b/monitor.c index 3366a47..3eb7cdc 100644 --- a/monitor.c +++ b/monitor.c @@ -7,7 +7,7 @@ HHOOK hKeyboardHook; LRESULT CALLBACK KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam) { if (nCode == HC_ACTION) { - last_input_time = GetTickCount(); + last_input_time = time(NULL); } return CallNextHookEx(hKeyboardHook, nCode, wParam, lParam);