The reason why your $command alias is not working is because $chan and $nick is not recongnized in the alias, you would have to create a var or call the channel from $active.
As was pointed out to RussellB in
this thread, remote identifiers like $nick, $chan etc
are recognized in aliases. So passing them as parameters to an alias is not only redundant and wasteful but makes the code less readable (it's harder to keep track of what each parameter is in the alias). Storing them to global vars does not have the latter problem, but it is still redundant and even more wasteful.
As I said recently in another thread, if you are not absolutely sure that the error is indeed where you think it is,
please do not make assertive statements before actually testing it yourself. Saying "it
may be that remote identifiers don't work in aliases" would have been OK (although actually testing it and giving the correct answer would be even better). Making it sound like a fact and that you know what you're talking about is misleading to new users, sending them on a wild goose chase.
I'm also surprised that nobody pointed out that
custom identifiers are not meant to be used as commands. In this particular case, $command works because it doesn't return anything. If it did, there
would be errors, since mirc would try to execute the return value of $command. It would be nice if helpers (especially the ones with apparent experience, aka post count) did not just try to fix the OP's particular problem but also give guidelines on good practice. Among other things, this could help prevent future errors.
Regarding the OP's problem:
on @10:TEXT:*o*p*:#:{
var %cmd = $strip($1)
if (%cmd == .deop) mode # -o $nick
elseif (%cmd == .op) mode # +o $nick
}
or if an alias must be used (eg if the above code is used in multiple places), and keeping it as close as possible to the OP's design:
on @10:TEXT:*o*p*:#:{
command .op +o $1
command .deop -o $1
}
alias command {
if ($strip($3) == $1) mode # $2 $nick
}
These are still not perfect, as they don't check whether $nick already has the mode he requested, but that's another story.