mIRC Home    About    Download    Register    News    Help

Print Thread
#269642 23/11/21 11:54 PM
Joined: Jan 2004
Posts: 2,127
maroon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Possibly related to this post, it appears that nested while's on one line are preventing the /break command from working.

Code
//var %i 5 | while (%i) { var %t $ticks + 1000 | while (%t > $ticks) { noop } | echo -a $asctime i= %i | if (%i == 3) goto label | dec -s %i } | echo -a test1 | :label | echo -a test2


Code
//var %i 5 | while (%i) { var %t $ticks + 1000 | while (%t > $ticks) { noop } | echo -a $asctime i= %i | if (%i == 3) break | dec -s %i } | echo -a test1 | :label | echo -a test2


The 1st command correctly goto's to the label when %i reaches 3.

In old behavior, the 2nd of the above commands did a 'normal' loop exit at the bottom of the loop, immediately after decrementing %i to 4, instead of waiting until %i reached 3.

It should exit the loop immediately after displaying the message showing %i was now 3, but instead it now it repeats the outer while() repeatedly until %i reaches zero.

--

The above issue might be related to the issue of the {} required around the /noop for the inner while, as mentioned in https://forums.mirc.com/ubbthreads....e-loops-on-single-line-issues#Post264499

edit: seems /continue is being ignored same as /break is. The continue should prevent the /echo from being displayed at all:

//var %i 3 | while (%i) { dec -s %i | var %t $ticks + 1000 | while (%t > $ticks) { noop } | continue | echo -a this should not show }

Last edited by Khaled; 12/12/21 10:55 AM.
Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
Thanks this has been fixed for the next version.

Joined: Jan 2004
Posts: 2,127
maroon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Looks like a whack-a-mole. The previously fixed bug exists in 7.67 + 7.68 but is fixed in 7.69

However this new issue was no problem in 7.67 + 7.68 but fails in 7.69

The //command below intentionally has the closing end-brace missing, and works fine in all 3 versions. But as soon as you include the closing end-brace at the very end of the last //command, it goes into an infinite loop of repeating the var -s and the green echo, without ever showing the final echo.

//var -s %foo 5, %bar 0 | echo 3 -a foo | if (%foo) { var %n 123 | while (%n) { if (%n == 5) { var %bar %n | echo 4 -a match | break } | dec %n } | echo -a match at %bar

same thing now happens in an alias while everything is all on 1 line. It seems to loop back to whatever is at the beginning of that same row unless you break it into 2 lines, either immediately prior to "while", or prior to the final end-brace, or anywhere between

edited versions. darn keyboard

Last edited by maroon; 15/08/22 02:49 PM.
Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
Thanks this has been fixed for the next version.


Link Copied to Clipboard