moses-palmer / pynput

Sends virtual input commands
GNU Lesser General Public License v3.0
1.74k stars 244 forks source link

Pynput mouse click broken inside of Valorant as of recently... #509

Closed mendez97cr closed 1 year ago

mendez97cr commented 1 year ago

Recently my Python trigger bot script has stopped working. Hope we can discuss the problem here instead of discussing morals. I've managed to debug and come to a concussion. There was a patch and pynput stopped working because of it.

I'm on windows & the pynput version is (1.7.6).

from pynput.mouse import Controller, Button
from pynput import mouse
import time
import keyboard
import win32gui
import win32api

KEYBIND = "/" 

# Instantiate mouse controller
mouse = Controller()

# Disable click delay (100ms)
win32gui.GetDoubleClickTime = lambda: 0

try:

    while True: 
        if keyboard.is_pressed(KEYBIND):
            mouse.click(Button.left)
            time.sleep(2)

except KeyboardInterrupt:
    pass

Mouse event is working outside of the video game but not inside. Which is odd because this was working great a couple days ago. Now it's BLOCKING the click or just not activating it.

mendez97cr commented 1 year ago

Found the solution. When raw input buffer is enabled in game settings. it will not let you use Pynput.

The Raw Input setting allows mice to send inputs directly to the game rather than through your operating system, and VALORANT has had it enabled for all players since launch. Apr 16, 2022

By ticking this off my code ran just fine.

moses-palmer commented 1 year ago

In that case I will close this issue.