#I cannot click the mouse with Python in the game I am playing.

1 messages · Page 1 of 1 (latest)

stray plinth
#

I cannot click the mouse with Python in the game I am playing. The game runs smoothly as it is edited, but in the code I wrote, the game does not produce a mouse click movement. Can you help?

wicked ruin
#

Show code

stray plinth
#

import pyautogui
import time

List of coordinates

coordinates = [(743, 442), (797, 451), (842, 444)]

Right-click at each coordinate

for coord in coordinates:
pyautogui.moveTo(coord[0], coord[1])
pyautogui.click(button='right')
time.sleep(5) # Wait for 5 seconds

wicked ruin
#

Smells like ChatGPT, someone else might feel like helping

#

should probably just use the mousedown and mouseup with a short delay between them though, I'd guess the click is too short

stray plinth
#

Works fine outside the game screen, but doesn’t click when on the game screen.

wicked ruin
#

Most games don't really like pyautogui

stray plinth
#

im going to try it

#

"I tried, but the click still doesn't work."

wicked ruin
#

Python moment

stray plinth
#

😦