the text 'null' would be true, the text '$null' by itself is a false, however when used in the example above (code 1 doing !say $null) it would wrongly return the syntax error message.
No, it wouldn't. $null isn't like $true and $false, since it doesn't return itself: it actually returns a null value.
If you enter "!say $null", both scripts from the example above will message "$null" to the channel.
What you said would happen if a timer was used before checking $2, or scid/scon commands, or $eval($2-,2), because only then mIRC would evaluate "$null" as an identifier, which value is null.
Examples:
/timerblah 1 0 if (! $+ $2-) msg $nick Syntax: !say <your message here>
/if (!$eval($2-,2)) msg $nick Syntax: !say <your message here>
To clarify (sorry if I repeat things too much from now on):
The conditions ($null), (0) and ($false) are false.If you use "if (%blah)" and %blah is $null (really NULL, not the literal text "$null"), 0 or $false (or even the literal text "$false"), the condition will be false.
About the difference between $null/$false/$true and its literal text counterparts - $!null ("$null"), $!false ("$false"), $!true ("$true"):$!null isn't the same as $null.
$!false is the same as $false.
$!true is the same as $true.
About ($1) and (!$1):(!$1) is the same as ($1 == $null) || ($1 == 0) || ($1 == $false). The additional conclusion is that you could add here a "|| ($1 == $!false)" as well, since $false is the same as $!false. That would be pointless, though.
($1) is the same as ($1 != $null) && ($1 != 0) && ($1 != $false). Same thing here, you could add a "&& ($1 != $!false)".
About $null, $false and the example script by genius_at_work:If someone says "!say $null" and your ON TEXT script checks for $2, your $2 won't be $null (the null value represented by the identifier), but rather the literal text "$null" (which is the same as $!null). The same will happen for every other identifier.
However, note that if you use this...
on *:TEXT:!say*:?:{
if (!$2) msg $nick Syntax: !say <your message here>
else msg $nick $2-
}
...and someone says "!say $false", your script will message the syntax warning, since your $2 will be $!false ("$false"), which is the same as $false.
That's something I find difficult to explain in english. I hope it's not too confusing.