I want to request something like continue loop for loops, because sometimes I had to do some stuff with temporary variables for each check in the loop and check for that variable after all the checks are done, so I think it would be easier if Skript would have something like continue [in loop] or something, which just skips the loop-object which the loop is currently at and continues with the next one.
I hope it gets added.
Cheers.
To you and/or anyone who reads this:
loop <stuff>: or while <condition>: too?Added for next release, but it only supports normal loops as trying to support while loops opened a whole can of worms that is not so easy to fix.
loop idk:
code
loop idk: # this one
code
loop idk:
code
if something:
continue the 2nd loop # the one marked with this one
code
code
code
Would something like this be possible to implement or would it be also too tricky to code? I know the example is pretty poor but I meant something like with the currently working
(exit|stop) \d+ (section|loop|conditional)s
aka for example
stop 2 loops
I guess continue 2 loops would be confusing but I don't have better ideas at the moment to be honest.. or maybe it wouldn't be confusing?
continue loop 1 is less confusing, i could implement it if you agree that syntax is okay
the only confusing part is whether it starts counting from loops with the most indentation or with the least indentation:
loop A:
loop B:
loop C:
would continue loop 1 continue A or C? continuing C would make it kind of consistent with how stop \d+ loops works, but continue loop 1 to me also sounds like "continue the first/main loop".. this issue is full of hard decisions lol
Just for an extra opinion, I think continue loop # continuing the loop at # depth makes by far the most sense (i.e. continue loop 1 continues "A" in Nico's example).
I think it should work like loop-value-%integer%, so just like @TheBentoBox said: loop 1 is the first defined loop, loop 2 the second and so on. Also it might be handy to have something to continue all loops, so maybe a syntax like this: (if someone is going to implement both, the second one is for a specific loop, in @Nicofisi example: continue loop 2 will only continue loop B, while continue 2 loops should continue loop A and B)
continue [(1娄all|%integer%)] loop[s]
continue loop [%integer%]
another question would be, does continuing an outer loop stop all inner loops or does the outer loop run and then the code in the inner loop (after the continue effect) continue to run? For example:
loop 1 and 2:
loop 3 and 4:
loop 5 and 6:
if loop-value-1 is 1:
continue loop 1
broadcast "%loop-value-1%"
should the result be
2
2
2
1 # the code after continue loop 1 continued after the next loop-value in loop 1 finished
1
1
1
or
2
2
2 # the code after continue loop 1 never runs
I'd personally assume it would work like the second example where it stops all inner loops as well, you're continuing to the next iteration of that upper loop which means anything inside of it in the current iteration should be stopped/skipped.
This wasn't fully completed, it doesn't support skipping multiple loops yet.
Oops, sorry.
I'm not sure if this applies here but issue #1380 should be considered here in forethought before adding more functionality with possible undesired effects.
I would not find it very useful to not reset all subordinate loops when skipping back to start of a new loop. So I would agree with TheBentoBox on that.
alright, i fixed the can of worms with while loops above so starting with the next release after #1402 gets merged, the continue effect will support while loops and continuing a specific loop (continue loop %number%)
@Pikachu920 As per your above comment, is this now complete?
it's complete in the incomplete and unmerged #1402
Most helpful comment
I'd personally assume it would work like the second example where it stops all inner loops as well, you're continuing to the next iteration of that upper loop which means anything inside of it in the current iteration should be stopped/skipped.