Загрузка...

Script Script for the game Spray Paint Roblox

Thread in Python created by nnbro9 Apr 14, 2025. (bumped Jul 25, 2025 at 10:02 PM) 2222 views

  1. nnbro9
    nnbro9 Topic starter Apr 14, 2025 разработка на Python - https://lolz.live/threads/8791935/ 29 Aug 11, 2022
    скрипт рисует выбранное изображение
    рисует только цветом, который выберешь в игре
    эмулирует движения мышью



    скрипт, чтобы чисто зайти поудивлять типов

    #1
    он не быстрый, но точнее второго
    Python
    import cv2
    import numpy as np
    import pydirectinput
    import keyboard
    import time
    from pynput.mouse import Controller as MouseController, Button
    import tkinter as tk
    from tkinter import filedialog, messagebox
    from PIL import Image, ImageTk

    mouse = MouseController()


    class DrawingApp:
    def __init__(self, root):
    self.root = root
    self.root.title("Рисовальщик изображений")
    self.root.geometry("500x400")

    self.image_path = ""
    self.scale_factor = tk.DoubleVar(value=1.0)
    self.pause_time = tk.DoubleVar(value=0.01)
    self.drawing = False

    self.create_widgets()

    def create_widgets(self):
    frame_image = tk.LabelFrame(self.root, text="Выбор изображения", padx=5, pady=5)
    frame_image.pack(pady=5, padx=10, fill="x")

    self.btn_select = tk.Button(frame_image, text="Выбрать изображение", command=self.select_image)
    self.btn_select.pack(pady=5)

    self.lbl_image = tk.Label(frame_image, text="Изображение не выбрано")
    self.lbl_image.pack()

    frame_settings = tk.LabelFrame(self.root, text="Настройки", padx=5, pady=5)
    frame_settings.pack(pady=5, padx=10, fill="x")

    tk.Label(frame_settings, text="Масштаб (0.1-5.0):").grid(row=0, column=0, sticky="w")
    tk.Scale(frame_settings, from_=0.1, to=5.0, resolution=0.1, orient="horizontal",
    variable=self.scale_factor).grid(row=0, column=1, sticky="ew")

    tk.Label(frame_settings, text="Задержка (сек):").grid(row=1, column=0, sticky="w")
    tk.Scale(frame_settings, from_=0.001, to=0.1, resolution=0.001, orient="horizontal",
    variable=self.pause_time).grid(row=1, column=1, sticky="ew")

    self.btn_start = tk.Button(self.root, text="Начать рисование", command=self.start_drawing, state="disabled")
    self.btn_start.pack(pady=10)

    frame_info = tk.LabelFrame(self.root, text="Информация", padx=5, pady=5)
    frame_info.pack(pady=5, padx=10, fill="x")

    tk.Label(frame_info, text="Для остановки нажмите F4", fg="red").pack()

    def select_image(self):
    self.image_path = filedialog.askopenfilename(filetypes=[("Image files", "*.jpg;*.jpeg;*.png;*.bmp")])
    if self.image_path:
    self.lbl_image.config(text=self.image_path.split("/")[-1])
    self.btn_start.config(state="normal")

    try:
    img = Image.open(self.image_path)
    img.thumbnail((100, 100))
    photo = ImageTk.PhotoImage(img)
    self.lbl_image_preview = tk.Label(self.root)
    self.lbl_image_preview.image = photo
    self.lbl_image_preview.config(image=photo)
    self.lbl_image_preview.pack()
    except Exception as e:
    messagebox.showerror("Ошибка", f"Не удалось загрузить изображение: {e}")

    def prepare_image(self):
    img = cv2.imread(self.image_path)
    if img is None:
    messagebox.showerror("Ошибка", "Не удалось загрузить изображение!")
    return None

    small_img = cv2.resize(img, (0, 0), fx=self.scale_factor.get(), fy=self.scale_factor.get())
    gray = cv2.cvtColor(small_img, cv2.COLOR_BGR2GRAY)
    binary = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_MEAN_C,
    cv2.THRESH_BINARY_INV, 11, 2)

    return binary

    def generate_drawing_points(self, image):
    points = []
    height, width = image.shape

    for y in range(0, height, 1):
    for x in range(0, width, 1):
    if image[y, x] > 0:
    points.append((x, y))

    return points

    def draw_image(self, points):
    try:
    pydirectinput.PAUSE = self.pause_time.get()
    scale = 1.0

    try:
    screen_w, screen_h = pydirectinput.size()
    except:
    screen_w, screen_h = 1920, 1080

    img_h, img_w = self.processed_img.shape
    offset = ((screen_w - img_w) / 2, (screen_h - img_h) / 2)

    self.drawing = True
    self.btn_start.config(state="disabled", text="Рисование...")
    self.root.update()

    time.sleep(2)

    for i, (x, y) in enumerate(points):
    if not self.drawing or keyboard.is_pressed('F4'):
    print("Остановлено пользователем!")
    break

    scaled_x = int(x + offset[0])
    scaled_y = int(y + offset[1])

    pydirectinput.moveTo(scaled_x, scaled_y)
    mouse.click(Button.left)

    except Exception as e:
    messagebox.showerror("Ошибка", f"Произошла ошибка: {e}")
    finally:
    self.drawing = False
    self.btn_start.config(state="normal", text="Начать рисование")
    messagebox.showinfo("Информация", "Рисование завершено")

    def start_drawing(self):
    if not self.image_path:
    messagebox.showerror("Ошибка", "Сначала выберите изображение!")
    return

    self.processed_img = self.prepare_image()
    if self.processed_img is None:
    return

    drawing_points = self.generate_drawing_points(self.processed_img)

    import threading
    threading.Thread(target=self.draw_image, args=(drawing_points,), daemon=True).start()


    if __name__ == "__main__":
    root = tk.Tk()
    app = DrawingApp(root)
    root.mainloop()
    [IMG]

    видос ускорен в 50раз
    (рисовалось в paint)
    #2
    быстрый, но не очень точный
    тут без GUI
    запускаешь скрипт и alt+tab в роблокс
    time.sleep(??) можете настроить
    Python
    import cv2
    import numpy as np
    import pydirectinput
    import keyboard
    import time

    pydirectinput.PAUSE = 0.0000000000001 #скорость рисования 1
    DRAW_DELAY = 0.00000001 #скорость рисования 2
    SCALE_FACTOR = 1 # размер (влияет на скорость)
    DOT_DENSITY = 1 # я бы не трогал это

    def prepare_image(image_path):
    img = cv2.imread(image_path)
    if img is None:
    print("Ошибка загрузки изображения!")
    return None

    small_img = cv2.resize(img, (0, 0), fx=SCALE_FACTOR, fy=SCALE_FACTOR)
    gray = cv2.cvtColor(small_img, cv2.COLOR_BGR2GRAY)
    binary = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_MEAN_C,
    cv2.THRESH_BINARY_INV, 11, 2)
    return binary

    def generate_drawing_points(image):
    points = []
    height, width = image.shape

    for y in range(0, height, DOT_DENSITY):
    for x in range(0, width, DOT_DENSITY):
    if image[y, x] > 0:
    points.append((x, y))
    return points

    def draw_image(points, scale=1.0, offset=(0, 0)):
    try:
    print(f"Начинаем рисование {len(points)} точек...")
    time.sleep(2) # под себя нужно настроить
    pydirectinput.mouseDown(button='left')

    for i, (x, y) in enumerate(points):
    if keyboard.is_pressed('F4'):
    print("Остановлено по F4!")
    break

    scaled_x = int(x * scale + offset[0])
    scaled_y = int(y * scale + offset[1])

    pydirectinput.moveTo(scaled_x, scaled_y)
    time.sleep(DRAW_DELAY)

    if i % 500 == 0:
    print(f"Прогресс: {i + 1}/{len(points)} точек")

    except Exception as e:
    print(f"Ошибка: {e}")
    finally:
    pydirectinput.mouseUp(button='left')
    print("Рисование завершено")

    if __name__ == "__main__":
    image_path = "x6YsgfTZoKJYfFXrria6Zjel16Kj-kxd0orOglucHyLnQmA-tnWZ3R-VCOYP3ZEIWak7ENvYgWZgtmHb0XRTX22o.jpg"

    processed_img = prepare_image(image_path)
    if processed_img is None:
    exit()

    drawing_points = generate_drawing_points(processed_img)

    try:
    screen_w, screen_h = pydirectinput.size()
    except:
    screen_w, screen_h = 1920, 1080

    img_h, img_w = processed_img.shape
    scale = min(screen_w / img_w, screen_h / img_h) * 0.8
    offset = ((screen_w - img_w * scale) / 2, (screen_h - img_h * scale) / 2)

    draw_image(drawing_points, scale, offset)



    [IMG][IMG][IMG][IMG][IMG][IMG]
     
  2. INACTIV_US_125
    INACTIV_US_125 Apr 14, 2025 BARABAN 269 Dec 4, 2024
  3. nnbro9
    nnbro9 Topic starter Apr 14, 2025 разработка на Python - https://lolz.live/threads/8791935/ 29 Aug 11, 2022
    [IMG]
    нарисован с помощью #2
     
  4. solxce
    solxce Jun 9, 2025 1 May 21, 2025
    а где код вводить?
     
    1. nnbro9 Topic starter
      solxce, ???? скачиваешь IDE Python любой и туда код, скачиваешь библиотеки, которые в скрипте используются
  5. onerexxxz
    onerexxxz Jun 10, 2025 1 Jun 10, 2025
    извини за глупый вопрос, но как в подробностях запустить скрипт?
     
    1. nnbro9 Topic starter
      onerexxxz, ЛЮБУЮ среду разработки скачиваешь pycharm vscode, скачиваешь все библиотеки, которые юзает скрипт
      [IMG]pip install cv2
      pip install numpy и так далее
      pip install вводить в терминал
      win+r --->[IMG]

      заходишь в роблокс, заходишь в сам spray paint, запускаешь скрипт и у тебя есть тайминг (его можно настроить)[IMG], за который ты должен зайти в роблокс как на видосе[IMG]
    2. nnbro9 Topic starter
      onerexxxz, откуда вы такие приходите?

      upd ахахах, я понял откуда
      [IMG][IMG]
Loading...
Top