mIRC should add a per-connection static identifier named $servergroup that preserves knowledge of the server group that was connected to. This would eliminate need for $server($server).group which is the current wisdom and ineffective as shown above.
This is working consistently with the design, $server($servertarget) can be used in the case of random server, there's nothing ineffective in there, mIRC would be the one doing the job of checking if $server($server).group is empty and then checking $server($servertarget).group, scripters can check that by themselves fine already.

But that does not make the suggestion any worse, I just think mIRC did well in the past by not creating new identifiers name for things which belong together. I don't think adding new identifiers starting with $server* is a good idea, they should all be available as a single identifier with properties, which is why I mentioned $server() with no parameter and just properties (but $server(-1).prop works just as well for me), to get the current server's infos.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel