mIRC Home    About    Download    Register    News    Help

Print Thread
WHILE debug #52822 07/10/03 05:44 AM
Joined: Jun 2003
Posts: 114
T
Thray Offline OP
Vogon poet
OP Offline
Vogon poet
T
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.
Re: WHILE debug #52823 07/10/03 09:28 AM
Joined: Feb 2003
Posts: 2,669
Raccoon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,669
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!
Re: WHILE debug #52824 07/10/03 10:24 AM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
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.
Re: WHILE debug #52825 07/10/03 12:03 PM
Joined: Apr 2003
Posts: 210
S
saxon Offline
Fjord artisan
Offline
Fjord artisan
S
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.

Re: WHILE debug #52826 07/10/03 12:47 PM
Joined: Feb 2003
Posts: 810
C
cold Offline
Hoopy frood
Offline
Hoopy frood
C
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
Re: WHILE debug #52827 07/10/03 01:03 PM
Joined: Mar 2003
Posts: 1,271
L
LocutusofBorg Offline
Hoopy frood
Offline
Hoopy frood
L
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
Re: WHILE debug #52828 07/10/03 07:39 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
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?

Re: WHILE debug #52829 08/10/03 12:10 AM
Joined: Feb 2003
Posts: 2,669
Raccoon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,669
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


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Re: WHILE debug #52830 08/10/03 12:28 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
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


-KingTomato
Re: WHILE debug #52831 08/10/03 02:41 AM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
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.

Re: WHILE debug #52832 08/10/03 03:11 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
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.


-KingTomato
Re: WHILE debug #52833 08/10/03 05:32 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
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.

Re: WHILE debug #52834 08/10/03 06:32 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
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.
Re: WHILE debug #52835 08/10/03 06:37 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
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):
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.

Re: WHILE debug #52836 08/10/03 06:46 PM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
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