Skip to content

Commit d1a672d

Browse files
authored
Merge pull request #4 from BluDolphin/v4
created frenzy mode
2 parents 9b79b02 + 0616941 commit d1a672d

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

Main/autoClicker.py

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,19 @@
1111
- Clicks fast
1212
- Stops clicking when mouse is outside of a boundary
1313
- Automatically moves mouse to image location
14+
- Can auto find and click on many images
1415
"""
1516

1617
# ================================================================================================
1718
# SETTINGS
18-
1919
delay = 0.001 # Set delay
2020
button = Button.left # Set button to press
2121
startStopKey = KeyCode(char='z') # Set key to start/stop
22+
frenzyKey = KeyCode(char='x') # Set key to frenzy
2223

2324
boundaryToggle = True # Change to False to disable boundary auto turn off
2425
autoSnapToggle = True # Change to False to disable auto snap to image
25-
26+
frenzyToggle = True # Change to False to disable frenzy click
2627

2728
# ================================================================================================
2829
# Advanced settings
@@ -33,19 +34,21 @@
3334
# Set the location of the images
3435
# By default the images need to be in the same directory as this program
3536
cookiepath = os.path.join(programDirectory, 'cookie.png')
37+
frenzyPath = os.path.join(programDirectory, 'frenzyCookie.png')
3638

3739
# ================================================================================================
3840
print("Auto Clicker Starting\n"
3941
f"Delay: {delay: 0.001}\n"
4042
f"Auto click button: {button}\n"
41-
f"Start/Stop button: {startStopKey}")
43+
f"Start/Stop button: {startStopKey}\n"
44+
f"Frenzy button: {frenzyKey}\n")
4245

4346

4447
mouse = Controller() # Create mouse object
4548
clicking = False # Set clicking to false
4649

4750
def active(delay, button): # Function to click
48-
while clicking == True: # While truez
51+
while clicking == True: # While true
4952
mouse.click(button) # Click the button
5053
time.sleep(delay) # Sleep for the delay
5154
return
@@ -73,12 +76,12 @@ def boundary(): # Function to check if the mouse is in the boundary+
7376

7477

7578
def keyLogger(key): # Function for tracking key presses
76-
global clicking, imageLocation
79+
global clicking
7780
if key == startStopKey: # If the key pressed is the start/stop key
7881
try:
7982
if autoSnapToggle == True:
8083
imageLocation = pyautogui.locateOnScreen(cookiepath, grayscale=True, confidence=0.70) # Locate the image on the screen
81-
imageLocation = (imageLo cation[0], imageLocation[1] - 100, imageLocation[2], imageLocation[3]) # modify y to raise the mouse to middle
84+
imageLocation = (imageLocation[0], imageLocation[1] - 100, imageLocation[2], imageLocation[3]) # modify y to raise the mouse to middle
8285
pyautogui.moveTo(imageLocation) # Move the mouse to the location
8386
clicking = not clicking # Set clicking to the opposite of what it is
8487
print (f"Auto clicker: {clicking}") # Print the key pressed
@@ -87,6 +90,7 @@ def keyLogger(key): # Function for tracking key presses
8790
clicking = not clicking # Set clicking to the opposite of what it is
8891
print (f"Auto clicker: {clicking}") # Print the key pressed
8992

93+
9094
if clicking == True: # if clicking is true
9195
# Create thread for active function
9296
clickingThread = threading.Thread(target=active, args=(delay, button))
@@ -95,12 +99,26 @@ def keyLogger(key): # Function for tracking key presses
9599
if boundaryToggle == True:
96100
boundaryThread = threading.Thread(target=boundary)
97101
boundaryThread.start()
98-
102+
99103
except Exception as e:
100104
print(f"Error: {e}")
101105
print("No cookie found")
102106
clicking = False
103-
104-
# Create listener for key logging
107+
108+
if key == frenzyKey and frenzyToggle == True: # If the key pressed is the frenzy key
109+
clicking = False # Set clicking to false to disable if auto clicker is currently running
110+
111+
while True: # While true
112+
try:
113+
for pos in pyautogui.locateAllOnScreen(frenzyPath, grayscale=True, confidence=0.7): # Locate all the images on the screen
114+
pyautogui.moveTo(pos) # Move the mouse to the location
115+
mouse.click(Button.left) # Click the button
116+
117+
except Exception as e: # Exit on no frenzy cookie found
118+
print(f"Error: {e}")
119+
print("No frenzy cookie found") # Print if no cookie is found
120+
break # Break the loop
121+
122+
# Create listener for key logging and start keyLogger function
105123
with Listener(on_press=keyLogger) as listener:
106124
listener.join()

Main/frenzyCookie.png

9.39 KB
Loading

0 commit comments

Comments
 (0)