mIRC Home    About    Download    Register    News    Help

Print Thread
Page 2 of 2 1 2
Joined: Jul 2006
Posts: 4,187
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,187
I found an issue which features the same observation that can be found in most of these while loop issues: a while loop is terminated too early. So I decided to post here, but I actually don't think it's solely a while loop parsing issue, rather a /reseterror and while loop combination. Execute in an editbox:

//var %a action add ajinvite ,%b 1,%c %a | while ($gettok(%a,%b,32)) { var -s %v $v1 | [ $mid($v1,1,1) $++ $mid($v1,2) ] | :error | if ($error) { var -s %c $remtok(%c,%v,32) | reseterror } | inc -s %b } | echo -ag list : %c

I have not tested yet if rewriting this into a multiline, clean, alias works or not. The [ $++ ] fancy part is to prevent mIRC from aborting the execution of a statement from the editbox if it starts with a % or a '$'.
This will execute the command /action first (don't ask why it's built dynamically), causing an error, which is caught by :error and then the error is reset. %b is then correctly increased to 2, however the while loop stops running at this point with the effect similar to the reports above: it skips the loop but still execute the rest of the code, here the /echo.
Tested on 7.77.

Possibly related to these /reseterror reports https://forums.mirc.com/ubbthreads.php/ubb/showflat/Number/269601/ and https://forums.mirc.com/ubbthreads.php/ubb/showflat/Number/270141/


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2002
Posts: 5,493
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,493
Okay, I can see the change that is causing this. However, if I revert it, the previously reported issue will return. I have found an alternative fix that seems to resolve both issues but it is not clear how this would affect backward compatibility. I tested it with my 50+ if/while unit tests, and they all pass. I will include the change in the next beta to see how things go :-)

Joined: Jul 2006
Posts: 4,187
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,187
Great, can you paste in here the units tests list?


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2002
Posts: 5,493
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,493
I'm afraid not, it is over two thousand lines line long. Looking through it again, there are actually 80+ unit tests. Apart from that, the script was not made for public use and I don't currently have the time to review it to make it available.

Joined: Jul 2006
Posts: 4,187
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,187
I do not mind at all about the size/number of lines or if it's made for the public or not, so if that's what is bothering you, just share grin (I also would like to see the regex units tests).


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Page 2 of 2 1 2

Link Copied to Clipboard