mIRC Homepage
Posted By: eawedat Checking Identifiers - 18/11/11 06:07 PM
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.
Posted By: starbucks_mafia Re: Checking Identifiers - 18/11/11 07:00 PM
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.
Posted By: eawedat Re: Checking Identifiers - 18/11/11 09:12 PM
Got it,,
or I could use if ($4) { }
thanks a lot starbucks_mafia.
Posted By: qwerty Re: Checking Identifiers - 18/11/11 09:46 PM
Not really. if ($4) fails if $4 is 0 or $false too.
Posted By: eawedat Re: Checking Identifiers - 18/11/11 09:52 PM
right , I missed that:)
Posted By: Riamus2 Re: Checking Identifiers - 18/11/11 11:48 PM
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
Posted By: hixxy Re: Checking Identifiers - 21/11/11 07:10 PM
Or 00, 000, 0000, etc after a recent change :p

[/pedant]
© mIRC Discussion Forums