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.

Solved Or in Skript?

Discussion in 'Skript' started by Noblesuntzu, Aug 3, 2017.

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

    Noblesuntzu Active Member

    Joined:
    Feb 18, 2017
    Messages:
    63
    Likes Received:
    4
    Super simple question, just wonder how to use 'or' in Skript? Is this not possible? I tried using the word or and || but it couldn't parse it. (Like my entire server wouldn't load because of it) I really need exactly this and not an if and else if statement (the code below this is extremely large so...) Anyway, thanks!

     
  2. Best Answer:
    Post #9 by ShaneBee, Aug 3, 2017
  3. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    Can you post the code of what you're trying to do? You mention it in your post but there's nothing below.
    The use for or is to work with a list. "a" or "b" or "c". but if that's not what you mean a little more context would help yeah:emoji_slight_smile:
     
  4. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    if a is true or b is true:
     
  5. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    Can you just post your code or maybe an example code of what you're trying?
     
  6. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    the syntax would be if "a" or "b" is true. the boolean has to come last.
     
    • Agree Agree x 1
  7. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    Can you check for different outputs though? Like
    if a is "Text" or b is 5
     
  8. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    Just use two different conditions
     
    • Like Like x 1
  9. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    Yeah but like I said an enormous amount of code is using this condition so I'd have to double it and I'm constantly making changes to this code so I'd have to copy it over each time.
     
  10. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    Unless you post that code per the help format, dude, we can really only guess at how to help you. If it's something that is executed on your code repeatedly, you may consider turning it into a function.
     
  11. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    Okay well I kinda just thought there'd be a simple solution (I mean why isn't this a thing lol) but all your solutions were very helpful. So thanks guys <3
     
    • Friendly Friendly x 1
  12. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    skript doesn't have or/and operators
     
  13. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    Code (Skript):
    1.  
    2. command /lamTest [<text>]:
    3.     trigger:
    4.         if (check [arg 1 contains "text"]) or (check [arg 1 parsed as number is 5]) is true:
    5.             message "test"
    6.  
     
  14. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    Check should be avoided
     
    • Like Like x 1
  15. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    Why is that?

    Just wondering. I just found it can be used as a nice work-around.
     
  16. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    iirc their badly (lambdas in general) and they break with skript-mirror (sometimes). skQuery as a whole isn't recommended from it's dev
     
Thread Status:
Not open for further replies.

Share This Page

Loading...