|
Joined: Jun 2003
Posts: 114
Vogon poet
|
OP
Vogon poet
Joined: Jun 2003
Posts: 114 |
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
------------- I am the self-appointed God of needlessly complex mIRCscript.
|
|
|
|
Joined: Feb 2003
Posts: 2,812
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 2,812 |
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.
Well. At least I won lunch. Good philosophy, see good in bad, I like!
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
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?
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: Apr 2003
Posts: 210
Fjord artisan
|
Fjord artisan
Joined: Apr 2003
Posts: 210 |
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.
|
|
|
|
Joined: Feb 2003
Posts: 810
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 810 |
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.
* cold edits his posts 24/7
|
|
|
|
Joined: Mar 2003
Posts: 1,271
Hoopy frood
|
Hoopy frood
Joined: Mar 2003
Posts: 1,271 |
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.
DALnet #Helpdesk I hear and I forget. I see and I remember. I do and I understand. -Confucius
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
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?
|
|
|
|
Joined: Feb 2003
Posts: 2,812
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 2,812 |
Because "mIRC Script" doesn't have FOR loops, nor do most languages.  Why don't we add DO loops and UNTIL loops WHILE we're at it.
Well. At least I won lunch. Good philosophy, see good in bad, I like!
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
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
-KingTomato
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
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.
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
lol-- forgot those  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.
-KingTomato
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
Yeah, standard block programming style is that the braces are alone:
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.
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
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.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
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):
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:
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.
|
|
|
|
Joined: Jan 2003
Posts: 3,012
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 3,012 |
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
-KingTomato
|
|
|
|
|