GHUB LUa - 鼠标缓慢移动功能

问题描述 投票:0回答:1

我正在尝试在 LUA (GHUB) 中创建一个本地函数,将鼠标移动到屏幕上的特定坐标。 然而,指针在函数调用结束时突然移动......甚至没有到达正确的位置。 另外..无论如何我可以在GHUB中调试LUA...据我所知几乎是不可能的。甚至没有语法错误。

谢谢!

local function MouseMoveToSlower(x, y, speed)
    current_x, current_y = GetMousePosition()
    distance = math.sqrt((x - current_x)^2 + (y - current_y)^2)
    steps = math.floor(distance / speed)

    for i = 1, steps do
        new_x = current_x + (x - current_x) * i / steps
        new_y = current_y + (y - current_y) * i / steps
        MoveMouseRelative(new_x - current_x, new_y - current_y)
        Sleep(math.random(102,125))
    end
end
lua mousemove
1个回答
0
投票

MoveMouseRelative
期望距离以
1 pixel
为单位(屏幕宽度 = 1920 单位)
GetMousePosition
返回以
(screen_size)/64K
为单位的距离(屏幕宽度 = 65536 单位)
您应该正确转换值。

© www.soinside.com 2019 - 2024. All rights reserved.