Skip to content
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

'If' statements additions #6605

Open
1 task done
MissingReports opened this issue Apr 23, 2024 · 9 comments
Open
1 task done

'If' statements additions #6605

MissingReports opened this issue Apr 23, 2024 · 9 comments
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something. priority: lowest "Nice to have" updates that are not required (tiny low impact bug fixes or QoL enhancements).

Comments

@MissingReports
Copy link

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.
@sovdeeth
Copy link
Member

sovdeeth commented Apr 23, 2024

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

@sovdeeth sovdeeth added enhancement Feature request, an issue about something that could be improved, or a PR improving something. priority: lowest "Nice to have" updates that are not required (tiny low impact bug fixes or QoL enhancements). labels Apr 23, 2024
@sovdeeth
Copy link
Member

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

@MissingReports
Copy link
Author

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

@sovdeeth
Copy link
Member

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)

@MissingReports

This comment was marked as resolved.

@sovdeeth

This comment was marked as resolved.

@MissingReports

This comment was marked as resolved.

@sovdeeth

This comment was marked as resolved.

@Moderocky
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something. priority: lowest "Nice to have" updates that are not required (tiny low impact bug fixes or QoL enhancements).
Projects
None yet
Development

No branches or pull requests

3 participants