Skript: starts with condition bug

Created on 16 Aug 2020  ·  5Comments  ·  Source: SkriptLang/Skript

Description


the more ors you have in starts with condition, the smaller chance for the condition to return true, even if the condition is definitely met

Steps to Reproduce

command /teststarts:
    trigger:
        if "1" starts with "1" or "2" or "3" or "4" or "5" or "6" or "7" or "8" or "9":
            send "true"
        else:
            send "false"

Expected Behavior


expected to always be true

Errors / Screenshots


None

Server Information

  • Server version/platform: 1.12.2 Paper
  • Skript version: 2.5beta2

Additional Context

bug completed low

Most helpful comment

What’s happening is - because the contains check only accepts a single text - it is first resolving the (A or B or C) part, so there is only a 1/n chance that it is the matching “1” - perhaps it would be better to put this as a feature request?

Something like if %thing% contains (all|any) of %strings%

(This might need to be adapted, since contains can be for list contains, string contains, etc.)

The contains condition already supports this for strings, there's the (any|all|none) of %texts% contains %texts% pattern. Anyways, marking this one as a bug since the starts with condition should ideally support or lists properly or in general, we may as well add a warning when a user tries to use an or list on a condition that doesn't support them such as this case.

All 5 comments

just tested, the same applies to ends with condition

According to the docs, this doesn't even support or

as You can see, it says "text" not "texts"
Screen Shot 2020-08-16 at 4 05 01 AM

command /teststarts:
    trigger:
                if ("1", "2", "3", "4", "5", "6", "7", "8", "9") contains "1":
            send "true"
        else:
            send "false"

What’s happening is - because the contains check only accepts a single text - it is first resolving the (A or B or C) part, so there is only a 1/n chance that it is the matching “1” - perhaps it would be better to put this as a feature request?

Something like if %thing% contains (all|any) of %strings%

(This might need to be adapted, since contains can be for list contains, string contains, etc.)

What’s happening is - because the contains check only accepts a single text - it is first resolving the (A or B or C) part, so there is only a 1/n chance that it is the matching “1” - perhaps it would be better to put this as a feature request?

Something like if %thing% contains (all|any) of %strings%

(This might need to be adapted, since contains can be for list contains, string contains, etc.)

The contains condition already supports this for strings, there's the (any|all|none) of %texts% contains %texts% pattern. Anyways, marking this one as a bug since the starts with condition should ideally support or lists properly or in general, we may as well add a warning when a user tries to use an or list on a condition that doesn't support them such as this case.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wohahobg picture wohahobg  ·  3Comments

ghost picture ghost  ·  3Comments

TheClassic36 picture TheClassic36  ·  3Comments

Snow-Pyon picture Snow-Pyon  ·  4Comments

Romitou picture Romitou  ·  3Comments