For the timer you're using to check the lag, just simply add "scid $!activecid" to the front of the alias...
Example:
/.timerLag 0 5 scid $!activecid /checklag

This will make sure that the command is triggered on the active connection.

Also, look at this line from the mIRC help file...

/timer[N/name] [-ceomhipr] [time] <repetitions> <interval> <command>

The -i switch makes a timer dynamically associate with whatever happens to be the active connection. If a server window is closed, the timer is associated with the next available server window.