from re import A
from PIL import Image
import webcolors
import pyautogui
import time
startingX = 886
startingY = 242
# X,Y COORDINATES OF BUTTONS
def colorButton():
pyautogui.moveTo(1452, 1109)
def XButton():
pyautogui.moveTo(1760, 722)
def enterColor(hex):
pyautogui.moveTo(1468, 1000)
pyautogui.write(hex)
### ACTUAL CODE! K,CS + K, U
def getColorFromPixel(x, y):
im = Image.open("./img.png").convert("RGB")
r, g, b = im.getpixel((x, y))
hex = webcolors.rgb_to_hex((r, g, b))
return hex
def draw():
time.sleep(5)
for i in range(0, 1):
for j in range(0, 32):
time.sleep(0.25)
newX = 877 + (26 * j)
newY = 235 + (25 * i)
pyautogui.moveTo(newX, newY)
pyautogui.leftClick()
draw()
So, I have a piece of code that is moving the mouse on a 32x32 grid (well on the screen the size or bigger, but the game on which I'll be drawing is 32x32). I have a coordinate of 1st square and according to that I just move +- 25/26 in X,Y depending where I'm in the for loop. The problem lies that when the cursor moves from square to square it seems like the game doesn't register the mouse moving - the cursor on the game moves, but the tile is supposed to be gray, but it's still white, and the tile that it starts on is selected the whole time.
Here's a little video of the demonstration so you see what the problem is: https://streamable.com/4p6il7
(excuse my music :/)
I'll just explain what's happening if you don't get it: My cursor is starting on a random pixel (where I've put my mouse manually), but when the script runs and it runs (+ clicks there!) it doesn't get selected (and as you see, the pixel I was on before is selected and it reappareaning is me clicking right click to delete it).
What do I do? Could this be something due to ROBLOX?