Skript

Skript

743k Downloads

'If' statements additions

MissingReports opened this issue ยท 9 comments

commented

Suggestion

When making 'or' or 'and' conditions in Skript you do something like this

if all:
    true is true
    false is true
then:

This is great and all until you need an 'or' and an 'and' in one condition, this forces you to make a pyramid of doom or do something similar to this

if any:
    true is false
    true is true:
then:
    set {_execute} to true

if all:
    {_execute} is true
    # other condition
then:

I understand that Skript cannot use 'and' and 'or' for that because lists already use that syntax

set {_list::*} to "hello" or "blah" <-- random choice

if "bob" is "hello" or "bob" <-- supports 'or' because that condition takes a list as input not a single expression

if true is true or true is false <-- you cannot do that

However, Skript doesn't use | or & so that can be used to identify and / or conditions. Example:

if true is false | true is true <-- or statement

if true is true & true is false <-- and statement

And it would be nice if you could directly do "if true:"

function isTrue() :: boolean:
    return true

if isTrue() <-- won't work

if isTrue() is true <-- will work

This is a thing in almost all programming languages because it makes sense, a condition is true or false and false means not to continue execution and true is the opposite

Why?

It will really clean up some code in specific scenarios where you want multiple and / or in conditions

The 'true' thing would just be nice to have since it's really not fun to switch from something like Java to Skript and always forgetting "is true"

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this suggestion.
commented

I'm strongly against adding multiple conditions in one line. However, as a substitute, perhaps the following?

if any:
 a
 b
or/and if all:
 b
 c
then:
 d
commented

As far as the not needing is true thing, duplicate of #2207

commented

I'm strongly against adding multiple conditions in one line. However, as a substitute, perhaps the following?

if any:
 a
 b
or if all:
 b
 c
then:
 d

That would work as well but I really don't see why multiple conditions in one line is bad

commented

I'm strongly against adding multiple conditions in one line. However, as a substitute, perhaps the following?

if any:
 a
 b
or if all:
 b
 c
then:
 d

That would work as well but I really don't see why multiple conditions in one line is bad

It's very difficult for the parser to parse (very long reload times)

commented

As far as the not needing is true thing, duplicate of #2207

image

commented

As far as the not needing is true thing, duplicate of #2207

image

yes? what do you mean by this?

commented

Oh, I thought u said it already exists.

commented

Oh, I thought u said it already exists.

nah, just that there's already an issue requesting it.

commented

I'm strongly against adding multiple conditions in one line. However, as a substitute, perhaps the following?

if any:
 a
 b
or/and if all:
 b
 c
then:
 d

I think the mid-way split looks messy and I don't like it. Maybe we could see if there's a nicer way to support this within check/switch.