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 our 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.

Compare list values

Discussion in 'Skript' started by aescraft, Apr 30, 2017.

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

    aescraft Well-Known Member

    Joined:
    Mar 1, 2017
    Messages:
    295
    Likes Received:
    13
    I want to make a slot machine with the minecraft colors.

    This is the slots:
    | A | B | C |
    | D | E | F |
    | G | H | I |

    So, it's 9 slots, and each slot can have one of the 14 out of the 15 minecraft chat colors. (excluded white)

    The issue I have is how to compare the result. I was doing manually and it was already at 300 lines when I gave up. The doc's does not helped me in this case.

    Here the start of the command:

    Code (Skript):
    1. command /cn:
    2.   trigger:
    3.     clear {cn.%player%.resul::*}
    4.     broadcast "&a%player%&r Feels lucky!!!"
    5.     loop 9 times:
    6.       set {cn.%player%.numero} to a random integer between 1 and 14
    7.       if {cn.%player%.numero} is 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9:
    8.         add "%{cn.%player%.numero}%" to {cn.%player%.resul::*}
    9.       if {cn.%player%.numero} is 10:
    10.         add "a" to {cn.%player%.resul::*}
    11.       if {cn.%player%.numero} is 11:
    12.         add "b" to {cn.%player%.resul::*}
    13.       if {cn.%player%.numero} is 12:
    14.         add "c" to {cn.%player%.resul::*}
    15.       if {cn.%player%.numero} is 13:
    16.         add "d" to {cn.%player%.resul::*}
    17.       if {cn.%player%.numero} is 14:
    18.         add "e" to {cn.%player%.resul::*}
    19.     broadcast "|§%{cn.%player%.resul::1}% &&&&r | §%{cn.%player%.resul::4}%&&&&r | §%{cn.%player%.resul::7}%&&&&r |"
    20.     broadcast "|§%{cn.%player%.resul::2}% &&&&r | §%{cn.%player%.resul::5}%&&&&r | §%{cn.%player%.resul::8}%&&&&r |"
    21.     broadcast "|§%{cn.%player%.resul::3}% &&&&r | §%{cn.%player%.resul::6}%&&&&r | §%{cn.%player%.resul::9}%&&&&r |"
    Is there an easy way to compare the lists? I've looked up for a syntax and I could not find it.
    Example of syntax for you to recognize what I mean (this one is from my mind lol):

    Code (Skript):
    1. loop variable list:
    2.   if 9 of the loop-value's are equal to each other:
    3.     #huge prize
    4.   if 8 of the loop-value's are equal to each other:
    5.     #good prize
    6.   if 7 of the loop-value's are equal to each other:
    7.     #prize
    8.   if 6 of the loop-value's are equal to each other:
    9.     #prize
    10.   if 5 of the loop-value's are equal to each other:
    11.     #small prize
    12.   if 4 of the loop-value's are equal to each other:
    13.     #really small prize
    14.   if 3 of the loop-value's are equal to each other:
    15.     #tiny prize
    I want to give prizes for the player when 9, 8, 7, 6, 5, 4 or 3 slots are equal.
    Thanks!
    --- Double Post Merged, Apr 30, 2017, Original Post Date: Apr 30, 2017 ---
    Bump.
     
Thread Status:
Not open for further replies.
Loading...