#hi

12 messages · Page 1 of 1 (latest)

void jay
#

Thanks for your question :clap:, if someone gives you an answer it would be great if you thanked them with a :white_check_mark: in response. This response will earn you both points for special roles on this server.

#

@void jay kaizoa.'s Question:

how to make script that can be all you fast and you can change the speed?

It seems like you want to make a script where an action can be performed fast, and you want the ability to change the speed at which it operates. Below is a simple example in Python where a loop runs with a delay that you can adjust to change the speed of execution.

import time

def perform_action(speed):
    while True:
        print("Action performed.")
        time.sleep(1 / speed)  # Adjust the sleep time based on the speed

# Set the speed
speed = 5  # Higher value means faster execution

perform_action(speed)

In this script, the speed variable determines how fast the loop runs. The time.sleep() function is used to create a delay between each iteration. By adjusting the speed variable, you can control how quickly "Action performed." is printed to the console. The higher the speed, the shorter the delay.

If you need a more detailed or different example, please provide additional context or specific requirements.

#

@void jay kaizoa.'s Question:

make a script that shows gui that i can change the speed and disable enable button 1 is the slowest 15 is the fastest speed

Below is an example of a Python script using the tkinter library to create a simple GUI with a slider for adjusting speed and a button that can be enabled or disabled. The slider ranges from 1 to 15, with 15 being the fastest speed. This demo will print "Action performed" at different speeds based on the slider value.

import tkinter as tk
import time
import threading

class SpeedAdjustableGUI:
    def __init__(self, master):
        self.master = master
        self.speed = 1
        self.running = False
        
        self.start_button = tk.Button(master, text="Start", command=self.start_action)
        self.start_button.pack()
        
        self.stop_button = tk.Button(master, text="Stop", command=self.stop_action, state=tk.DISABLED)
        self.stop_button.pack()

        self.speed_scale = tk.Scale(
            master, from_=1, to=15, orient=tk.HORIZONTAL, 
            label="Select Speed", command=self.adjust_speed
        )
        self.speed_scale.pack()

    def perform_action(self):
        while self.running:
            print("Action performed.")
            time.sleep(1 / self.speed)

    def start_action(self):
        if not self.running:
            self.running = True
            self.thread = threading.Thread(target=self.perform_action)
            self.thread.start()
            self.stop_button.config(state=tk.NORMAL)
            self.start_button.config(state=tk.DISABLED)

    def stop_action(self):
        if self.running:
            self.running = False
            self.thread.join()
            self.stop_button.config(state=tk.DISABLED)
            self.start_button.config(state=tk.NORMAL)

    def adjust_speed(self, val):
        self.speed = float(val)

def main():
    root = tk.Tk()
    root.title("Speed Adjuster")
    app = SpeedAdjustableGUI(root)
#

root.mainloop()

if name == "main":
main()


This script creates a window with a start and stop button, and a slider for speed adjustment. When you start the action with the start button, "Action performed." will get printed at the speed set by the slider. You can stop the action with the stop button and readjust the speed as needed. The script uses threading to ensure the GUI remains responsive.
jade vault
#

i dont get what you want

#

do you want a gui or something

#

and im not sure if you're talking about rs

#

stuff that simple doesnt take much brain

#

basically just make input gui then make a button

#

when you click a button it will check what you typed

#

i have like 3-4 years coding experience

#

in rs