American Truck Simulator mouse movement

Ask gaming related questions (AHK v1.1 and older)
Donald Rack
Posts: 4
Joined: 13 Oct 2020, 19:41

American Truck Simulator mouse movement

Post by Donald Rack » 04 Jul 2022, 19:56

So I'm disabled and I use a numeric keypad with AHK to control the mouse. For example (the keypad is rotated 90 degrees counterclockwise):

Code: Select all

*NumpadRight::MouseMove, 0, -50, 0, R
At first I thought maybe 50 was too sensitive. Press right once and it would jump to the top of the screen. As an experiment I changed it to 1. When I pressed right the cursor moved up slightly and stopped. Any subsequent presses did nothing, as if the cursor had reached the edge of the screen. I'm not quite sure why it does this, no other game does. I would check the options and control settings to try and diagnose the issue but I can't navigate the menu without a mouse. Any ideas?

Rohwedder
Posts: 7551
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: American Truck Simulator mouse movement

Post by Rohwedder » 04 Jul 2022, 23:29

Hallo,
maybe mouse_events work better?:

Code: Select all

*NumpadRight::SendMouse_RelativeMove(0, -50)

SendMouse_RelativeMove(x, y)
{ ; send fast relative mouse moves
    DllCall("mouse_event", "UInt", 0x01, "UInt", x, "UInt", y)
}

Donald Rack
Posts: 4
Joined: 13 Oct 2020, 19:41

Re: American Truck Simulator mouse movement

Post by Donald Rack » 05 Jul 2022, 12:32

That works but adding more than one causes errors. How would you write that with the other 3 keys (left is down, up is left, down is right)?

Rohwedder
Posts: 7551
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: American Truck Simulator mouse movement

Post by Rohwedder » 05 Jul 2022, 23:47

That works but adding more than one causes errors.
What was incomprehensible about the displayed error?:
Line Text: SendMouse_RelativeMove(x, y)
Error: Duplicate function definition.

Try:

Code: Select all

*NumpadRight::SendMouse_RelativeMove(0, -50)
*NumpadDown::SendMouse_RelativeMove(50, 0)
*NumpadLeft::SendMouse_RelativeMove(0, 50)
*NumpadUp::SendMouse_RelativeMove(-50, 0)

SendMouse_RelativeMove(x, y)
{ ; send fast relative mouse moves
    DllCall("mouse_event", "UInt", 0x01, "UInt", x, "UInt", y)
}

Post Reply

Return to “Gaming Help (v1)”