Adding some additional features to my AHK.

Ask gaming related questions (AHK v1.1 and older)
gyrosav
Posts: 81
Joined: 30 Dec 2020, 02:48

Adding some additional features to my AHK.

Post by gyrosav » 22 May 2023, 23:00

I want to add some additional features to my current AHK script below.

I would like Shift+F2 to record my mouse cursor position whenever it is pressed and store it as stored_pos3.

Also, when Alt+s is pressed, I want it to run the following sequence: Shift+F3, F2, move mouse to stored_pos3, left click, f, move mouse cursor 2cm west of stored_pos3, left click, f, move mouse cursor 2cm north of stored_pos3, left click, f, move mouse cursor 2.5cm northwest of stored_pos3, left click, f, F3.

The alt+s sequence should be uninterruptible, very rapid, and not miss any inputs or movements. I understand that AHK does not work with centimeters, but I didn't know anyway else to explain it. If someone could create a script where I can adjust the numbers as necessary, that would be much appreciated! Thank you!

Code: Select all

stored_pos1 := ""
stored_pos2 := ""
toggle := 0

+F4::
    MouseGetPos, xpos, ypos
    stored_pos2 := xpos "," ypos
    return

!a::
    BlockInput, MouseMove
    SetTimer, EnableClickMove, 1000
    toggle := !toggle
    if (toggle = 1) {
        Send, +{F3}
        Send, {F4}
        StringSplit, xy, stored_pos2, `,
        MouseMove, %xy1%, %xy2%, 0
        Send, {LButton}
        Send, {F3}
    } else {
        Send, +{F3}
        Send, {F4}
        StringSplit, xy, stored_pos2, `,
        MouseMove, %xy1%, %xy2%, 0
        Send, {LButton}
        Send, {F3}
    }
    BlockInput, MouseMoveOff
    MouseMove, % A_ScreenWidth/2, % A_ScreenHeight/2, 0
    return

EnableClickMove:
    BlockInput, MouseMoveOff
    return

Return to “Gaming Help (v1)”