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.

Multiple "or"s

Discussion in 'Skript' started by Hibrocolomedio, Jun 18, 2018.

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

    Joined:
    Dec 14, 2017
    Messages:
    18
    Likes Received:
    0
    Skript Version (do not put latest): Skript 2.2 (dev36)
    Skript Author: Bensku
    Minecraft Version: 1.12.2

    So I was making a gamemode switch skript, which looked very similar to this, except there were arguments for a language other from English as well.

    Full Code:
    Code (Skript):
    1. command /gamemode <gamemode>:
    2.     trigger:
    3.         if arg 1 is "survival" or arg 1 is "s" or arg 1 is "0":
    4.             set player's gamemode to survival
    5.             message "Your gamemode has been set to survival." to player
    6.         else if arg 2 is "creative" or arg 1 is "c" or arg 1 is "1":
    7.             set player's gamemode to creative
    Errors on Reload:
    I am currently not at home or somewhere where I can access the server and see the exact error, but it was about it not understanding the "or" expression. After further reading it turns out, that Skript doesn't support multiple arguments for "or".

    Addons using (including versions):
    Skellett 1.9.6B

    Troubleshooting:
    I tried placing the "or" statements into brackets, like below, but they did not work:
    if ( ( ( arg 1 is "survival" ) or ( arg 1 is "s" ) ) or ( arg 1 is "0" ) )

    Have you tried searching the docs? Yes
    Have you tried searching the forums? Yes
    What other methods have you tried to fix it? See: Troubleshooting

    So, is there a solution to this, or do I have to use something like this?

    Code (Skript):
    1. if arg 1 is "creative" or arg 1 is "c":
    2.     set player's gamemode to creative
    3. else if arg 1 is "1":
    4.     set player's gamemode to creative
    It would be nice if this could be avoided.

    Any help would be apprichiated :emoji_slight_smile:
     
  2. Efnilite

    Supporter

    Joined:
    May 12, 2018
    Messages:
    218
    Likes Received:
    15
    Medals:
    What you should do is not use 'or arg 1 is' every time you test for an argument

    Code (Skript):
    1. if arg 1 is "creative" or "c" or "1":
    2.     set player's gamemode to creative
    Full code:
    Code (Skript):
    1. command /gamemode <gamemode>:
    2.     trigger:
    3.         if arg 1 is "survival" or "s" or "0":
    4.             set player's gamemode to survival
    5.             message "Your gamemode has been set to survival." to player
    6.         else if arg 2 is "creative" or "c" or "1":
    7.             set player's gamemode to creative
     
  3. MusicManSK

    MusicManSK Active Member

    Joined:
    Nov 30, 2017
    Messages:
    230
    Likes Received:
    11
    +one new programmer :emoji_grinning::emoji_joy::emoji_joy:
    Code (Javascript):
    1. if ((arg-1 == "survival") || (arg-1 == "s") || (arg-1 == "0")) {}
     
  4. Hibrocolomedio

    Joined:
    Dec 14, 2017
    Messages:
    18
    Likes Received:
    0
    Doesn't work that way either.
     
  5. Efnilite

    Supporter

    Joined:
    May 12, 2018
    Messages:
    218
    Likes Received:
    15
    Medals:
    It should work with just Skript. What version are you using?
     
  6. MusicManSK

    MusicManSK Active Member

    Joined:
    Nov 30, 2017
    Messages:
    230
    Likes Received:
    11
    @Efnilite its maybe not working because you need it like this ""string1", "string2", "string3" or "string4"" not ""string1" or "string2" or "string3" or "string4"".. so try this:
    Code (Skript):
    1. command /gamemode <gamemode>:
    2.     trigger:
    3.         if arg 1 is "survival", "s" or "0":
    4.             set player's gamemode to survival
    5.             message "Your gamemode has been set to survival." to player
    6.         else if arg 2 is "creative", "c" or "1":
    7.             set player's gamemode to creative
    But it maybe should work with only "or"s.. but try
     
  7. Efnilite

    Supporter

    Joined:
    May 12, 2018
    Messages:
    218
    Likes Received:
    15
    Medals:
    It works only with "or"s. I tested it and it worked
     
  8. Hibrocolomedio

    Joined:
    Dec 14, 2017
    Messages:
    18
    Likes Received:
    0
    Thanks, that works!
     
Thread Status:
Not open for further replies.

Share This Page

Loading...