This commit is contained in:
parent
d8cb7dffaa
commit
5bd7ff14e2
2 changed files with 6 additions and 3 deletions
|
@ -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
|
local idle_time = 120 -- Wait for any input in the last 2 minutes
|
||||||
|
|
||||||
function script_description()
|
function script_description()
|
||||||
return "Automatically restarts the replay buffer when IDLE"
|
return [[
|
||||||
|
Automatically restarts the replay buffer when IDLE
|
||||||
|
Author: Mylloon
|
||||||
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
function script_load()
|
function script_load()
|
||||||
|
@ -33,7 +36,7 @@ function check_idle()
|
||||||
local current_time = os.time()
|
local current_time = os.time()
|
||||||
local last_input_time = monitor.last_time_input_received()
|
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()
|
monitor.stop_hook()
|
||||||
obs.timer_remove(check_idle)
|
obs.timer_remove(check_idle)
|
||||||
restart_replay_buffer()
|
restart_replay_buffer()
|
||||||
|
|
|
@ -7,7 +7,7 @@ HHOOK hKeyboardHook;
|
||||||
|
|
||||||
LRESULT CALLBACK KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam) {
|
LRESULT CALLBACK KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam) {
|
||||||
if (nCode == HC_ACTION) {
|
if (nCode == HC_ACTION) {
|
||||||
last_input_time = GetTickCount();
|
last_input_time = time(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return CallNextHookEx(hKeyboardHook, nCode, wParam, lParam);
|
return CallNextHookEx(hKeyboardHook, nCode, wParam, lParam);
|
||||||
|
|
Loading…
Reference in a new issue