Page 1 of 1
Screen freezes about 30 seconds after exiting repeat loop
Posted: Mon Jun 09, 2025 1:08 pm
by CAsba
Hi,
I set up a repeat loop, 'repeat until fld "temp56" is 0', with a -1 negative adjustment to the value of fld "temp56" on each repeat. It works fine, negotiating a multitude of conditions, all correctly done. Then, when all is done (the loop moved lines of data from a DG to another DG), the screen freezes - that is, the screen greys out if the user tries to continue, for around 30 seconds. To try to troubleshoot what is happening, I inserted a line 'answer "...."' after the 'end repeat' line and before the 'exit mouseup' line; this line of script was never actioned. Any ideas anyone ?
Re: Screen freezes about 30 seconds after exiting repeat loop
Posted: Mon Jun 09, 2025 3:02 pm
by stam
Personally I would insert a break point inside the loop and iterate a small number of time while watching each variable. Since this is not common behaviour it’s likely something with your code and following the code execution step by step is usually illuminating.
Alternatively, you could post your code here…
Re: Screen freezes about 30 seconds after exiting repeat loop
Posted: Mon Jun 09, 2025 3:51 pm
by richmond62
I inserted a line 'answer "...."' after the 'end repeat' line and before the 'exit mouseup' line; this line of script was never actioned.
This would seem to suggest that your repeat loop is going round in circles forever.
I am extremely skilled at doing this sort of thing: forgetting to insert something into my repeat loops so they stop repeating once some condition has been satisfied.
Re: Screen freezes about 30 seconds after exiting repeat loop
Posted: Mon Jun 09, 2025 4:52 pm
by dunbarx
CAsba.
the screen freezes - that is, the screen greys out if the user tries to continue, for around 30 seconds.
And this happens after your code does what was intended??? This seems
much different an issue than that your loop simply does not exit. Can you post the stack, or at least enough of it for us to examine?
Craig
Re: Screen freezes about 30 seconds after exiting repeat loop
Posted: Mon Jun 09, 2025 5:41 pm
by SparkOut
Quite possibly the loop exit condition is not met because the subtraction of 1 per iteration is done with floating point arithmetic and the nearest the value gets to zero is only ever a very close approximation. Try making the repeat until check less than or equal to zero, not "exactly zero".
Also try adding a "wait 0 milliseconds with messages" line inside the repeat loop.
Re: Screen freezes about 30 seconds after exiting repeat loop
Posted: Mon Jun 09, 2025 6:42 pm
by FourthWorld
Without an example stack we're just guessing. With one we can probably resolve this in minutes.
Re: Screen freezes about 30 seconds after exiting repeat loop
Posted: Mon Jun 09, 2025 8:02 pm
by dunbarx
What everyone said, but I am still worried about what I said, that is, the issue is spookier than simply a failure to exit a loop. That would seem like a "hang", not a greying out of the screen for half a minute.
Craig
Re: Screen freezes about 30 seconds after exiting repeat loop
Posted: Mon Jun 09, 2025 10:00 pm
by richmond62
I wonder if for some reason LC wasn't displaying the backdrop.
Re: Screen freezes about 30 seconds after exiting repeat loop
Posted: Tue Jun 10, 2025 8:48 am
by CAsba
Thanks everyone, I'll check out the 'zero' possibility. I made a workaround having discovered that the 'hang' occurs just before the processing of the last iteration. So I finish the loop before the last iteration, Repeat until check equals one, then do the last processing outside the loop. There was just too much coding, with references to other DG's to present the code.
Once again, thank you all for your interest.
Re: Screen freezes about 30 seconds after exiting repeat loop
Posted: Tue Jun 10, 2025 10:20 am
by richmond62
I wish I could understand your reply: but I cannot.
Re: Screen freezes about 30 seconds after exiting repeat loop
Posted: Tue Jun 10, 2025 2:30 pm
by dunbarx
CAsba.
I am with Richmond here. Are you saying that your repeat loop can successfully exit when the index counts down to 1, but cannot exit if the loop continues to count down one more iteration to zero?
I gotta see that code.
Craig