Hack Forums
[Python] Simulate a Mouse Click on a Video Game - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Python] Simulate a Mouse Click on a Video Game (/showthread.php?tid=6218446)



Simulate a Mouse Click on a Video Game - SurHomme - Aug 23, 2022

Hi, I am trying to code a Bot on a video game. The thing is they have a "decent" anti cheat that block mouse click. Tho, keyboard key button work fine. Only mouse click doesn't work

I made a lot of research on stackoverflow and reddit and found nothing that work.

I have tried: Pyautogui, Pydirectinput, Autoit


Anyone have tips?


RE: Simulate a Mouse Click on a Video Game - Blazin - Aug 23, 2022

(Aug 23, 2022 05:20 PM)SurHomme Wrote:  Hi, I am trying to code a Bot on a video game. The thing is they have a "decent" anti cheat that block mouse click. Tho, keyboard key button work fine. Only mouse click doesn't work

I made a lot of research on stackoverflow and reddit and found nothing that work.

I have tried: Pyautogui, Pydirectinput, Autoit


Anyone have tips?

You could try using keyboard/mouse built in macro software.


RE: Simulate a Mouse Click on a Video Game - SurHomme - Aug 23, 2022

(Aug 23, 2022 05:23 PM)Blazin Wrote:  You could try using keyboard/mouse built in macro software.

I will look into that. Thank you.


RE: Simulate a Mouse Click on a Video Game - Perlo - Aug 24, 2022

(Aug 23, 2022 05:28 PM)SurHomme Wrote:  I will look into that. Thank you.

Look into AutoHotkey. Scripts are really easy to write and they work inside games as well.


RE: Simulate a Mouse Click on a Video Game - еlixir - Sep 10, 2022

You have to use the windows API, sendinput, SetCursorPosition, or mouseevents.

Code
def mouse_move_relative(dx, dy):
    win32api.mouse_event(win32con.MOUSEEVENTF_MOVE, int(dx), int(dy), 0, 0)

https://stackoverflow.com/questions/2964051/python-win32-simulate-click

The game you're trying to automate may block one of these API calls, but not all of them.


RE: Simulate a Mouse Click on a Video Game - SurHomme - Sep 11, 2022

(Sep 10, 2022 06:50 PM)еlixir Wrote:  You have to use the windows API, sendinput, SetCursorPosition, or mouseevents.

Code
def mouse_move_relative(dx, dy):
    win32api.mouse_event(win32con.MOUSEEVENTF_MOVE, int(dx), int(dy), 0, 0)

https://stackoverflow.com/questions/2964051/python-win32-simulate-click

The game you're trying to automate may block one of these API calls, but not all of them.

Yes they blocked win32api also, I ended up using a DLL file that I found online to simulate the click, mostly used for Valorant cheat


RE: Simulate a Mouse Click on a Video Game - еlixir - Sep 11, 2022

(Sep 11, 2022 07:28 AM)SurHomme Wrote:  Yes they blocked win32api also, I ended up using a DLL file that I found online to simulate the click, mostly used for Valorant cheat

You should have led with that. Yeah, Vanguard blocks direct calls to the Windows API. I do not know what 'DLL'/driver you are using, but be careful. Some are blacklisted and have a delayed ban.

Checkout this repo: https://github.com/ChrisFirerabbit/Valorant-AimBot-and-Navigation-Bot

Code
serMouse = serial.Serial('COM3', baudrate=2000000, writeTimeout=0)
serKeyboard = serial.Serial('COM4', baudrate=2000000, writeTimeout=0)

Adding a hardware layer is a safer option.


RE: Simulate a Mouse Click on a Video Game - SurHomme - Sep 11, 2022

(Sep 11, 2022 07:44 AM)еlixir Wrote:  You should have led with that. Yeah, Vanguard blocks direct calls to the Windows API. I do not know what 'DLL'/driver you are using, but be careful. Some are blacklisted and have a delayed ban.

Checkout this repo: https://github.com/ChrisFirerabbit/Valorant-AimBot-and-Navigation-Bot

Code
serMouse = serial.Serial('COM3', baudrate=2000000, writeTimeout=0)
serKeyboard = serial.Serial('COM4', baudrate=2000000, writeTimeout=0)

Adding a hardware layer is a safer option.

Thanks you, ill check that out


RE: Simulate a Mouse Click on a Video Game - FukkABitch69 - Sep 29, 2022

I know a lot of runescape botters use JavaScript for their mouse actions when botting. I know it also has something to do with the colors on screen. Not really a huge botter so unfortunately cant offer much more information.

If that doesnt work I would suggest some macros or hotkeys like above posters have mentioned.


RE: Simulate a Mouse Click on a Video Game - MeyerWolfsheim - Oct 1, 2022

Check your pms or telegram