问题描述
想知道如何将睡眠计时器添加到我的 LUA 脚本中,这样它就不会尽可能快地循环并按 0x29,我想这样做,当我按下鼠标上的按钮 1 和 3 时,它会命中每 3-4 秒键入 0x29 一次,而不是尽可能快。
SELECT a,b,c,@var1 as d
FROM table
WHERE a = '@var2'
解决方法
您可以通过 GetRunningTime()
local last_time = -math.huge
local is_pressed = {}
function OnEvent(event,arg)
if event == "PROFILE_ACTIVATED" then
EnablePrimaryMouseButtonEvents(true)
elseif event == "MOUSE_BUTTON_RELEASED" and (arg == 1 or arg == 2) then
is_pressed[arg] = false
elseif event == "MOUSE_BUTTON_PRESSED" and (arg == 1 or arg == 2) then
is_pressed[arg] = true
local mb1 = is_pressed[1]
local mb2 = is_pressed[2]
--OutputLogMessage(tostring(mb1) .. " - " .. tostring(mb2))
if mb1 and mb2 and GetRunningTime() - last_time > 5000 then
PressAndReleaseKey(0x29)
last_time = GetRunningTime()
end
end
end