Need help with keyboard-mouse commands

Ask gaming related questions
akisa91
Posts: 6
Joined: 09 Jan 2024, 08:24

Need help with keyboard-mouse commands

09 Jan 2024, 08:35

Hi everyone, I need help regarding mouse clicks. So I play this racing game that gives me terrible delay in commands when Im playing on default keyboard controls in windows 10, BUT, when I set on-screen controls and click them with the mouse, the action is instant. SO I was wondering if it's possible to make a script which will do mouse clicks on certain screen positions when I press certain keyboard keys.

To be more precise, I don't need only mouse clicks, but also for the script to recognize if I pressed the keyboard key UP or DOWN. For example what I need is when I press Left arrow key DOWN, I need it to do left click DOWN on position say 500,500 (x,y), and when I release Left arrow key (press Left arrow key UP) I need it to release instantly or press left mouse click UP on the same position.

I was searching a lot for this online and really couldn't find exactly what I'm looking for. There are some scripts that I found which basically move mouse to the position and just click and that's it. I would also need this to be instant without any delay and moving mouse or anything like that. If delay occurs then that would be useless I guess.

Thanks for reading.
User avatar
RaptorX
Posts: 390
Joined: 06 Dec 2014, 14:27
Contact:

Re: Need help with keyboard-mouse commands

09 Jan 2024, 13:22

A simple remapping could work, but if it is a game there might be few things that would prevent the script from working.
Try this:

Code: Select all

CoordMode 'Mouse', 'Screen'

Left::Click 500, 500
Right::Click 10,10
You can be more precise with releasing the click like this:

Code: Select all

CoordMode 'Mouse', 'Screen'

; these two hold the click down
Left::Click 500, 500, 'D'
Right::Click 10,10, 'D'

; these two perform the same action (release the mouse button)
Left Up::
Right Up::Click 'U'
Projects:
AHK-ToolKit
akisa91
Posts: 6
Joined: 09 Jan 2024, 08:24

Re: Need help with keyboard-mouse commands

10 Jan 2024, 08:21

Thanks for your help. I am total noob at this so I would probably never get to that :)

It DOES work, but not as fast as i hoped it would. I've added two more commands (gas and brake) and clicks are almost instant, but there is a lag and sometimes clicks bug and it doesn't even register that i pressed key. It's probably something related to how the game was made. I guess this one has to be played with a tablet/phone and touch screen.

Cheers
User avatar
RaptorX
Posts: 390
Joined: 06 Dec 2014, 14:27
Contact:

Re: Need help with keyboard-mouse commands

10 Jan 2024, 10:31

akisa91 wrote:
10 Jan 2024, 08:21
Thanks for your help. I am total noob at this so I would probably never get to that :)

It DOES work, but not as fast as i hoped it would. I've added two more commands (gas and brake) and clicks are almost instant, but there is a lag and sometimes clicks bug and it doesn't even register that i pressed key. It's probably something related to how the game was made. I guess this one has to be played with a tablet/phone and touch screen.

Cheers
Yes, that is what i meant by this:
but if it is a game there might be few things that would prevent the script from working
Game automation is really tricky.
Projects:
AHK-ToolKit
akisa91
Posts: 6
Joined: 09 Jan 2024, 08:24

Re: Need help with keyboard-mouse commands

11 Jan 2024, 01:34

RaptorX wrote:
10 Jan 2024, 10:31
akisa91 wrote:
10 Jan 2024, 08:21
Thanks for your help. I am total noob at this so I would probably never get to that :)

It DOES work, but not as fast as i hoped it would. I've added two more commands (gas and brake) and clicks are almost instant, but there is a lag and sometimes clicks bug and it doesn't even register that i pressed key. It's probably something related to how the game was made. I guess this one has to be played with a tablet/phone and touch screen.

Cheers
Yes, that is what i meant by this:
but if it is a game there might be few things that would prevent the script from working
Game automation is really tricky.
Can you maybe help me with one more thing. Sorry if I'm being bothersome. I just realised there is one more type of command in this game with steering wheel on the screen. It works awesome with mouse and the reaction time is instant. I was wonder if this could be made to work on keyboard.

So for steering wheel to work I'd need mouse to constantly hold left click down, and when I press left arrow key it should move from position A to position B (whole time left mouse button down). When I let go left button it just comes back to A (still left button down). When I press right arrow key, mouse should go to C, and when I release it it just goes back to position A (again whole time left key down).

Now here's the tricky part, I'm not sure if this is possible at all. Gas and brake are two more buttons and I'd need them independent from steering. So for example if I hold left arrow key (steering to the left) + I press brake or gas to get into curve, I'd need mouse not to let go that left button down on position B (to hold the steering correctly) and simultaneously just click on gas or brake on certain positions on the screen (D and F). So basically for this one I'd need two separate mouse cursors operating differently.

If this would be something possible I think it would work great.

Thanks for your help
akisa91
Posts: 6
Joined: 09 Jan 2024, 08:24

Re: Need help with keyboard-mouse commands

11 Jan 2024, 02:03

If the above is too complicated, I've just remembered of one more option which. I'm not sure but I might be able to steer that wheel by moving the mouse itself. In that case I'd just need the script to hold left mouse button down all the time so I don't have to do it + two mouse clicks via two keyboard keys on positions A and B. So still would need two separate mouse cursors to operate...

Return to “Gaming”

Who is online

Users browsing this forum: Draken and 4 guests