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.

Weird loop behavior in 'on script load'? I have no idea

Discussion in 'Skript' started by TheBukor, Feb 27, 2017.

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

    TheBukor Member

    Joined:
    Feb 10, 2017
    Messages:
    23
    Likes Received:
    4
    I'm currently remaking my 3dDrops script but I've run into a weird issue.

    I have the following piece of code:
    Code (Skript):
    1.  
    2. # Stuff...
    3. send "&dLooping - %{_entLoops::*}%" to console
    4. loop {_entLoops::*}:
    5.   send "&f loop. %loop-value-2% ; %entity uuid of loop-value-2% // %{_tiedUUID}%" to console
    6.   if "%entity uuid of loop-value-2%" is "%{_tiedUUID}%":
    7.     send "&f loopFound. was same UUID." to console
    8.     set {_tiedArmStand} to loop-value-2
    9.     exit loop
    10.   send "&dLOOPED - %{_entLoops::*}%" to console
    11. # Stuff...
    12.  
    Notice that the script should send a white debug message (telling me the uuids) right when the loop starts, and another message is sent when the "exit loop" statement is executed (loopFound. was same UUID.)

    The only problem is that this doesn't work 100% of the time. For example, look at this image:

    [​IMG]
    (Intended behavior, it loops through all entities in the list until it finds the one with correct UUID)

    ---------

    Now the following images:
    [​IMG]
    (What? The list has 5 entities, but it only looped through one of them)

    [​IMG]
    (Sometimes the loop is just skipped!)

    --------

    Now please, notice that for the "exit loop" statement to execute, the script HAS to send the "loopFound. was same UUID" message. I get told a lot that "you're exiting the loop", but Skript is clearly skipping some list entries or skipping the loop althogether.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...