Solved Stop 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!

Status
Not open for further replies.
G

Goetheus

Hi everybody!

As titles, I would like to stop a specefic loop and not all the tree.

For exemple:
code_language.skript:
loop 5 times:
    #do stuff
    loop 3 times:
        if {_var} is set:
            #do stuff
        else:
            stop loop-2

Is it possible?!

Thank you in advance!
Kiss <3
 
Hi everybody!

As titles, I would like to stop a specefic loop and not all the tree.

For exemple:
code_language.skript:
loop 5 times:
    #do stuff
    loop 3 times:
        if {_var} is set:
            #do stuff
        else:
            stop loop-2

Is it possible?!

Thank you in advance!
Kiss <3
http://skunity.com/search?search=exit
You would use it as:
code_language.skript:
exit %amount of loops in descnding order% loop(s)

exit 1 loop
# Exits the most current loop.

exit 2 loops
# Exits the current loop and the parent loop.
 
  • Like
Reactions: Goetheus
Hi everybody!

As titles, I would like to stop a specefic loop and not all the tree.

For exemple:
code_language.skript:
loop 5 times:
    #do stuff
    loop 3 times:
        if {_var} is set:
            #do stuff
        else:
            stop loop-2

Is it possible?!

Thank you in advance!
Kiss <3
You can also try adding a counter.

code_language.skript:
loop 5 times:
    add 1 to {_c}
    if {_c} is 3:
        # Do stuff

Idk if this helps you though :emoji_stuck_out_tongue:
 
  • Like
Reactions: Goetheus
Status
Not open for further replies.