mIRC Homepage
Posted By: Wims $? problem - 29/08/09 11:39 PM
If I miss the first " with $? :

//if ($?try it") echo -a ok | else echo -a ok1

mirc see it as $?, and then display "* /if: invalid format".
If I miss the second " :

//if ($?"try it) echo -a ok | else echo -a ok1

mirc just take it as a /halt command

I think that both exemple should return an error about $? syntax
Posted By: Wims Re: $? problem - 30/08/09 04:21 PM
I have missed the '=' in my test (syntax is $?="text"), but it does not change anything.
Posted By: genius_at_work Re: $? problem - 02/09/09 03:02 PM
Code:

//if ($?="try it") echo -a ok | else echo -a ok1



Works fine here.
Posted By: Wims Re: $? problem - 02/09/09 07:01 PM
Of course, you're using the right syntax, I'm saying mirc should report an syntax error when I use $? incorrectly
Posted By: argv0 Re: $? problem - 02/09/09 07:38 PM
$?try is valid
$?=try is valid

The problem only occurs when there is an unbalanced number of "'s in the call.

mIRC will either take the first full word succeeding the "$?", ignoring an = if it is the first character. Consider the following:

//echo -a $?try
//echo -a $?=try
//echo -a $?==

Here's the important part: if it encounters a " it will ignore all the previous characters and start fresh until it finds the ending "

//echo -a $?try" harder" ; shows "harder" as the message

It looks until the end of the line (or next `|`) for the ending ". If it doesn't find it it silently errors out. It could show an error message for this instead, but it's certainly not a "bug". The behaviour is quite undefined and there are hundreds of places where syntax errors cause silent halting of scripts, in mIRC.

For completeness, this explains why your example works in the first case and not the second. ($?try it") is just "RESULTS OF $?try followed by `it"`, `it"` being an invalid operator.

The second one is that missing " case we were just talking about, which is why its problematic. If you had tryit without a space, both cases would fail.

Posted By: Wims Re: $? problem - 02/09/09 08:21 PM
Quote:
It could show an error message for this instead, but it's certainly not a "bug".The behaviour is quite undefined and there are hundreds of places where syntax errors cause silent halting of scripts, in mIRC.
Yeah, an error message in such case is what I'm talking about.
Quote:
there are hundreds of places where syntax errors cause silent halting of scripts
Like ?
Posted By: argv0 Re: $? problem - 03/09/09 04:28 AM
Although not technically a silent "halting":

Code:
//if (0) { shh } else { echo -a hi }


Of course there's also:

Code:
if (1 == 1) { echo -a hi } }
echo -a hi


Again, not quite "halting":

Code:
; this works without the space
menu nicklist, channel {
  MENUITEM:echo -a hi
}


I should modify "halting" to mean "breaking". There are plenty of other examples where mIRC could/should/would give some kind of error but doesn't.
Posted By: DJ_Sol Re: $? problem - 03/09/09 05:03 AM
I think the error message is sufficient considering the many different types of errors it encompasses. When it gives me that error with a line number its pretty easy to figure out what is wrong.
© mIRC Discussion Forums