Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
7 views3 pages

Message

This document is a Python script that automates the process of salvaging items using the PyAutoGUI library. It includes a graphical user interface (GUI) built with Tkinter, allowing users to control the speed of the automation and monitor session statistics. The script also implements key bindings for starting, pausing, and adjusting the speed of the automation process.

Uploaded by

Techno ASR Gamer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

Message

This document is a Python script that automates the process of salvaging items using the PyAutoGUI library. It includes a graphical user interface (GUI) built with Tkinter, allowing users to control the speed of the automation and monitor session statistics. The script also implements key bindings for starting, pausing, and adjusting the speed of the automation process.

Uploaded by

Techno ASR Gamer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

import pyautogui

import time
import keyboard
import tkinter as tk

# --- COORDINATES ---


ITEM_SLOT_X = 680
ITEM_SLOT_Y = 426
SALVAGE_BUTTON_X = 692
SALVAGE_BUTTON_Y = 566
# -------------------

pyautogui.PAUSE = 0

# --- Automation variables ---


running = False
delay_item_to_salvage = 0.15
delay_cycle = 0.1
salvage_count = 0
total_salvages = 0
start_time = None
speed_label = "NORMAL"

# --- GUI SETUP ---


root = tk.Tk()
root.title("Auto Salvage")
root.geometry("600x350")
root.minsize(400, 300)
root.resizable(True, True)

# Greyish background
root.configure(bg="#B0B0B0") # light grey
root.attributes("-topmost", True)
root.attributes("-alpha", 0.9)

# StringVars
status_var = tk.StringVar(value="Status: PAUSED")
speed_var = tk.StringVar(value=f"Speed: {speed_label}")
time_var = tk.StringVar(value="TIME: 0s / 0m / 0h")
salvage_var = tk.StringVar(value="Session Salvages: 0 | Total: 0")
rate_var = tk.StringVar(value="Salvages/sec: 0")

# Create labels with greyish background


instructions = tk.Label(root, text="F1 = Normal\nF2 = Fast\nF3 = Faster\nF4 = Ultra
Fast\nF6 = Pause\nESC = Exit",
anchor='center', justify='center', bg="#B0B0B0")
status_label = tk.Label(root, textvariable=status_var, bg="#B0B0B0")
speed_label_widget = tk.Label(root, textvariable=speed_var, bg="#B0B0B0")
time_label = tk.Label(root, textvariable=time_var, bg="#B0B0B0")
salvage_label = tk.Label(root, textvariable=salvage_var, bg="#B0B0B0")
rate_label = tk.Label(root, textvariable=rate_var, bg="#B0B0B0")

# Pack labels with fill and expand for scaling


for lbl in [instructions, status_label, speed_label_widget, time_label,
salvage_label, rate_label]:
lbl.pack(fill='both', expand=True, pady=5)

# Function to dynamically adjust font sizes based on window height


def resize_fonts(event=None):
height = root.winfo_height()
font_size_large = max(12, height // 25)
font_size_medium = max(10, height // 30)
instructions.config(font=("Arial", font_size_medium))
for lbl in [status_label, speed_label_widget, time_label, salvage_label,
rate_label]:
lbl.config(font=("Arial", font_size_large))

root.bind("<Configure>", resize_fonts)

# --- Reset session stats ---


def reset_session():
global salvage_count, start_time
salvage_count = 0
start_time = None
time_var.set("TIME: 0s / 0m / 0h")
salvage_var.set(f"Session Salvages: {salvage_count} | Total: {total_salvages}")
rate_var.set("Salvages/sec: 0")

# --- Automation loop ---


def automation_loop():
global salvage_count, total_salvages, start_time
if running:
pyautogui.moveTo(ITEM_SLOT_X, ITEM_SLOT_Y)
pyautogui.rightClick()
pyautogui.rightClick()
time.sleep(delay_item_to_salvage)

pyautogui.moveTo(SALVAGE_BUTTON_X, SALVAGE_BUTTON_Y)
pyautogui.leftClick()
time.sleep(delay_cycle)

salvage_count += 1
total_salvages += 1

# Update session count


salvage_var.set(f"Session Salvages: {salvage_count} | Total:
{total_salvages}")

# Update elapsed time


elapsed = time.time() - start_time if start_time else 0
seconds = int(elapsed)
minutes = seconds // 60
hours = minutes // 60
time_var.set(f"TIME: {seconds}s / {minutes}m / {hours}h")

# Update salvages/sec
rate = salvage_count / elapsed if elapsed > 0 else 0
rate_var.set(f"Salvages/sec: {rate:.1f}")

root.after(10, automation_loop)

# --- Keybinds ---


def check_keys():
global running, delay_item_to_salvage, delay_cycle, speed_label, start_time

if keyboard.is_pressed("f1"):
delay_item_to_salvage = 0.15
delay_cycle = 0.1
running = True
speed_label = "NORMAL"
speed_var.set(f"Speed: {speed_label}")
status_var.set("Status: RUNNING")
if start_time is None:
start_time = time.time()
time.sleep(0.3)

if keyboard.is_pressed("f2"):
delay_item_to_salvage = 0.08
delay_cycle = 0.05
running = True
speed_label = "FAST"
speed_var.set(f"Speed: {speed_label}")
status_var.set("Status: RUNNING")
if start_time is None:
start_time = time.time()
time.sleep(0.3)

if keyboard.is_pressed("f3"):
delay_item_to_salvage = 0.05
delay_cycle = 0.03
running = True
speed_label = "FASTER"
speed_var.set(f"Speed: {speed_label}")
status_var.set("Status: RUNNING")
if start_time is None:
start_time = time.time()
time.sleep(0.3)

if keyboard.is_pressed("f4"):
delay_item_to_salvage = 0.03
delay_cycle = 0.015
running = True
speed_label = "ULTRA FAST"
speed_var.set(f"Speed: {speed_label}")
status_var.set("Status: RUNNING")
if start_time is None:
start_time = time.time()
time.sleep(0.3)

if keyboard.is_pressed("f6"):
running = False
status_var.set("Status: PAUSED")
reset_session()
time.sleep(0.3)

if keyboard.is_pressed("esc"):
reset_session()
root.destroy()
return

root.after(100, check_keys)

automation_loop()
check_keys()
root.mainloop()

You might also like