mIRC Home    About    Download    Register    News    Help

Print Thread
#99633 03/10/04 04:22 PM
Joined: Mar 2004
Posts: 33
M
Mc_Fly Offline OP
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Mar 2004
Posts: 33
Try this code (with an error):

Code:
on *:everything:*:if (condition) {
  commands to execute
}


Valid code is of course:
Code:
on *:everything:*:if (condition) {
  commands to execute
} }


If you check brackets status whith { } button, nothing
mIRC don't return error in mIRC Editor, but in status i have /if bracket error

Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
There is no error here. The rule is that for every { you need a closing }.
Note that brackets with a character other than space (and cr/lf) directly next to them are ignored by the parser.

This:
Code:
on *:everything:*:if (condition) [color:blue]{[/color]
  commands to execute
[color:blue]}[/color]

Is correct code, it has the same number of opening { as closing }.

This code, however, is wrong:
Code:
on *:everything:*:if (condition) [color:blue]{[/color]
  commands to execute
[color:blue]}[/color] [color:red]}[/color]

Press the {} button for this code and you'll see that mIRC agrees with me.

There is some odd behaviour here though. First off is that in the following code the echo will never be performed:
Code:
on *:TEXT:*:?:if ( 1 ) {
  echo -a Moo!
}
But in this code it will be:
Code:
on *:TEXT:*:?:[color:blue]{[/color] if ( 1 ) {
  echo -a Moo!
  }
[color:blue]}[/color]

The second oddity is in the way the mIRC handles closing brackets.
It appears to treat them differently depending how many lines they are spread across. To demonstrate:
Code:
on *:TEXT:*:?:{
} } }
alias test { 
  echo -a Moo!
}

In that code /test echos "Moo!", but in the following code it doesn't:
Code:
on *:TEXT:*:?:{
} 
}
}
alias test { 
echo -a Moo!
}

I did search for bug reports about this, but couldn't find any.

Joined: Mar 2004
Posts: 33
M
Mc_Fly Offline OP
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Mar 2004
Posts: 33
in fact, my "valid code" is wrong
i'm agree with your reply except the first, i know all opened bracket are closed, mIRC Editor don't display errors, but their commands will be never executed... The bug isn't of the Editor (like i have say the first time) but the mIRC...
but, you havn't try that i have given:

Code:
;(1) WRONG CODE:
on *:dialog:test:sclick:*:if (1) {
  echo -a OKK
}
;(2) WRONG CODE 2:
on *:dialog:test:sclick:*:if (1) {
  echo -a OKK
} }
;(3) CORRECT CODE:
on *:dialog:test:sclick:*:{ if (1) {
  echo -a OKK
} }

;with, by example:
dialog test {
  size -1 -1 100 100
  button "ok",1,0 0 100 100
}


with the code (1), mIRC don't echo -a OKK, don't return any errors and mIRC Editor say nothing. mIRC don't /echo, this code is wrong, there is a bug.
with the code (2), mIRC don't echo -a OKK, don't return any errors and mIRC Editor say invalid bracket found. mIRC don't /echo, this code is wrong, there is no bug.
with the code (3), mIRC echo -a OKK, don't return any errors and mIRC Editor say nothing. mIRC don't /echo, this code is correct, there is no bug.

If code (1) work, explain why doesn't work with me !!!

No ?


Link Copied to Clipboard