3

About 3-4 months ago, I decided to use my basic python knowledge to write a simple farming bot for an old RPG. After some struggling, I found a way to use pyautogui and run the script as an administrator to send key presses and mouse clicks to the game, even managed to bypass their tricky antibot system (used pyautogui locate on screen function and pytesseract OCR, source code below). Needless to say that adding new features and overcoming various problems associated with them has taught me a lot, much more than any book or video, and was a lot of fun.

But the server released a new update, which uses "smart guard" to block any commands not created by actual keyboard and mouse. Not giving up so easily, I've tried multiple workarounds, but unsuccessfully (I'm running Windows 10 x64 and the game uses DirectX):

  • Tried using other python modules, such as pydirectinput, pywinauto, keyboard etc.

  • Tried using AutoHotKey and its multiple ways of sending commands: send, sendevent, sendeventraw etc.

  • Compiled python and AHK scripts to prevent game detecting them.

  • Ran the game in VirtualBox and the script in the host machine, but the VM didn't receive input from the host, and the game was very laggy.

  • Even tested inputs with Windows On-Screen keyboard, which also got ignored.

  • Experimented with win32api, win32con to send mouse clicks/ key presses as "scancodes". But my knowledge is very limited in this area, so it could be just wrong.

Anyway, even though I failed to send a single click to the game from the script, this experience has taught me a lot. And I'd like to keep learning and messing around with the code, so I'd be grateful if anyone has any ideas or workarounds for this problem, but please keep my low amount of knowledge in mind when suggesting anything, thanks in advance :)

1
  • Small news, sending commands via ctypes to the game has also failed. Commented Nov 16, 2021 at 6:49

2 Answers 2

1

Sounds like a perfect problem for PyDirectInput

This should almost definitely do the job!

Sign up to request clarification or add additional context in comments.

1 Comment

PyDirectInput does work in some situations, (For example GTA V and Dark Souls 2). However as I mentioned in the post, in this particularly tough case this module did nothing. I ended up emulatong keyboard and mouse jnputs via raspberry pi.
0

Using Arduino to create a virtual driver would do the trick.

Also MouClassInputInjection would work here

1 Comment

While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.