I encountered a problem with mouse_event. Need HELP

Ask gaming related questions (AHK v1.1 and older)
Magija
Posts: 21
Joined: 21 Aug 2021, 06:29

I encountered a problem with mouse_event. Need HELP

Post by Magija » 22 Jan 2022, 08:30

Hi, I have a problem.

First: the code does not complete its action stops at the "08" line

second: does not go out to generate the function "mouse_event".
(how to generate "Mouse_Event" for this to work like this:

when "{D down}" "Mouse_Event is turned to the right" (08 line)("mouse_event", "UInt", 0x01, "UInt", 80 * sens, "UInt", 0 * sens) "when" {D up} "" mouse_event "stops


when "{s down}" and {a down} "Mouse_Event" are turned to the left "(" mouse_event "," UInt ", 0x01," UInt ", -80 * sens," UInt ", 0 * sens)" when "{a up}" "mouse_event" stops and returns to the center of the screen)

Code: Select all

;Sensitivity
sens:=5/sens

XButton2 & LShift::
Action:
on := True
While GetKeyState("XButton2", "P") & GetKeyState("LShift", "P") {
DllCall("mouse_event", "UInt", 0x01, "UInt", 80*sens, "UInt", 0*sens)
sleep 99
{
DllCall("mouse_event", uint, 4, int, 0, int, 0, uint, 0, int, 0)
break
}
 Send {d down}
 Sleep, 1050 * on
 Send {d up}
DllCall("mouse_event", "UInt", 0x01, "UInt", 0*sens, "UInt", 0*sens)
sleep 99
{
DllCall("mouse_event", uint, 4, int, 0, int, 0, uint, 0, int, 0)
break
}
 If !on || !GetKeyState("XButton2", "P")
  Break
 Sleep, 40
 Click, R D
sleep, 100
 Sleep, 100 * on
 Click, R U
 If !on || !GetKeyState("XButton2", "P")
  Break
 Sleep, 190
DllCall("mouse_event", "UInt", 0x01, "UInt", -80*sens, "UInt", 0*sens)
sleep 99
{
DllCall("mouse_event", uint, 4, int, 0, int, 0, uint, 0, int, 0)
break
}
 Send {s down}
 Sleep, 1 * on
 Send {s up}
 If !on || !GetKeyState("XButton2", "P")
  Break
 Send {a down}
 Sleep, 1050 * on
 Send {a up}
DllCall("mouse_event", "UInt", 0x01, "UInt", 0*sens, "UInt", 0*sens)
sleep 99
{
DllCall("mouse_event", uint, 4, int, 0, int, 0, uint, 0, int, 0)
break
}
 If !on || !GetKeyState("XButton2", "P")
  Break
 Sleep, 40
 Click, R D
sleep, 100
 Sleep, 100 * on
 Click, R U
 Sleep, 190 * on
}
#If on
LShift Up::
XButton2 Up::on := False
#If

User avatar
mikeyww
Posts: 26599
Joined: 09 Sep 2014, 18:38

Re: I encountered a problem with mouse_event. Need HELP

Post by mikeyww » 22 Jan 2022, 15:12

Break it down into steps. Start with the first issue. How do you know that line 9 never executed? My test is below.

Code: Select all

sens := 5 / sens

MsgBox sens=%sens%

XButton1 & LShift::
While GetKeyState("XButton1", "P") & GetKeyState("LShift", "P") {
 DllCall("mouse_event", "UInt", 0x01, "UInt", 80 * sens, "UInt", 0)
 MsgBox This line was reached.
}
MsgBox, Done!
Return

Post Reply

Return to “Gaming Help (v1)”