I'd use this:
alias away {
if $1 == -g {
var %a = $2-
scon -at1 !away % $+ a
}
else away $1-
}
1) I can't stress this enough... using $1-, $2-, $did(), $input() and generally variables/identifiers of unknown content in /scon -a is not a good idea. /scon adds an extra evaluation level. This can lead to unwanted evaluations which, in the worst case, can even be dangerous. For example, if one typed //away $!me is away, one would expect the away message to be "$me is away" but in fact it will be "cold is away". Now imagine that with something as nasty as $findfile()...
I used % $+ a, so that the command executed across networks will be "!away %a" and not "!away <evaluated $2->".
2) The
-t1 switch is necessary if you don't want mirc to halt with an error if one of the sessions isn't connected.
3) Minor detail, but you don't need the exclamation mark for the first /away, as it is a fact that an alias cannot call itself directly. So any /away command within the alias will be treated as the default mirc command. This is not the case with /scon though, so the ! is necessary there.