playing around with it more, another solution is just to wrap your literal in $(), that way mirc can properly parse the LHS of your if statement from the RHS without ambiguity:
if ($([username]) == $null)
turns into
if ($() == $null)
which is valid
and that's very readable/obvious code that doesn't really need to be documented.
In fact, I hereby propose that all literal text in if statements should be forcefully wrapped inside $() by the scripter, this would solve all of mIRC's if statement parsing problems.
Consider it like the string quoting that mIRC doesn't have.