Solved If statement behaves differently in on craft event and command event

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

grindser

Member
Sep 14, 2021
14
0
1
23
I've got an on craft event that checks whether or not an item can be found in an array, however, the if statement will always output the false statement. When making a command with the exact same code, I get the expected results.

Code:
command /check <text>:
    trigger:
        if {list::*} contains arg-1:
            send "Legal"
        else:
            send "Illegal"

on craft:
    send "Checking if %event-item% can be found in the array"
    if {list::*} contains event-item:
        send "Legal"
    else:
        send "Illegal"

The command will output "Legal" if the item name can be found, but the on craft event will always output "Illegal"
 
I've got an on craft event that checks whether or not an item can be found in an array, however, the if statement will always output the false statement. When making a command with the exact same code, I get the expected results.

Code:
command /check <text>:
    trigger:
        if {list::*} contains arg-1:
            send "Legal"
        else:
            send "Illegal"

on craft:
    send "Checking if %event-item% can be found in the array"
    if {list::*} contains event-item:
        send "Legal"
    else:
        send "Illegal"

The command will output "Legal" if the item name can be found, but the on craft event will always output "Illegal"
I think that the issue is that on the second part of the code, you need to replace event-item with "%event-item%" because it can't know if it's a string or not.
 
Status
Not open for further replies.