-
-
Notifications
You must be signed in to change notification settings - Fork 379
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
🚀 Add loop-counter
& Improve loops
#4595
🚀 Add loop-counter
& Improve loops
#4595
Conversation
- loop-value support within while loop is yet to be implemented & current iteration expression as well
- This doesn't yet support getting iteration counter of outer loops - SEEMS like there is a bug with nested while loops, th inner while loop only runs once, haven't tested if this is caused by this PR or before that
Converting to Draft as this is still in progress to support outer loops and look into a while loop bug that is mentioned in the second commit message |
honestly, I'm not sure if I like the syntax or concept . I think @FranKusmiruk's idea of |
That syntax is up-for-debate, the original idea was to shorten this to 1 line instead of using something like this while 1 = 1:
# code
if iteration count > 30:
exit loop |
That is a better alternative, but remember it would need to support multiple loops like loop-value-n does. |
Yes, that's why it's in draft right now 👌 |
Coming back to this, I think the iteration count syntax should be |
This can be an alternative syntax, because the purpose has become a bit bigger, the iteration count should also work for loops like loop {top-players::*}:
iteration count <= 10
# code |
- Added Loop interface - Removed `fails at` syntax - Added loop-(counter|iteration)-X for both normal and while loop - Improved performance for ExprLoopValue (regex pattern) - Improved examples
src/main/java/ch/njol/skript/expressions/ExprLoopIteration.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/expressions/ExprLoopIteration.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/expressions/ExprLoopIteration.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/expressions/ExprLoopIteration.java
Outdated
Show resolved
Hide resolved
loop-counter
to loopsloop-counter
& Improve loops
Co-authored-by: TPGamesNL <29547183+TPGamesNL@users.noreply.github.com>
Co-authored-by: LimeGlass <16087552+TheLimeGlass@users.noreply.github.com>
src/main/java/ch/njol/skript/expressions/ExprLoopIteration.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/expressions/ExprLoopIteration.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/expressions/ExprLoopIteration.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/expressions/ExprLoopIteration.java
Outdated
Show resolved
Hide resolved
Co-authored-by: LimeGlass <16087552+TheLimeGlass@users.noreply.github.com>
…nch/while-fails-at
Co-authored-by: LimeGlass <16087552+TheLimeGlass@users.noreply.github.com>
Description
This PR adds a new feature to loops
loop-(counter|iteration)[-X]
for both normal and while loopUsage example:
Test Code:
Showcase
Thanks to TPGamesNL for helping me with this
Target Minecraft Versions: Any
Requirements: None
Related Issues: