Compare list values

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

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

aescraft

Well-Known Member
Mar 1, 2017
295
13
0
36
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_language.skript:
command /cn:
  trigger:
    clear {cn.%player%.resul::*}
    broadcast "&a%player%&r Feels lucky!!!"
    loop 9 times:
      set {cn.%player%.numero} to a random integer between 1 and 14
      if {cn.%player%.numero} is 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9:
        add "%{cn.%player%.numero}%" to {cn.%player%.resul::*}
      if {cn.%player%.numero} is 10:
        add "a" to {cn.%player%.resul::*}
      if {cn.%player%.numero} is 11:
        add "b" to {cn.%player%.resul::*}
      if {cn.%player%.numero} is 12:
        add "c" to {cn.%player%.resul::*}
      if {cn.%player%.numero} is 13:
        add "d" to {cn.%player%.resul::*}
      if {cn.%player%.numero} is 14:
        add "e" to {cn.%player%.resul::*}
    broadcast "|§%{cn.%player%.resul::1}% &&&&r | §%{cn.%player%.resul::4}%&&&&r | §%{cn.%player%.resul::7}%&&&&r |"
    broadcast "|§%{cn.%player%.resul::2}% &&&&r | §%{cn.%player%.resul::5}%&&&&r | §%{cn.%player%.resul::8}%&&&&r |"
    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_language.skript:
loop variable list:
  if 9 of the loop-value's are equal to each other:
    #huge prize
  if 8 of the loop-value's are equal to each other:
    #good prize
  if 7 of the loop-value's are equal to each other:
    #prize
  if 6 of the loop-value's are equal to each other:
    #prize
  if 5 of the loop-value's are equal to each other:
    #small prize
  if 4 of the loop-value's are equal to each other:
    #really small prize
  if 3 of the loop-value's are equal to each other:
    #tiny prize

I want to give prizes for the player when 9, 8, 7, 6, 5, 4 or 3 slots are equal.
Thanks!
[doublepost=1493581300,1493539150][/doublepost]Bump.
 
Status
Not open for further replies.