Issues with ending a specific loop!

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

DannyDaMannyy

Member
Dec 16, 2023
20
1
3
16
Hey! Moderately new to Skript, but loving it so far!! I'm developing a sort of 4 way Capture the Flag server, with some twists, and I've written this code to manage the flag system. Essentially, when a block is placed that isn't the flag, its canceled and the player is told. When the flag is placed, (a custom black_banner) Everyone is alerted, and the sideboard starts counting up 1 point every 30 seconds until the flag is removed. If its 1 point a second, this system works fine, but when I go to 30 seconds, the warning it gives when the flag removes is delayed 30 seconds after its been removed! I need it to imediately stop the loop, and immediately notify all teams, not 30 seconds after its removed. I have all the teams listed here in the code, but the first one was my attempt at changing to 30 seconds but keeping the notification instant, and the other three are examples of the script that has worked so far fine with the 1 second loop. I know this was really long, but essentially the issue is that the script doesn't know which loop to stop, when I change the time to 30 seconds, and move the "if" back. So what Im asking is, is there a way to reference that specific loop, or maybe just a better way to do this? Here is my example code:
 

Attachments

  • FLAGSYSTEMcopyforminecraft.sk
    4.2 KB · Views: 45
code_language.skript:
on load: # insert bad counting system
    add 1 to {loads}
    set {_l} to {loads}
    set {_c} to 0
    while {_l} = {loads}:
        wait 1 second
        add 1 to {_c}
        # condition n shi
        
        if {_c} = 30:
            # do shi
 
code_language.skript:
on load: # insert bad counting system
    add 1 to {loads}
    set {_l} to {loads}
    set {_c} to 0
    while {_l} = {loads}:
        wait 1 second
        add 1 to {_c}
        # condition n shi
       
        if {_c} = 30:
            # do shi
Hey, thanks for responding! As mentioned, Im new, and im not entirely sure how this solution works. I understand that "loads" is a variable, but what is it representing in my script? With a little more explanation I think I could understand what you mean.
-Dan
 
Hey, thanks for responding! As mentioned, Im new, and im not entirely sure how this solution works. I understand that "loads" is a variable, but what is it representing in my script? With a little more explanation I think I could understand what you mean.
-Dan
"loads" represents the loads
 
I gathered that much, but what is the variable "loads" representing in the flag/loop scenario? Sorry if I'm missing something obvious!
 
I'm sorry, I don't know what script loads are. I looked it up, but I don't see anything on it. Is it a function or condition? What is the script load in my script? Thank you for your help!
 
Alright bro. I don't want to be frustrated with you, because you have helped me out. But you can be really quite rude. Thank you for your help, I'll get someone else to show me what I need in this case.
-Dan