Solved loop help

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

PuchiGFX

Member
Jan 26, 2017
246
5
18
I never use loops, but i'm using loops for a minigame.
I have this "error" and I don't know how to fix it
code:
code_language.skript:
loop {arena::%arg-1%::jugadores::*}:
    if {%loop-value%.bomb} is set:
        if {%loop-value%.bomb} is true:
            send "%first 2 characters of coloured loop-value's prefix%%loop-value%&e exploto!" to {arena::%arg-1%::jugadores::*}
            remove loop-value from {arena::%arg-1%::jugadores::*}
            clear loop-value's inventory
            add loop-value to {arena::%arg-1%::jugadoresm::*}
            set loop-value's gamemode to spectator
error on /sk reload:
code_language.skript:
[22:11:39] [Server thread/INFO]: [Skript] Reloading OdiseanTntTagArenas.sk
[22:11:40] [Server thread/ERROR]: There are multiple loops that match loop-value. Use loop-value-1/2/3/etc. to specify which loop's value you want. (OdiseanTntTagArenas.sk, line 143: if {%loop-value%.bomb} is set:')
[22:11:40] [Server thread/INFO]: [Skript] Encountered 1 error while reloading OdiseanTntTagArenas.sk
 
Last edited:
Do you have more loops than one?
The system can't know which value you mean in two loops, so it wants you to specify them.

Here is an example:
code_language.skript:
loop {list_1::*}:
    loop {list_2::*}:
        loop {list_3::*}:
            send "%loop-value-1%, %loop-index-1%" # Values and indexes of List_1
            send "%loop-value-2%, %loop-index-2%" # Values and indexes of List_2
            send "%loop-value-3%, %loop-index-3%" # Values and indexes of List_3
 
Do you have more loops than one?
The system can't know which value you mean in two loops, so it wants you to specify them.

Here is an example:
code_language.skript:
loop {list_1::*}:
    loop {list_2::*}:
        loop {list_3::*}:
            send "%loop-value-1%, %loop-index-1%" # Values and indexes of List_1
            send "%loop-value-2%, %loop-index-2%" # Values and indexes of List_2
            send "%loop-value-3%, %loop-index-3%" # Values and indexes of List_3
but i want to loop a list ({arena::%arg-1%::jugadores::*}) and check 2 variables
Do you have more loops than one? Yes
 
as i already mentioned you are using more than one loop in the same section, so Skript doesn't know which loop you mean.
Your first loop is "loop {arena::%arg 1%::seconds} times:" which has a value and a syntax, so these are "loop-value-1" and "loop-index-1".
The next loop starts with "loop {arena::%arg-1%::jugadores::*}:", which also has values and indexes, so these are "loop-value-2" and "loop-index-2"

so change your snippet with this one:

code_language.skript:
loop {arena::%arg-1%::jugadores::*}:
    if {%loop-value-2%.bomb} is set:
        if {%loop-value-2%.bomb} is true:
            send "%first 2 characters of coloured loop-value's prefix%%loop-value-2%&e exploto!" to {arena::%arg-1%::jugadores::*}
            remove loop-value-2 from {arena::%arg-1%::jugadores::*}
            clear loop-value-2's inventory
            add loop-value-2 to {arena::%arg-1%::jugadoresm::*}
            set loop-value-2's gamemode to spectator
 
as i already mentioned you are using more than one loop in the same section, so Skript doesn't know which loop you mean.
Your first loop is "loop {arena::%arg 1%::seconds} times:" which has a value and a syntax, so these are "loop-value-1" and "loop-index-1".
The next loop starts with "loop {arena::%arg-1%::jugadores::*}:", which also has values and indexes, so these are "loop-value-2" and "loop-index-2"

so change your snippet with this one:

code_language.skript:
loop {arena::%arg-1%::jugadores::*}:
                if {%loop-value-2%.bomb} is set:
                    if {%loop-value-2%.bomb} is true:
                        send "%first 2 characters of coloured loop-value's prefix%%loop-value-2%&e exploto!" to {arena::%arg-1%::jugadores::*}
                        remove loop-value-2 from {arena::%arg-1%::jugadores::*}
                        clear loop-value-2's inventory
                        add loop-value-2 to {arena::%arg-1%::jugadoresm::*}
                        set loop-value-2's gamemode to spectator
okey, thx!
 
Status
Not open for further replies.