mIRC Homepage
Posted By: Kendy Auto connect random proxylist.txt! Help please - 09/07/20 10:54 AM
Hello there.Everybody can see this code and design more to help me when the server notified "Unable connect to server" 3 times, it will automatically disconnect to automatically switch to another ip proxy in the file proxylist.txt to connect continue. server, so on until the connection to the server is ok:

[20:34] * Disconnected
* Firewall is on Socks5 ( 62468)
[20:34] * Connecting to irc7.davang.org (6667)
[20:34] * Unable to connect to server (Connection attempt timed out)
[20:34] * Connect retry # 1 irc7.davang.org (6667)
[20:35] * Unable to connect to server (Connection attempt timed out)
[20:35] * Connect retry # 2 irc7.davang.org (6667)
[20:35] * Unable to connect to server (Connection attempt timed out)

Here is my code snippet:

if (!%proxynum) { set %proxynum 2 }
else { inc %proxynum }
var %proxyinfo = $read(proxylist.txt, %proxynum)
; proxy connection code goes here
/firewall on $read(proxylist.txt, %proxynum)

Thank you very much and look forward to receiving your help soon!
I haven't found an event which triggers when an individual retry fails. The only one I've seen is something like this:

echo -s event $event server $server servertarget $servertarget serverip $serverip port $port network $network / (1-) $1-

but this doesn't trigger if the number of retries is not yet reached, which would force you to set the number of retries to something very low, which would force you to have the CONNECTFAIL event contain the /server command to join the server again. The other way would be a timer that gets launched during ON DISCONNECT which would use /filter or some other means to inspect the last few lines of the status window to look for a line containing the 'unable to connect' message, comparing the timestamp to see if it's newer.

Something else you should do with your handling of your text file is to check if the value is $null which means you've read past the last line of the file. You should also be in the habit of ALWAYS using the nt switches with $read unless you specifically want the 1st line of the file to be used as if it's a number containing the number of lines in the file, and unless you specifically want to spend extra CPU time checking the line for $identifier and %variable words to be evaluated. Something like:

if (!%proxynum) { set %proxynum 1 }
inc %proxynum
var %proxyinfo = $read(proxylist.txt, %proxynum)
if (%proxyinfo == $null) { set %proxylist 1 | goto label }
; proxy connection code goes here
/firewall on $read(proxylist.txt,nt, %proxynum)

I don't know what your text looks like, but as you wrote it the 1st line was something that was not to be used. If that's not the case, the 1st line should be changed to 0 instead of 1.
proxylist.txt like this: 1081 1080 62468 17864 9999 9050 9050 30284 6667
It looks like
/help /proxy
gives advice on how to set proxy using a script instead of using the options menu. I'm not going to try to use a proxy because "reasons".
Also, the /help description of the proxy command indicates that "userid" and "password" are REQUIRED fields,

Do you know which proxy you're using by having your $ip changed to match the proxy IP?
i.e. when you use: //echo -a $ip
does that change to match the proxy you're using? If so, it should be easy to modify your script to compare the active proxy against the list, so it won't retry the same one.
Is using socks4/socks5/proxy supposed to be your choice, or does the proxy server require you to use one of those 3 settings which they prefer?
Thanks for your enthusiastic help, I have asked the writer to help me complete the code. The bot will automatically connect with another Ip Poroxy if after 30 seconds without connecting to the server with the current Ip proxy, it will automatically switch to another Ip to continue connecting to the server.
Are you good at writing socket code from mirc to website domain, maroon?
I have trouble reading it, i've never tried to write it
I have many ideas related to socket websites, but I haven't found anyone who is good at this. Do you know anyone on this forum who is good at writing Mirc for sockets?
© mIRC Discussion Forums