I've been trying to create a bot using python for an online mmo web game, and I am facing some issues. I'm using pyautogui, and basically, detects a certain RGB color of a pixel that the monster has and click on it, using the typical nested for loops. The issue here is that sometimes, the bot clicks on an environment on the screen that shares the same pixel RGB color as the monster, so instead of clicking on the monster, it clicks on the ground or any other object in the game.
here's my code:
pic = pyautogui.screenshot()
(width, height) = pic.size
for x in range(0, width):
for y in range(0, height):
(r, g, b) = pic.getpixel((x, y))
# MOVE
if r == 152 and g == 119 and b == 111 or r == 163 \
and g == 119 and b == 113:
click(x, y)
What are other ways to detect monster and click? Here's an image of the monster: enter image description here
enter image description here enter image description here
This method is also really slow in its scan, I move my character and I have to stop for a few seconds for it to scan the screen and detect, and move again.