Skript icon indicating copy to clipboard operation
Skript copied to clipboard

Maintain OR list instead of evaluating when using 'item named x or y'.

Open manymade opened this issue 7 months ago • 7 comments

Skript/Server Version

ran on skript 2.10.0 and latest skript 2.11.2

Bug Description

I'm using the Inventory Click Event.

When using the Named Item/Inventory Expression it executes whenever it wants.

Expected Behavior

Should be executing every time.

Steps to Reproduce

command /t:
    trigger:
        give player dirt named "&7Dave"

on inventory click:
    set {_item} to cursor slot of player
    if all:
        # this thing
        {_item} = dirt named "&7Clay", "&7Dave", "&7JD", or "&7Junior"
        event-slot != air
    then:
        cancel event
        send "t"

Errors or Screenshots

No response

Other

No response

Agreement

  • [x] I have read the guidelines above and affirm I am following them with this report.

manymade avatar Jun 16 '25 13:06 manymade

What is the issue with this code?

it executes whenever it wants. Should be executing every time.

These are not exactly clear descriptions, when is it not being executed?

TheMug06 avatar Jun 16 '25 15:06 TheMug06

I think this has to do with you using 'or' in your condition. can you try comparing to 1 item name for testing? if that works can you also try ((dirt named "&7Clay"), (dirt named "&7Dave"), (dirt named "&7JD"), or (dirt named "&7Junior"))

erenkarakal avatar Jun 16 '25 15:06 erenkarakal

What is the issue with this code?

it executes whenever it wants. Should be executing every time.

These are not exactly clear descriptions, when is it not being executed?

Using the code would be more helpful to demonstrate the problem. When you have an item equipped with the cursor and try to click another item. It should keep printing "t" every inventory click. Instead, it prints whenever it feels like it

manymade avatar Jun 16 '25 21:06 manymade

I think this has to do with you using 'or' in your condition. can you try comparing to 1 item name for testing? if that works can you also try ((dirt named "&7Clay"), (dirt named "&7Dave"), (dirt named "&7JD"), or (dirt named "&7Junior"))

This is what's happening, it's working as intended. There's a possible enhancement here with similar syntaxes like world "x", "y", or "z", but the current way skript works requires you to do dirt named x, dirt named y, or dirt named z.

sovdeeth avatar Jun 16 '25 21:06 sovdeeth

Please see the comment from eren, the parser is likely interpreting it as dirt named ("name1", "name2", "name3" or "name4"), picking a random name each time and checking against that, instead of all names.

TheMug06 avatar Jun 16 '25 21:06 TheMug06

I think this has to do with you using 'or' in your condition. can you try comparing to 1 item name for testing? if that works can you also try ((dirt named "&7Clay"), (dirt named "&7Dave"), (dirt named "&7JD"), or (dirt named "&7Junior"))

Checking individual names work and the snippet you provided works great.

manymade avatar Jun 16 '25 22:06 manymade

Initially, i thought it was a way of just checking names with an item type

But this makes sense

So, it would probably be better to compare an item with an item type

Then compare the item's name with a list of strings

manymade avatar Jun 16 '25 22:06 manymade