Last active
March 15, 2019 17:33
-
-
Save psidex/67a6cf7c12e1b599c7e4ba4e2b4c5769 to your computer and use it in GitHub Desktop.
A quickly written auto-clicker for aimbooster.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import ImageGrab | |
import numpy as np | |
import pyautogui | |
from time import sleep | |
coords = [181, 348, 778, 765] # Game window coords | |
againCoords = [505, 732] # "Again" button coords | |
# Game window h/w | |
imageWidth = 597 | |
imageHeight = 417 | |
# Start from the screen that has the "Again" button | |
pyautogui.click(*againCoords) | |
# Wait for intial targets to appear | |
sleep(1) | |
while 1: | |
# Drag mouse up to exit (might take a few tries) | |
if pyautogui.position().x < 181: | |
print("mouse quit") | |
quit() | |
screen = np.array(ImageGrab.grab(bbox=coords)) | |
# Steps of 7 pixels balances accuracy with time taken to scan for a target | |
for x in range(0, imageWidth, 7): | |
for y in range(0, imageHeight, 7): | |
if ( | |
screen[y][x][0] == 255 | |
and screen[y][x][1] > 200 | |
and screen[y][x][2] > 190 | |
): | |
pyautogui.click(coords[0] + x, coords[1] + y) | |
break | |
else: | |
continue # only executed if the inner loop did NOT break | |
break # only executed if the inner loop DID break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment