1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Argument with multiple routes

Discussion in 'Skript' started by ConLudi, Jul 17, 2020.

Thread Status:
Not open for further replies.
  1. ConLudi

    ConLudi Member

    Joined:
    Jan 23, 2020
    Messages:
    43
    Likes Received:
    0
    Hello, I would like to make a way to have 1 argument that leads to "text" and a "item stack".
    Here is a bit of my code:

    Code (Text):
    1.  
    2. command /item [<item>|<text>] [<integer>]:
    3.  
    I already looked at https://forums.skunity.com/threads/multiple-commands-with-the-same-route-command-but-with-different-arguments.3508/, it didn't help, ([<item>|<text>] doesn't work
    --- Double Post Merged, Jul 17, 2020, Original Post Date: Jul 17, 2020 ---
    Bump
    --- Double Post Merged, Jul 18, 2020 ---
    Bump!!

     
  2. Best Answer:
    Post #8 by FusionCore, Jul 19, 2020
  3. FusionCore

    Supporter

    Joined:
    Apr 19, 2020
    Messages:
    44
    Likes Received:
    1
    I usually do something like this:

    Code (Text):
    1. command /blah [<text>]:
    2.   trigger:
    3.     if whatever:
    4.       set {_c} to arg-1 parsed as an item
    5.     else:
    6.       set {_c} to arg-1
    7.     continue..
     
  4. ConLudi

    ConLudi Member

    Joined:
    Jan 23, 2020
    Messages:
    43
    Likes Received:
    0
    Yeah, but I'm trying to do something like this:

    Code (Text):
    1.  
    2.         if arg 1 is set:
    3.             if arg 1 is "command":
    4.                 if arg 2 is between 1 and 1000:
    5.                     send "&cYou received &f%arg 1%"
    6.                     set {_num} to 0
    7.                     stop
     
  5. FusionCore

    Supporter

    Joined:
    Apr 19, 2020
    Messages:
    44
    Likes Received:
    1
    Why would you need item in it?
     
  6. ConLudi

    ConLudi Member

    Joined:
    Jan 23, 2020
    Messages:
    43
    Likes Received:
    0
    To give a user an item
     
  7. FusionCore

    Supporter

    Joined:
    Apr 19, 2020
    Messages:
    44
    Likes Received:
    1
    Code (Text):
    1. give player (arg-1 parsed as an item)
     
  8. ConLudi

    ConLudi Member

    Joined:
    Jan 23, 2020
    Messages:
    43
    Likes Received:
    0
    It's not working for me :/ can you help me

    Code (Text):
    1.  
    2. command /item [<text>] [<integer>]:
    3.     permission: admin
    4.     permission message: &cLol no
    5.     trigger:
    6.         if arg 1 is not set:
    7.             send "&4Error: &c/item <item> <amount>"
    8.             stop
    9.         if arg 1 is set:
    10.             if arg 1 is "dirt2":
    11.                 if arg 2 is between 1 and 1000:
    12.                     send "&cYou received &f%arg 1%"
    13.                     give player dirt parsed as an item
    14.                     stop
    15.         if arg 1 is set:
    16.             if arg 2 is between 1 and 1000:
    17.                 send "&cYou received &f%arg 1%"
    18.                 give player arg-1 parsed as an item
    19.                 stop
    20.             if arg 2 is not between 1 and 1000:
    21.                 send "&4Error: &cYou can only give yourself 1 - 1,000 items!"
    22.                 stop
     
  9. FusionCore

    Supporter

    Joined:
    Apr 19, 2020
    Messages:
    44
    Likes Received:
    1
    Fixed your code:

    Code (Text):
    1. command /item [<text>] [<integer>]:
    2.     permission: admin
    3.     permission message: &cLol no
    4.     trigger:
    5.         if arg-1 is not set:
    6.             send "&4Error: &c/item <item> <amount>"
    7.         else:
    8.             if arg-1 is "dirt2":
    9.                 if arg-2 is between 1 and 1000:
    10.                     send "&cYou received &f%arg-1%"
    11.                     loop arg-2 times:
    12.                         give dirt to player
    13.             if arg-2 is between 1 and 1000:
    14.                 send "&cYou received &f%arg 1%"
    15.                 loop arg-2 times:
    16.                     give (arg-1 parsed as an item) to player
    17.             if arg-2 is not between 1 and 1000:
    18.                 send "&4Error: &cYou can only give yourself 1 - 1,000 items!"
     
  10. ConLudi

    ConLudi Member

    Joined:
    Jan 23, 2020
    Messages:
    43
    Likes Received:
    0
    It works, but if you type in "askjdgasjhdhasjd" or anything, it tells you that you got "askjdgasjhdhasjd".
     
  11. FusionCore

    Supporter

    Joined:
    Apr 19, 2020
    Messages:
    44
    Likes Received:
    1
    Then check if its a valid item.
    Code (Text):
    1. if (arg-1 parsed as an item) is not an item:
    2.   send "Blah"
     
  12. ConLudi

    ConLudi Member

    Joined:
    Jan 23, 2020
    Messages:
    43
    Likes Received:
    0
    Thank you! It worked!
     
  13. FusionCore

    Supporter

    Joined:
    Apr 19, 2020
    Messages:
    44
    Likes Received:
    1
    Set my answer as best if you want
     
Thread Status:
Not open for further replies.

Share This Page

Loading...