Coding Global Background
Coding Global

I want to make this stacker macro more efficient

Archived a year ago
1 messages
1 members
a year ago
Open in Discord
Z
zXylph
Verified

I am trying to make a macro for this stacker minigame inside of some mmo. My code works around 80% of the time (gives me the highscore of 9 blocks on top of each other). If it doesnt get the highscore, it get stuck on the last 2 Blocks because they move too fast for the macro to keep up ( i suspect). ``` import time import pyautogui import win32api, win32con import mss import numpy as np width = 1386 height = 802 target_col = np.array([29, 78, 88]) monitor = {'mon': 1, 'top': height, 'left': width, 'width': 1, 'height': 1} counter = 1 def click(x,y): win32api.SetCursorPos((x,y)) pyautogui.click() with mss.mss() as sct: while True: pic = sct.grab(monitor) if np.all(pic.pixel(0,0) == target_col): click(1083, 801) print(counter, " - ", height) height = height - 28 monitor['top'] = height counter += 1 time.sleep(0.001) ``` I am currently trying to make this run "faster", but I am stuck right now. https://imgur.com/TBkewqa This is what the game looks like. I need to click either "+" button on the left or right side when the blocks are on top of each other. Since the blocks move in set intervals, not smoothly, across the canvas I thought looking at 1 specific pixel of the block (in my case i selected the dark-blue-ish edge around the block) and just comparing its color would be fastest overall. Also the Pixel coordinates are fixed because I am simply trying this for fun, not to distribute anything. If anyone got some ideas on how I could improve this, please let me know. Thank you!

Replies (1)