-
-
Notifications
You must be signed in to change notification settings - Fork 373
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
Merge conditions and expressions #3838
Merge conditions and expressions #3838
Conversation
Lovely changes! Something that had to be done, possibly way earlier. I’ll give you this link. It is a PR of mine where I fix the parsing issue that still remains (the fact that boolean operators and list literals clash with each other). Do what you want with it, I’ll leave it here for convenience. Also, you might want to look at how skript-parser handles conditional expressions. They aren’t allowed in normal syntaxes, unless the type has a ‘=‘ prefix.
This might be a more clean approach. Conditional expressions can then be called by using something like ‘check if {var} is set’, for example. |
Hey! What's the status of this? |
@Nicofisi There's no progress on this, I've been busy with other stuff and this has lost my attention. I'm also still unsure over the design, for example if all %boolean% (or %object%) should allow conditions by default (and without extra syntax) and if all conditions should be expressions by default. But that is for if I ever pick this up again. |
bd134d0
to
3f08853
Compare
Closing in favor of #6748 |
Description
This PR makes all conditions boolean expressions, and all boolean expressions can be used as conditions (mostly).
Examples
Boolean operations:
if player can fly and player is alive:
But:
does not pass, because it is parsed as
if (({_a} is set) and {_b}) is not set
, where({_a} is set) and {_b}
is a boolean 'and' operation with the condition and the variable. If you use parentheses,if ({_a} is set) and ({_b} is not set):
Also
set {_a} to {_b} is set
set {_x} to player is online
Only limitation is that inline conditions can't be expressions, for example:
doesn't parse, but I'm not even sure if having that would be beneficial.
Target Minecraft Versions: any
Requirements: none
Related Issues: #2207