This script checks the BNLS servers that are online every 30 minutes, and checks if the BNLS you use is currently down, if you use one.
You can change these numbers at the top of the script.
'servers
'1.0
'7thAce
Const servers_AutoDisplayTimer = 30 '// Time in minutes to check all servers. Displays them with addchats.
Const servers_CheckBNLSTimer = 5 '// Time in minutes to check your server. Only displays an error if your server is down and you use BNLS.
Const servers_AutoChange = True '// True or False - Changes your BNLS if the current one is down and you do not use Hashes.
Sub servers_event_load()
Addchat vbMagenta, "Server checker loaded. Type ""/server update"" to check the server statuses."
Atime = 60 * servers_AutoDisplayTimer
TimerInterval "servers", "Autodisplay", Atime
TimerEnabled "servers", "Autodisplay", True
Btime = 60 * servers_CheckBNLSTimer
TimerInterval "servers", "CheckBNLS", Btime
TimerEnabled "servers", "CheckBNLS", True
End Sub
Sub servers_event_pressedenter(text)
If left(lcase(text), 8) = "/server " Then
Vetothismessage()
If lcase(text) = "/server update" Then
Content = scInet.OpenURL("http://python.bot.nu/py/status.php")
Args = Split(Content, "<img src='img/text_")
Serverlist = Split(Content, "<a href='status.php?server=")
For i = 0 to Ubound(Serverlist)
Serverlist(i) = Left(Serverlist(i), Instr(Serverlist(i), ":") - 1)
Next
For i = 0 to Ubound(Args)
If left(Args(i), 1) = "d" Then Addchat vbred, "Server " & Serverlist(i) & " is currently offline."
If left(Args(i), 1) = "c" Then Addchat vbgreen, "Server " & Serverlist(i) & " is currently online."
Next
End If
End If
End Sub
Sub servers_Autodisplay_timer()
Text = "/server update"
Call servers_event_pressedenter(text)
End Sub
Sub servers_CheckBNLS_timer()
BNLS = GetConfigEntry("Main", "SetBNLSServer", "Config.ini")
Content = scInet.OpenURL("http://python.bot.nu/py/status.php")
Serverlist = Split(Content, "<a href='status.php?server=")
For i = 0 to Ubound(Serverlist)
Serverlist(i) = Left(Serverlist(i), Instr(Serverlist(i), ":") - 1)
Next
For i = 0 to Ubound(Serverlist)
If BNLS = Serverlist(i) Then
Args = Split(Content, "<img src='img/text_")
If Left(Args(i), 1) = "d" Then
Addchat vbred, "Warning: Your current BNLS server is offline or is not on the trusted servers list. Please change it or use the auto-change feature."
If servers_autochange Then
If GetConfigEntry("Main", "UseBNLS", "Config.ini") = "Y" Then
Addchat vbyellow, "Your BNLS Server is offline - Using auto-change to use a new server."
If BNLS <> "pyro.no-ip.biz" Then
WriteConfigEntry "Main", "SetBNLSServer", "pyro.no-ip.biz", "Config.ini"
Else
WriteConfigEntry "Main", "SetBNLSServer", "alendar.no-ip.org", "Config.ini"
End If
Call ReloadSettings(1)
If SSC.IsOnline() = False Then
Call Command(BotVars.Username, "/cq", True)
Call SSC.Connect()
End If
End If
End If
End If
End If
Next
End Sub
Please reply with comments or errors.