0

由于Egor总是提供帮助,这是为了向他展示问题,但是如果您知道如何解决,请也提供帮助!

https://youtu.be/J2vRfnUplio <<< 这就是脚本的工作方式。(查看描述以获取更多信息)

https://youtu.be/HH_MmfXUdl8 <<< 这就是它现在的做法,在 Windows 较新版本中。

在 LUA 上的 MouseMoveRelative 上的 Sleep() 函数有问题

^^这是显示问题的最后一个问题,你在那里帮助了我

GHUB 在两者上都有相同的版本,所以不是 GHUB 的问题。

Sleep(1) 不会表现得像它应该的那样,我最好的猜测是 windows 改变了一些东西,但问题是什么。

有人帮忙吗?

4

1 回答 1

1

在脚本开头的OnEvent()函数之前插入以下代码块

do
   local function busyloop(final_ctr)
      final_ctr = final_ctr - final_ctr%1
      local ctr, prev_ms, ms0, ctr0 = 0
      while ctr ~= final_ctr do
         local ms = GetRunningTime()
         if prev_ms and ms ~= prev_ms then
            if not ms0 then
               ms0, ctr0 = ms, ctr
            elseif final_ctr < 0 and ms - ms0 > 500 then
               return (ctr - ctr0) / (ms - ms0)
            end
         end
         prev_ms = ms
         ctr = ctr + 1
      end
   end
   local coefficient = busyloop(-1)
   function FastSleep(ms)
      return busyloop(ms * coefficient)
   end
end

之后,您可以FastSleep(delay)在脚本中使用小时间间隔的函数。

例子:

FastSleep(0.5)  -- wait for 0.5 ms

对于较大的时间间隔(例如,30 ms 或更长)Sleep(),首选标准。

于 2020-12-18T17:54:54.067 回答