Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
# Smarter selection of people
centerOfScreen = True

# Auto click settings - click when target is in center
autoClickEnabled = True
autoClickKey = "O" # Key to toggle auto click (O key)
autoClickThreshold = 20 # Distance threshold from center (pixels)
autoClickDelay = 0.01 # Seconds between clicks (0.1 = 10 clicks/sec)

# ONNX ONLY - Choose 1 of the 3 below
# 1 - CPU
# 2 - AMD
Expand Down
42 changes: 41 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# Could be do with
# from config import *
# But we are writing it out for clarity for new devs
from config import aaMovementAmp, useMask, maskWidth, maskHeight, aaQuitKey, screenShotHeight, confidence, headshot_mode, cpsDisplay, visuals, centerOfScreen
from config import aaMovementAmp, useMask, maskWidth, maskHeight, aaQuitKey, screenShotHeight, confidence, headshot_mode, cpsDisplay, visuals, centerOfScreen, autoClickEnabled, autoClickKey, autoClickDelay, autoClickThreshold
import gameSelection

def main():
Expand All @@ -35,8 +35,21 @@ def main():

# Main loop Quit if Q is pressed
last_mid_coord = None
last_click_time = 0
auto_click_active = False

print(f"Auto Click Key: {autoClickKey} (toggle on/off)")
print(f"Auto Click Enabled: {autoClickEnabled}")
print(f"Auto Click Delay: {autoClickDelay}s ({1/autoClickDelay:.0f} clicks/sec)")
if autoClickEnabled:
print("Press", autoClickKey, "to toggle auto click")

with torch.no_grad():
while win32api.GetAsyncKeyState(ord(aaQuitKey)) == 0:
# Auto click toggle - unified implementation
if autoClickEnabled and win32api.GetAsyncKeyState(ord(autoClickKey)) & 1:
auto_click_active = not auto_click_active
print("Auto Click:", "ON" if auto_click_active else "OFF")

# Getting Frame
npImg = np.array(camera.get_latest_frame())
Expand Down Expand Up @@ -124,6 +137,33 @@ def main():
if win32api.GetKeyState(0x14):
win32api.mouse_event(win32con.MOUSEEVENTF_MOVE, int(
mouseMove[0] * aaMovementAmp), int(mouseMove[1] * aaMovementAmp), 0, 0)

# Auto click functionality - dual condition check with X-axis threshold
if autoClickEnabled and auto_click_active:
current_time = time.time()
if current_time - last_click_time >= autoClickDelay:
# Condition 1: Check if center of screen is within the box
box_left = xMid - (targets.iloc[0].width / 2)
box_right = xMid + (targets.iloc[0].width / 2)
box_top = yMid - (targets.iloc[0].height / 2)
box_bottom = yMid + (targets.iloc[0].height / 2)

center_in_box = (cWidth >= box_left and
cWidth <= box_right and
cHeight >= box_top and
cHeight <= box_bottom)

# Condition 2: Check X-axis distance only from center of box to center of screen
x_distance = abs(xMid - cWidth)
is_within_threshold = x_distance <= autoClickThreshold

# Both conditions must be met
if center_in_box and is_within_threshold:
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
time.sleep(0.01)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
last_click_time = current_time

last_mid_coord = [xMid, yMid]

else:
Expand Down
42 changes: 41 additions & 1 deletion main_onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# Could be do with
# from config import *
# But we are writing it out for clarity for new devs
from config import aaMovementAmp, useMask, maskHeight, maskWidth, aaQuitKey, confidence, headshot_mode, cpsDisplay, visuals, onnxChoice, centerOfScreen
from config import aaMovementAmp, useMask, maskHeight, maskWidth, aaQuitKey, confidence, headshot_mode, cpsDisplay, visuals, onnxChoice, centerOfScreen, autoClickEnabled, autoClickKey, autoClickDelay, autoClickThreshold
import gameSelection

def main():
Expand Down Expand Up @@ -44,7 +44,20 @@ def main():

# Main loop Quit if Q is pressed
last_mid_coord = None
last_click_time = 0
auto_click_active = False

print(f"Auto Click Key: {autoClickKey} (toggle on/off)")
print(f"Auto Click Enabled: {autoClickEnabled}")
print(f"Auto Click Delay: {autoClickDelay}s ({1/autoClickDelay:.0f} clicks/sec)")
if autoClickEnabled:
print("Press", autoClickKey, "to toggle auto click")

while win32api.GetAsyncKeyState(ord(aaQuitKey)) == 0:
# Auto click toggle - unified implementation
if autoClickEnabled and win32api.GetAsyncKeyState(ord(autoClickKey)) & 1:
auto_click_active = not auto_click_active
print("Auto Click:", "ON" if auto_click_active else "OFF")

# Getting Frame
npImg = np.array(camera.get_latest_frame())
Expand Down Expand Up @@ -147,6 +160,33 @@ def main():
if win32api.GetKeyState(0x14):
win32api.mouse_event(win32con.MOUSEEVENTF_MOVE, int(
mouseMove[0] * aaMovementAmp), int(mouseMove[1] * aaMovementAmp), 0, 0)

# Auto click functionality - dual condition check with X-axis threshold
if autoClickEnabled and auto_click_active:
current_time = time.time()
if current_time - last_click_time >= autoClickDelay:
# Condition 1: Check if center of screen is within the box
box_left = xMid - (targets.iloc[0].width / 2)
box_right = xMid + (targets.iloc[0].width / 2)
box_top = yMid - (targets.iloc[0].height / 2)
box_bottom = yMid + (targets.iloc[0].height / 2)

center_in_box = (cWidth >= box_left and
cWidth <= box_right and
cHeight >= box_top and
cHeight <= box_bottom)

# Condition 2: Check X-axis distance only from center of box to center of screen
x_distance = abs(xMid - cWidth)
is_within_threshold = x_distance <= autoClickThreshold

# Both conditions must be met
if center_in_box and is_within_threshold:
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
time.sleep(0.01)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
last_click_time = current_time

last_mid_coord = [xMid, yMid]

else:
Expand Down
43 changes: 42 additions & 1 deletion main_tensorrt.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# Could be do with
# from config import *
# But we are writing it out for clarity for new devs
from config import aaMovementAmp, useMask, maskHeight, maskWidth, aaQuitKey, confidence, headshot_mode, cpsDisplay, visuals, centerOfScreen, screenShotWidth
from config import aaMovementAmp, useMask, maskHeight, maskWidth, aaQuitKey, confidence, headshot_mode, cpsDisplay, visuals, centerOfScreen, screenShotWidth, autoClickEnabled, autoClickKey, autoClickThreshold, autoClickDelay
import gameSelection

def main():
Expand All @@ -33,6 +33,15 @@ def main():

# Main loop Quit if exit key is pressed
last_mid_coord = None
last_click_time = 0
auto_click_active = False

print(f"Auto Click Key: {autoClickKey} (toggle on/off)")
print(f"Auto Click Enabled: {autoClickEnabled}")
print(f"Auto Click Delay: {autoClickDelay}s ({1/autoClickDelay:.0f} clicks/sec)")
if autoClickEnabled:
print("Press", autoClickKey, "to toggle auto click")

with torch.no_grad():
while win32api.GetAsyncKeyState(ord(aaQuitKey)) == 0:

Expand Down Expand Up @@ -115,6 +124,33 @@ def main():
if win32api.GetKeyState(0x14):
win32api.mouse_event(win32con.MOUSEEVENTF_MOVE, int(
mouseMove[0] * aaMovementAmp), int(mouseMove[1] * aaMovementAmp), 0, 0)

# Auto click functionality - dual condition check with X-axis threshold
if autoClickEnabled and auto_click_active:
current_time = time.time()
if current_time - last_click_time >= autoClickDelay:
# Condition 1: Check if center of screen is within the box
box_left = xMid - (targets.iloc[0].width / 2)
box_right = xMid + (targets.iloc[0].width / 2)
box_top = yMid - (targets.iloc[0].height / 2)
box_bottom = yMid + (targets.iloc[0].height / 2)

center_in_box = (cWidth >= box_left and
cWidth <= box_right and
cHeight >= box_top and
cHeight <= box_bottom)

# Condition 2: Check X-axis distance only from center of box to center of screen
x_distance = abs(xMid - cWidth)
is_within_threshold = x_distance <= autoClickThreshold

# Both conditions must be met
if center_in_box and is_within_threshold:
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
time.sleep(0.01)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
last_click_time = current_time

last_mid_coord = [xMid, yMid]

else:
Expand Down Expand Up @@ -142,6 +178,11 @@ def main():
cv2.putText(npImg, label, (startX, y),
cv2.FONT_HERSHEY_SIMPLEX, 0.5, COLORS[idx], 2)

# Auto click toggle - moved outside for consistent toggle behavior
if autoClickEnabled and win32api.GetAsyncKeyState(ord(autoClickKey)) & 1:
auto_click_active = not auto_click_active
print("Auto Click:", "ON" if auto_click_active else "OFF")

# Forced garbage cleanup every second
count += 1
if (time.time() - sTime) > 1:
Expand Down