mIRC Homepage
Posted By: Deep3D Closing Link - try next server in group - 21/01/21 12:14 AM
I'm trying to make a script that changes server if you get diconnected by "Closing Link" upon connection.

mIRC hammers the server over and over without trying next server in group. Yes, "Try next server in group" is enabled under options.

Message I got: Closing Link: 213.***.**.*** (This server is not accepting new connections. Please connect to chat.freenode.net instead.)

I tought I hade to use on DISCONNECT. But $1- only gives me server-address, when I need to find Closing and Link: to trigger the script.

I'm trying to do something like this:

Code
on 1:disconnect:{
  if freenode isin $server && $1 == Closing && $2 == Link: { server freenode }
  if freenode isin $server { echo -a Disconnect reason: $1- }
}
Posted By: maroon Re: Closing Link - try next server in group - 21/01/21 07:05 AM
I can't test because I don't know of an address displaying this message, but is that message coming in the ON SNOTICE event or something besides ON DISCONNECT? If not, i'd see what kind of message is shown by a @debug window. /help /debug

The purpose of the "try next server" is when the attempt to connect fails, but if it allows you to connect but then immediately disconnects you, then it will keep connecting to the server it successfully connected to in the first place.
Posted By: Deep3D Re: Closing Link - try next server in group - 21/01/21 10:35 AM
I tryed on disconnect, on snotice and on connectfail. But I still dont get the output I need to make this work.

My code:
Code
on 1:disconnect:{
  echo -a DISCONNECT: $1-
}

on 1:SNOTICE:*:{
  echo -a SNOTICE: $1-
}

on 1:connectfail:{
  echo -a FAIL: $1-
}


@debug:
Quote
<- ERROR :Closing Link: ***.***.**.*** (This server is not accepting new connections. Please connect to chat.freenode.net instead.)


Status window:
Quote
[11:26] * Connecting to sinisalo.freenode.net (6665)
-
[11:26] -sinisalo.freenode.net- *** Looking up your hostname...
-
SNOTICE: *** Looking up your hostname...
-
[11:26] -sinisalo.freenode.net- *** Checking Ident
-
SNOTICE: *** Checking Ident
-
[11:26] -sinisalo.freenode.net- *** Found your hostname
-
SNOTICE: *** Found your hostname
-
[11:26] -sinisalo.freenode.net- *** No Ident response
-
SNOTICE: *** No Ident response
[11:26] Caps supported: account-notify away-notify cap-notify chghost extended-join identify-msg multi-prefix sasl tls
[11:26] Caps set: account-notify away-notify cap-notify chghost extended-join multi-prefix
-
[11:26] Closing Link: ***.***.**.*** (This server is not accepting new connections. Please connect to chat.freenode.net instead.)
-
[11:26] * Disconnected
DISCONNECT: sinisalo.freenode.net
Posted By: maroon Re: Closing Link - try next server in group - 21/01/21 10:59 AM
on *:ERROR:*:{ echo -s $chr(22) scriptline $scriptline event $event server $server serverip $serverip }
Posted By: Deep3D Re: Closing Link - try next server in group - 21/01/21 01:03 PM
Thank you.

This is my final code:
Code
on *:error:*This server is not accepting new connections*:{
  echo.info Ok, trying new connection to: $strip($15)
  server $strip($15)
}
Posted By: maroon Re: Closing Link - try next server in group - 21/01/21 04:37 PM
A suggestion that you add a little bit of verification to this, to avoid or lessen the possibility that you don't end up connecting to a rogue server. Usually this isn't a problem, but someone could try to mess up your client by SAJOIN'ing you to hundreds of channels or doing something else to make your client slow way down.

This ERROR event isn't a standard message, so it's possible for this to change in the future. If you manually used the /server command to join that server, then $network will be null because the connection hasn't gotten far enough to see how the network identifies itself. If that first server was in your servers list, then it returns the name of the serverlist "group", which is why it's a good idea to always have your groups be named the same way as the network identifies itself. If you ever see $network being "Freenode instead of "freenode", that's because it's using the group name from:

//echo -a $server(chat.freenode.net).group

Perhaps you can add a verification that the server you're being sent to is somewhere in your serverlist. $server($15) will be null if that string isn't in your serverlist.
© mIRC Discussion Forums