We usually create an alias with the same name as dialog (or any preferred name). But for this case since
/autojoin is an mIRC built-in command, you should use another name.
alias AJD { dialog $iif(!$dialog(autojoin),-m autojoin, -v) autojoin }
And then just use the
/AJD to run the dialog.