Simple "no recoil" help, almost got it!

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Rythmicone
Posts: 7
Joined: 01 Jul 2016, 16:14

Simple "no recoil" help, almost got it!

09 Nov 2020, 22:48

Hi! I have this simple no recoil script that works fine, but I need one slight modification but cannot figure it out. I simple want the recoil function (triggered by the mouse event line) to be delayed about 100ms before it starts pulling the mouse down. That is, press mouse button, delay 100ms, then start the DllCall to move the mouse down. I am just a beginner, can't seem to get it! Anything is greatly appreciated! Here is what I have :

Code: Select all

F12:: Hotkey, *~$LButton, Toggle

End::
ExitApp

*~$LButton::
    while GetKeyState("LButton")
    {
		DllCall("mouse_event", uint, 1, int, 0, int, 6)
		Sleep 22
    }
Return
User avatar
mikeyww
Posts: 27099
Joined: 09 Sep 2014, 18:38

Re: Simple "no recoil" help, almost got it!

10 Nov 2020, 10:25

You can add Sleep, 100. If you want it just once, put it before While; otherwise, after.

If you want it after While but just once, you can set a flag to indicate that the sleep happened (after it happens), so that you don't repeat it until the next button press.

Code: Select all

*~$LButton::
starting := True
While GetKeyState("LButton") {
 If starting
  Sleep, 100
 DllCall("mouse_event", uint, 1, int, 0, int, 6)
 Sleep, 22
 starting := False
}
Return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 155 guests