Check if command argument contains a list of items

  • 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 community!

    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.

Cart

Member
Oct 20, 2020
1
0
1
Been using Java for a few months now, wanted to see what Skript was all about. I'm re-writing one of my Java plugins in Skript and I've hit a wall.

How would I go about creating a check to see if a command argument for <text> exists in a list.

Ex (pseudo-code):

Code:
<my items>:
    switcher:
        lore: the lore
        title: the title
        enchant: the enchant on the item

    slowball:
        lore: the lore
        title: the title
        enchant: the enchant on the item

command /cmd give <player> <number> <text>:
    trigger:
        if argument 1 is <my items>:
            do stuff

Example command with correct format:
/cmd give Cart 10 slowball
[doublepost=1603222628,1603221830][/doublepost]I should note that I want to avoid spaghetti code.
I don't want my Skript to look like this:

Code:
if arg 1 is "item1":
    give player (item argument)

if arg 1 is "item2":
    give player (item argument)

if arg 1 is "item3":
    give player (item argument)
 
Status
Not open for further replies.