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

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

TheBukor

Member
Feb 10, 2017
23
4
0
25
I'm currently remaking my 3dDrops script but I've run into a weird issue.

I have the following piece of code:
code_language.skript:
# Stuff...
send "&dLooping - %{_entLoops::*}%" to console
loop {_entLoops::*}:
  send "&f loop. %loop-value-2% ; %entity uuid of loop-value-2% // %{_tiedUUID}%" to console
  if "%entity uuid of loop-value-2%" is "%{_tiedUUID}%":
    send "&f loopFound. was same UUID." to console
    set {_tiedArmStand} to loop-value-2
    exit loop
  send "&dLOOPED - %{_entLoops::*}%" to console
# Stuff...

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:

2eH8cP2.png

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

---------

Now the following images:
lnNE2Vs.png

(What? The list has 5 entities, but it only looped through one of them)

ArzQO2b.png

(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.
 
Status
Not open for further replies.