mIRC Homepage
Posted By: Thray WHILE debug - 07/10/03 05:44 AM
This would come in handy for people who just flatout can not write WHILE statements because they are used to FOR statements and can not remember to add something to change the case.

A while loop parameter that makes it stop automatically after a certain number of runs.. so it can't just go infinitely.

This may slow down the while command.. so maybe add WHILEDEBUG or something.. just something that you can later find+replace
Posted By: Raccoon Re: WHILE debug - 07/10/03 09:28 AM
Or if you forget to /inc %i and find that your loop doesn't end, simply press and hold CTRL+SCRLLOCK until the script stops.
Posted By: starbucks_mafia Re: WHILE debug - 07/10/03 10:24 AM
If the person remembered to use whiledebug wouldn't they also remember the reason why they were using it in the first place and just remember to create their loop correctly?
Posted By: saxon Re: WHILE debug - 07/10/03 12:03 PM
It seriously wouldn't be worth adding a debug just for a simple WHILE loop. It would probably be easier and less code to just add a FOR loop, for people who prefer it.
Posted By: cold Re: WHILE debug - 07/10/03 12:47 PM
Just add something to change the case before adding anything to the loop. You'd do the exact same thing with the FOR loop. It's simply a matter of practising.
Posted By: LocutusofBorg Re: WHILE debug - 07/10/03 01:03 PM
Actually, an infinite while loop would prevent you from being able to do anything with mIRC, including switching the active window to the debug window.

Also, ctrl+break will terminate the loop.
Posted By: codemastr Re: WHILE debug - 07/10/03 07:39 PM
Well then instead of making a while loop that acts kinda like a for loop, why not just add for loops as has been suggested many, many times?
Posted By: Raccoon Re: WHILE debug - 08/10/03 12:10 AM
Because "mIRC Script" doesn't have FOR loops, nor do most languages. smirk

Why don't we add DO loops and UNTIL loops WHILE we're at it.

crazy
Posted By: KingTomato Re: WHILE debug - 08/10/03 12:28 AM
Quote:
Because "mIRC Script" doesn't have FOR loops, nor do most languages.


Excuse me? Most languages? Let me name a few whom do:

C
C++
C#
Pascal
Delphi
Java
BASIC
Visual Basic
VB.NET
Perl
PHP (Tho used for web application, none the less a language)

Do you want more? Please do name your "most languages" pls
Posted By: codemastr Re: WHILE debug - 08/10/03 02:41 AM
Mind if I add a couple of others?

Ruby
Javascript
Ada
Algol
DOS batch files
(*nix) Shell scripts
Python
AppleScript (it calls it a 'repeat in' loop, but it is essentially the same thing)
Modula2
TCL

The only languages I can think of that don't have for loops are languages that have no loops, things such as COBOL, assembly, lisp, prolog, etc. But like I say, they don't have any loops. If you need to do a loop, you use goto (or in assembly, a jump) and labels. I'm sure there are a handful of languages that have while loops, but no for loops, however I'd be willing to bet for every 1 language you can find that doesn't have for loops I can find 5 that do. Oh and btw, I'd also like to see do while loops in mIRC.
Posted By: KingTomato Re: WHILE debug - 08/10/03 03:11 AM
lol-- forgot those blush

I'd love to see Do while's also. >:D Another thing that might be hard to impliment, and is kinda trivial, but the ability to have braces on their own line. That, to me, would be nice and orderly.
Posted By: codemastr Re: WHILE debug - 08/10/03 05:32 PM
Yeah, standard block programming style is that the braces are alone:
Code:
alias blah
{
   if ($1)
   {
      echo yes
   }
   else
   {
      echo no
   }
}


Using the old "K&R" style is not recommended since it makes things harder to read.
Posted By: starbucks_mafia Re: WHILE debug - 08/10/03 06:32 PM
Well I don't want to get in a coding style debate but I find that having the opening brace on a separate line only serves to make me scroll more. Indentation is what makes code readable in my experience.
Posted By: codemastr Re: WHILE debug - 08/10/03 06:37 PM
Yes indentation is crucial, no doubt about that, but the thing is consider this (sorry for the really long line, but it's necessary to show my point):
Code:
if (something-that-is-really-long-and-makes-it-so-a-horizontal-scroll-bar-appears-on-the-screen-and-therefore-the-brace-is-only-seen-if-you-scroll-to-the-right) {
   echo -a yes
}

In that instance, the { isn't seen since it's off the screen. However if it were:
Code:
if (something-that-is....)
{
   echo -a yes
}


Then the { is easily seen. But, I guess we could always just use $& although imho that just makes it ugly.
Posted By: KingTomato Re: WHILE debug - 08/10/03 06:46 PM
If Khaled has allows multi-line comments, i dont seen adding the parsing capability of braces on a sperate line to be hard at all. I could be wrong
© mIRC Discussion Forums