1212- Can auto find and click on many images (Windows only)
1313"""
1414
15+
1516# ================================================================================================
1617# SETTINGS
1718delay = 0.001 # Set delay
5051
5152mouse = Controller () # Create mouse object
5253clicking = False # Set clicking to false
54+ frenzy = False # Set frenzy to false
55+ pyautogui .PAUSE = 0.01 # Delay for pyautogui between image searches
5356
5457def active (delay , button ): # Function to click
5558 while clicking == True : # While true
@@ -82,7 +85,7 @@ def boundary(): # Function to check if the mouse is in the boundary+
8285def keyLogger (key ): # Function for tracking key presses
8386 global clicking
8487 if key == startStopKey : # If the key pressed is the start/stop key
85- try :
88+ try :
8689 if autoSnapToggle == True :
8790 imageLocation = pyautogui .locateOnScreen (cookiepath , grayscale = True , confidence = 0.70 ) # Locate the image on the screen
8891 imageLocation = (imageLocation [0 ], imageLocation [1 ] - 100 , imageLocation [2 ], imageLocation [3 ]) # modify y to raise the mouse to middle
@@ -110,19 +113,22 @@ def keyLogger(key): # Function for tracking key presses
110113 clicking = False
111114
112115 if key == frenzyKey and frenzyToggle == True : # If the key pressed is the frenzy key
116+ print ("Frenzy mode: On" ) # Print frenzy mode is true
113117 clicking = False # Set clicking to false to disable if auto clicker is currently running
114-
115- while True : # While true
118+ frenzy = True # Set frenzy to true
119+
120+ while frenzy == True : # While true
116121 try :
117- for pos in pyautogui .locateAllOnScreen (frenzyPath , grayscale = True , confidence = 0.5 ): # Locate all the images on the screen
122+ for pos in pyautogui .locateAllOnScreen (frenzyPath , grayscale = True , confidence = 0.8 ): # Locate all the images on the screen
118123 pyautogui .moveTo (pos ) # Move the mouse to the location
119124 mouse .click (Button .left ) # Click the button
120125
121126 except Exception as e : # Exit on no frenzy cookie found
122127 print (f"Error: { e } " )
123128 print ("No frenzy cookie found" ) # Print if no cookie is found
129+ frenzy = False
124130 break # Break the loop
125-
131+
126132# Create listener for key logging and start keyLogger function
127133with Listener (on_press = keyLogger ) as listener :
128134 listener .join ()
0 commit comments