mIRC Home    About    Download    Register    News    Help

Print Thread
if ($nick == $chr(95)) #229700 14/02/11 06:37 PM
Joined: Sep 2007
Posts: 202
F
firefox Offline OP
Fjord artisan
OP Offline
Fjord artisan
F
Joined: Sep 2007
Posts: 202
if someones nick is _

mirc says invalid if for:

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

and

if ($nick == _)

what can I do?

Re: if ($nick == $chr(95)) [Re: firefox] #229706 14/02/11 07:59 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
Re: if ($nick == $chr(95)) [Re: firefox] #229709 14/02/11 08:37 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
You can copy the exact character and then use
Code:
//echo -a $asc(ChrHere)
to get the numeric value for $chr().

Re: if ($nick == $chr(95)) [Re: Tomao] #229718 14/02/11 09:54 PM
Joined: Sep 2007
Posts: 202
F
firefox Offline OP
Fjord artisan
OP Offline
Fjord artisan
F
Joined: Sep 2007
Posts: 202
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)

Re: if ($nick == $chr(95)) [Re: firefox] #229720 14/02/11 10:01 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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.

Re: if ($nick == $chr(95)) [Re: firefox] #229721 14/02/11 11:18 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
Re: if ($nick == $chr(95)) [Re: firefox] #229722 14/02/11 11:36 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
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
}
}

Re: if ($nick == $chr(95)) [Re: Riamus2] #229726 15/02/11 11:02 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
Re: if ($nick == $chr(95)) [Re: Riamus2] #229811 17/02/11 07:15 PM
Joined: Sep 2007
Posts: 202
F
firefox Offline OP
Fjord artisan
OP Offline
Fjord artisan
F
Joined: Sep 2007
Posts: 202
yeah seems I messed up and removed too many { } when modifying the script - doh!

thanks guys

Re: if ($nick == $chr(95)) [Re: firefox] #229818 17/02/11 08:28 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
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.