-
-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow 'continue' the continue outer loops #6024
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good
could we add some tests for this? |
Tests are a good idea! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using continue loop
without any specific number, the outer-most loop is continued instead of the inner-most.
command test:
trigger:
loop 3 times:
broadcast "%loop-value%"
loop 3 times:
broadcast "- %loop-value-2%"
loop 3 times:
broadcast " - %loop-value-3%"
if loop-value-1 is 2, 5, or 8:
continue loop
[22:56:53 INFO]: 1
[22:56:53 INFO]: - 1
[22:56:53 INFO]: - 1
[22:56:53 INFO]: - 2
[22:56:53 INFO]: - 3
[22:56:53 INFO]: - 2
[22:56:53 INFO]: - 1
[22:56:53 INFO]: - 2
[22:56:53 INFO]: - 3
[22:56:53 INFO]: - 3
[22:56:53 INFO]: - 1
[22:56:53 INFO]: - 2
[22:56:53 INFO]: - 3
[22:56:53 INFO]: 2
[22:56:53 INFO]: - 1
[22:56:53 INFO]: - 1
[22:56:53 INFO]: 3
[22:56:53 INFO]: - 1
[22:56:53 INFO]: - 1
[22:56:53 INFO]: - 2
[22:56:53 INFO]: - 3
[22:56:53 INFO]: - 2
[22:56:53 INFO]: - 1
[22:56:53 INFO]: - 2
[22:56:53 INFO]: - 3
[22:56:53 INFO]: - 3
[22:56:53 INFO]: - 1
[22:56:53 INFO]: - 2
[22:56:53 INFO]: - 3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a quick mild suggest to the pattern, I'd also like to mention the possibility in syntax like continue loop-3
I don't like the current method of forcing nd
, rd
, st
or th
and skript already has syntax similar to continue loop-3
in our loop-value-2
Skript.registerEffect(EffContinue.class, "continue [[this|[the] (%*integer%(st|nd|rd|th)|current)] loop]"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think something like this might be a slightly better design, not only fixes the issue that was brought up about continue loop
being a breaking change currently but seems like a little bit easier design to read this way anything using the number can be treated as it's respectful format
Skript.registerEffect(EffContinue.class, "continue [[this|[the] (%*integer%(st|nd|rd|th)|current)] loop]"); | |
} | |
Skript.registerEffect(EffContinue.class, | |
"continue [[this|the [current]] loop]", | |
"continue [the] %*integer%(st|nd|rd|th) loop" | |
); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think some tests would be good for this as pikachu suggested :)
Ah, thanks for the catch! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done ⚡
Description
This PR adds the ability to continue parent loops from within an inner loop. Loops are numbered from 1 to n and goes from outer to inner. For example:
Target Minecraft Versions: any
Requirements: none
Related Issues: #6012