mIRC Homepage

if ($nick == $chr(95))

Posted By: firefox

if ($nick == $chr(95)) - 14/02/11 06:37 PM

if someones nick is _

mirc says invalid if for:

if ($nick == $chr(95))

and

if ($nick == _)

what can I do?
Posted By: Riamus2

Re: if ($nick == $chr(95)) - 14/02/11 07:59 PM

Are you sure you're using the correct $chr() or character? There is more than one underscore character available. Find something that nick says (or when the nick joins/parts/etc) and copy/paste the nick and then use that to get the $chr() value for it and try again.
Posted By: Tomao

Re: if ($nick == $chr(95)) - 14/02/11 08:37 PM

You can copy the exact character and then use
Code:
//echo -a $asc(ChrHere)
to get the numeric value for $chr().
Posted By: firefox

Re: if ($nick == $chr(95)) - 14/02/11 09:54 PM

Originally Posted By: Tomao
You can copy the exact character and then use
Code:
//echo -a $asc(ChrHere)
to get the numeric value for $chr().
gives me 95

* /if: insufficient parameters (line 24, script.mrc)
Posted By: RusselB

Re: if ($nick == $chr(95)) - 14/02/11 10:01 PM

Please post the exact line. I recommend copy & paste so that there's no chance of you accidentally adding or removing characters in your post to make it different from what is in your code. I also recommend using the Code tags around the line so that spaces are preserved.
Posted By: Riamus2

Re: if ($nick == $chr(95)) - 14/02/11 11:18 PM

insufficient parameters would indicate one side of your IF statement is missing (or null). You might want to verify that everything in the IF evaluates to something. If you use $nick, make sure $nick has a value (echo -a Nick: $nick right above the IF line). If you have something else, include that in the echo. Test what you have in both sides of the IF statement. Both sides meaning- if (side 1 == side 2) {}

Beyond that, I'd suggest posting the entire event you're using and any associated aliases so someone can check it for errors.
Posted By: Tomao

Re: if ($nick == $chr(95)) - 14/02/11 11:36 PM

Originally Posted By: firefox
* /if: insufficient parameters (line 24, script.mrc)
That happens when you missed a curly bracket, which is what could have resulted that error:
Quote:
on *:event:*:#: {
if ($nick == $chr(95)) {
;your cmd here
}
}
Posted By: Riamus2

Re: if ($nick == $chr(95)) - 15/02/11 11:02 AM

Ignore the strikethrough part of what I said before. It's incorrect now that I look at it. The error doesn't occur in the case I mentioned.

Originally Posted By: Riamus2
insufficient parameters would indicate one side of your IF statement is missing (or null). You might want to verify that everything in the IF evaluates to something. If you use $nick, make sure $nick has a value (echo -a Nick: $nick right above the IF line). If you have something else, include that in the echo. Test what you have in both sides of the IF statement. Both sides meaning- if (side 1 == side 2) {}

Beyond that, I'd suggest posting the entire event you're using and any associated aliases so someone can check it for errors.
Posted By: firefox

Re: if ($nick == $chr(95)) - 17/02/11 07:15 PM

yeah seems I messed up and removed too many { } when modifying the script - doh!

thanks guys
Posted By: Tomao

Re: if ($nick == $chr(95)) - 17/02/11 08:28 PM

You can get away from receiving an error without brackets or parentheses in three ways, but you can't lose both of them:
Code:
if ($nick == $chr(95)) ;My cmd
Or
Code:
if $nick == $chr(95) { ;My cmd }
And Of course, the traditional way with both intact:
Code:
if ($nick == $chr(95)) { ;My cmd }
It's always a good practice to include the brackets and parentheses whenever possible.
© 2022 mIRC Discussion Forums