mIRC Home    About    Download    Register    News    Help

Print Thread
#234983 18/11/11 06:07 PM
Joined: Nov 2011
Posts: 52
E
eawedat Offline OP
Babel fish
OP Offline
Babel fish
E
Joined: Nov 2011
Posts: 52
hey all,

How could I check if Identifiers are set?(not empty)

Code:
 if ($2 != "") && ($3 != "") && ($4 != "") {
    msg $chan $2
    msg $chan $3
    msg $chan $4
  }


what's wrong with the code above?

thanks.

Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
mIRC scripting doesn't use quoted strings (with a few exceptions); to check if a value is empty compare it with $null, ie., $4 != $null.

That said, the way mIRC's tokenization works (the way it fills $1, $2, etc.) prevents empty tokens from being allocated. So if $4 != $null then $1, $2, and $3 cannot possibly be $null either - therefore there is no need to check those.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Nov 2011
Posts: 52
E
eawedat Offline OP
Babel fish
OP Offline
Babel fish
E
Joined: Nov 2011
Posts: 52
Got it,,
or I could use if ($4) { }
thanks a lot starbucks_mafia.

Last edited by eawedat; 18/11/11 09:32 PM.
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Not really. if ($4) fails if $4 is 0 or $false too.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Nov 2011
Posts: 52
E
eawedat Offline OP
Babel fish
OP Offline
Babel fish
E
Joined: Nov 2011
Posts: 52
right , I missed that:)

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Of course, if you know your data won't include 0 or $false or if those will also be treated like $null in your script, then you can safely use that. smile


Invision Support
#Invision on irc.irchighway.net
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Or 00, 000, 0000, etc after a recent change :p

[/pedant]


Link Copied to Clipboard