我不知道如何使鼠标每秒以不同的速率向下拉。
我尝试添加不同的睡眠值,这会改变我的鼠标在整个脚本中向下拉的力度,但它不起作用,它只会以一个设定的速率下拉。
function OnEvent(event, arg)
if IsKeyLockOn("scrolllock" )then
if IsMouseButtonPressed(1) then
repeat
MoveMouseRelative(0,1)
Sleep(8)
MoveMouseRelative(0,1)
Sleep(7)
until not IsMouseButtonPressed(1)
end
end
end
我原以为鼠标会以一个速率向下拉,然后在一秒钟后更用力地向下拉,但结果只是一个固定速率。
Windows 计时器滴答声为 15-16 毫秒。
这意味着Sleep(1)
、Sleep(2)
、...、Sleep(15)
几乎相同。
您应该改变移动鼠标的像素量。
local time0 = GetRunningTime()
repeat
local dtime = GetRunningTime() - time0
local dy
if dtime < 1000 then
-- during the first second we move mouse slowly: 1 pixel per tick
dy = 1
else
-- after the first second we move mouse faster: 2 pixels per tick
dy = 2
end
MoveMouseRelative(0,dy)
Sleep(1)
until not IsMouseButtonPressed(1)