Skript icon indicating copy to clipboard operation
Skript copied to clipboard

While All/Any

Open Absolutionism opened this issue 1 year ago • 3 comments

Description

This PR aims to add AND conditions + OR conditions to SecWhile. Allowing users to define multiple conditions to check if the while loop should continue.


Target Minecraft Versions: any Requirements: none Related Issues: #5883

Absolutionism avatar Dec 19 '24 15:12 Absolutionism

While this looks like a good start, I'm going to mark this as draft currently because there are some methodological things to think about (e.g. we have if any/all and while any/all, are there ways we can re-use parts of the multiline condition code? Are there other sections/conditions that might benefit from having something like an any/all? etc.) and it might be worth exploring this a bit more to see if there's anything fancy we can do :)

Moderocky avatar Dec 19 '24 17:12 Moderocky

@APickledWalrus Just wanted to touch base a little. For your suggestion, personally I'm not a fan of having the conditions being defined after the section to execute. Mainly because it doesn't fit. Implementing it wouldn't be hard. But say I have like 20 lines within the code to run, then the conditions afterward makes it seem awkward. However, I do understand the ambiguity of having the [:do] and the actual do section. Maybe we can just come up with an alternative syntax, preferably for the newly added do section to avoid breaking changes, or if you think having this minor breaking change is "ok" then that works too. Some alternatives I was thinking of are: run, execute, trigger. But obviously these are already used elsewhere, leaving words like: perform, process, start, operate, etc. Which some may be fine, others not so much.

Also, regarding @Moderocky 's comment. I would like to say I've fully met the conditions. As only some parts are reused between both SecWhile and SecConditional, and the rest are unique to their behavior. Whether or not the methods I added are good or not, well is up to the teams discretion. The methods I added should cover a general basis if any elements were capable of implementing an any/all, presuming it doesn't fall out of scope of these methods, which then would be unique to an element and/or if shared, then a new method could be added.

Anyways, that about sums it up. Let me know your thoughts.

Absolutionism avatar Dec 21 '24 15:12 Absolutionism

I think

do:
 ...
while:
 a
 b

is much more readable and intuitive than the current order, since it's read in order of execution

sovdeeth avatar Feb 02 '25 17:02 sovdeeth