如何设置由鼠标位置触发的按键?

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

我一直在玩一个游戏,这个游戏只使用LeftArrowA(向左走)、RightArrowD(向右走)和shift(冲刺)。 " as the edges: 为了说明这一点,请将以下变量(括号内)想象成我屏幕上的不同点,以及 "A(向左走)、RightArrowD(向右走)和shift(冲刺)"。我正在努力制作一个宏,将按左或右取决于 ...

使用函数,你总是有一个更好的概述,控制和性能。

CoordMode, Mouse, Screen
SetTimer, Check, 20
return

Check:
;The following variables are the x-coordinates of my screen, which has a res of 3840x2160
a := 965
b := 1700
c := 2160
d := 2895
MouseGetPos, x, y
return
MouseLoop:
while (x < b || x > c) {
    MouseGetPos, x, y
    if (x > c) {
        if (x > d) {
            Send +d
            MouseGetPos, x, y
            goto, MouseLoop
        }
        else if (x <= d) {
            Send d
            MouseGetPos, x, y
            goto, MouseLoop
        }
        MouseGetPos, x, y
    }

    if (x < b) {
        if (x < a) {
            Send +a
            MouseGetPos, x, y
            goto, MouseLoop
        }
        else if (x >= a){
            Send a
            MouseGetPos, x, y
            goto, MouseLoop
        }
        MouseGetPos, x, y
    }
    if GetKeyState("Esc") {
        goto, Finished
    }
}
return
goto, MouseLoop

Finished:
Exit
autohotkey
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.