Closed Mwexim closed 4 years ago
Already suggested nearly a year ago - https://github.com/SkriptLang/Skript/issues/2207
No idea what happened about it. 😦
Already suggested nearly a year ago - #2207
No idea what happened about it. 😦
Sorry, should've done my research. But I think it's good we can finally talk about this. It's something that was in my mind for a long time and especially since I began digging in the skript-parser repository, it came to my mind even more.
This needs to get done imo. Skript currently is such a mess and instead of adding syntax, it should get cleaned up as well. I think the next thing is to loosen the integration with BukkitAPI to enable easier integration with other plugins.
duplicate of #2207
Description
We had it long enough: conditions. Why are they a separate syntax element? Why do conditions in Skript work like this? They are definitely limiting certain approaches that are easy to do in Java.
I don't know if it is suggested already, but I thought it was weird that this didn't change. Why do we have Conditions? Why aren't they integrated as Expressions that return a boolean? Why?
Just to give an example from the
skript-parser
project: click. It works like an Expression, but it uses a certain use case of it (ConditionalExpression). If you go to the ConditionalExpression class, it is actually just a sort of utility class that extends Expression\<Boolean>.Apart from that, conditions work also different in that repository. Instead of the conditions being syntax, it works like
if %boolean%; else if %boolean%; else
. This is Java-like and much more convenient.Pros:
You can create expressions like
not %boolean%
,%boolean% and %boolean%
, and%boolean% or %boolean%
, to mimic the Java operators (!, && and ||) that aren't limited.When you change the system and convert the current conditions into ConditionalExpressions, it won't break any Skript, since the syntax stays the same, but the conditions just work differently.
Easy use cases like
if true
andwhile true
become a thing (maybe this was already supported).You can use Conditions like expressions, for example:
return {var} is 20
. This means that the expression to evaluate conditions can be removed.Cons:
I literally cannot find anything aside from the massive work it will take. Not a difficult job, but a time-consuming one.
Please let me know if I overlooked something, because I'm not one of the contributors here, so I don't know how the structure of Skript works 100%. It can be impossible or maybe it is already integrated in some way I didn't see.