I made a bot for myself a while ago and recently expanded it to support multiservers.
But im having bad problems with disconnections and servers trying to connect in the wrong windows once disconnected etc... so i decided to write a disconnection handler to attempt to fix this problem. However it also doesnt work because i use $cid to tell which serrver window should connect. Once disconnected i guess the window doesnt have a $cid value cause it returns localhost to my script instead of the number..
Reconnection on disconnection isnt an option for this its the [censored] that first caused the problem

Startup script:
Code:
 
on 1:START:/server localhost 5050 | /server -m irc.iinet.net.au | /server -m localhost 4000
 

So you can see its very simple it creates 2 new windows...
In mirc theres a setting for preform on connect so it sets the varaibles below here %lcd %vng etc... using the $cid it obtains once connected.
Now the disconnection handler is as follows:
Code:
on 1:DISCONNECT:/checkservers

alias checkservers {
  set %servername $server
  if (%servername == server.name.here) {
    scid %lcd /server localhost 5050 
  }
  if (%servername == iinet.wa.au.austnet.org) {
    scid %cidv /server irc.iinet.net.au
  }
  if (%servername == server3.name.here) {
    scid %vng /server localhost 4000
  }
  :end
}
  


Is there a workaround for my problem?
Thanks