Wait breaks a loop?

Parsival

Active Member
Reaction score
6
Hi there.
I found out that the 'Wait' action used inside of For loop lets to do next iterations before all actions are done.

Example from my map...
Trigger:
  • Actions
    • For each (Integer A) from 2 to 10 do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Substring((Entered chat string), 7, (Length of (Entered chat string)))) Equal to PlayerID[(Integer A)]
          • Then - Actions
            • Game - Victory (Player((Integer A))) (Skip dialogs, skip scores)
            • --- Integer A is equal to 1 here ---
            • Wait 0.01 seconds
            • --- Integer A is equal to 4 now... ---
            • Multiboard - Set the text for Multiboard item in column 1, row PositionPlayer[(Integer A)] to - Kicked -
            • Skip remaining actions
          • Else - Actions


Any ideas? Thanks!
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
uhmmmm why have the wait? it does nothing there and yes, waits do break GUI loops
 

Parsival

Active Member
Reaction score
6
why have the wait? t does nothing there
Well there is trigger launched after player's leave and it would change the Multiboard's text to - Disconnected -. I want it to be - Kicked -.

But the most important thing:
waits do break GUI loops
Didn't know. And I couldn't find anything about it on the net. Well, is there any way to solve it?
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
do the wait just above the For Loop integer A action, the wait isnt needed between every player check, only the first one
 

Parsival

Active Member
Reaction score
6
But the 'Wait' action is executed only in case the right player is found (inside of 'If').
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
but its executed 1 time... regardless of where its executed it wont make much of a difference
 

Parsival

Active Member
Reaction score
6
You're right. But there are actions after For loop which I don't want to launch when the 'if' is done succesfully. Well, I just need to think for a moment...
Thanks!!
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
It doesnt break the loops.
The loop will work perfectly fine if waits are used inside.

The only problem which could come up is if you use the "integer A" loop anywhere else.
Because if one "Integer A" trigger is currently on pause because of the wait action another trigger could change the value of the global "Integer A" variable in time and the loop will not use correct value anymore.
 

Parsival

Active Member
Reaction score
6
It doesnt break the loops.
The loop will work perfectly fine if waits are used inside.

The only problem which could come up is if you use the "integer A" loop anywhere else.
Because if one "Integer A" trigger is currently on pause because of the wait action another trigger could change the value of the global "Integer A" variable in time and the loop will not use correct value anymore.

Yeah. That's the first thing I thought about when I noticed this bug. But that trigger which is launched after player's leave doesn't use for loops... :<
I will look around for other triggers that may do it.
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
Pick every Player in Force/Unit in Group ... loops DO break with waits inside them (e.g. they don't execute any of the actions after the wait inside the loop).

However, Integer A/B/etc loops don't break. In this case, you may not be telling the game the EXACT thing you want it to do. You're telling it to do one thing, wait, do some more things, then repeat all of that (including the wait) for the next player, and so on. What you probably mean to do, is:

Code:
Do an Integer A loop
    Do some actions, 
Do a Wait
Do an Integer A loop.
    Do some more actions
 

Parsival

Active Member
Reaction score
6
However, Integer A/B/etc loops don't break. In this case, you may not be telling the game the EXACT thing you want it to do. You're telling it to do one thing, wait, do some more things, then repeat all of that (including the wait) for the next player, and so on. What you probably mean to do, is:
Sorry, but I don't get it. I want to make Integer A loop, check if player is right and if not, repeat checking with other Integer A value. If yes, do actions with 'wait' and break the loop by 'Skip remaining actions' action.

EDIT//
Ok, I've changed this loop to Integer B loop and it seems to be working perfectly now. It looks like one of the triggers changes Integer A value every 0.01s. Well, I have completely no idea which one it is, but nvm. Thanks you all guys!
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top