mIRC Homepage
Posted By: MRN Strange bug (if/else) - 08/10/10 11:29 AM
I just came over something strange.

Code:
  if (!$1-) { 
...
  } | else { echo -s blabla2 | halt }

  ; if ($1) { echo -s blabla1 | halt }


If I run that code, no echoes shows up.
If I take away the semicolon "blabla1" shows up.

If there is anything in $1-, execute commands (works).
If there is not anything in $1-, go to "else" and execute commands (doesn't works).

When I put the same statement under, but not in else-sentence, that sentence works. I have no idea why that happens.

If I could supply more info, I could say I'm using timer for this.

Just fixed another strange bug. I cannot start the same alias within an alias. I got the message that /ana.calc wasn't an alias, and that I wasn't connected to a server. I fixed that easily by creating timer.

However, this is a small bug, but I can no longer trust else statements now?

I'm using mIRC 7.1
Posted By: DJ_Sol Re: Strange bug (if/else) - 08/10/10 02:59 PM
Not bug, bad syntax.

Try this:

Code:
if (!$1-) { 
...
  }
else { echo -s blabla2 | halt }
Posted By: MRN Re: Strange bug (if/else) - 09/10/10 06:52 AM
Thanks smile

I know my syntax is bad, but it often works...
Posted By: RusselB Re: Strange bug (if/else) - 09/10/10 08:42 AM
This is a good example, imo, of why scripts should not use pipes (|) to separate commands.
© mIRC Discussion Forums