A Server Manager for mIRC.
As far as I know, there is 1 serious bug:
A workaround for this is adding the sub-server to your serverlist, like mediatraffic.fi.quakenet.org, so you will not be redirected to another one.
on *:START: {
if (%servermanager_autostart == 1) {
/dialog -md SERVERMANAGER SERVERMANAGER
}
}
on *:CONNECT: {
var %a = 1
var %b = $lines(serverlist.swf)
while (%a <= %b) {
var %c1 = $gettok($read(serverlist.swf,%a),1,182)
if (%c1 == $server || %c1 == $serverip) {
var %c2 = $gettok($read(serverlist.swf,%a),2,182)
var %c3 = $gettok($read(serverlist.swf,%a),3,182)
var %c4 = $gettok($read(serverlist.swf,%a),4,182)
if (%servermanager_noautojoin != 1) {
var %d = 1
var %e = $numtok(%c2,59)
while (%d <= %e) {
/join2 $gettok(%c2,%d,59)
inc %d
}
}
if (%c3) {
./nick %c3
}
if (%c4) {
/msg NickServ IDENTIFY %c4
}
var %a = %b
}
inc %a
}
}
alias join2 {
/join #$$1 $2-
}
menu * {
Silverwing
.Server Manager: /dialog $iif($dialog(SERVERMANAGER),-vie,-md) SERVERMANAGER SERVERMANAGER
}
dialog SERVERMANAGER {
title "Server Manager"
size -1 -1 317 170
option dbu
text "Servers:", 5, 4 4 24 8
list 6, 4 15 92 130, hsbar vsbar size sort
text "Autojoin channels:", 7, 104 4 50 8
list 8, 104 15 92 130, hsbar vsbar size sort
text "Double click any server to connect", 9, 4 147 101 8
text "Add channel(s):", 10, 203 61 42 8
edit "", 11, 203 73 76 42, autovs multi
button "Add", 12, 202 117 29 12
button "Remove selected", 13, 202 132 51 12
text "Seperate multiple channels by semicolon (no space after semicolon)", 14, 283 72 32 50
check "Do NOT use Autojoin only for this time", 15, 3 157 104 8
button "Connect to all", 16, 266 154 45 12
check "Start Server Manager with mIRC", 17, 225 4 91 8
box "Registered", 1, 203 20 109 34
text "Nick:", 2, 207 29 14 8
edit "", 3, 222 28 84 10
text "Password:", 4, 207 40 28 8
edit "", 18, 236 40 70 10, pass
menu "File", 100
item "Add server", 101, 100
item "Remove selected", 102, 100
item "break", 103, 100
item "Add all default servers", 104, 100
item "break", 105, 100
item "Remove all servers", 107, 100
item "break", 108, 100
item "Close", 106, 100, ok
}
dialog ADDSERVER {
title "Add Server"
size -1 -1 93 78
option dbu
combo 1, 4 4 85 9, drop sort
edit "", 2, 4 17 85 10
button "Add", 3, 11 62 32 12
button "Cancel", 5, 48 62 32 12, ok
text "Select a server from the list or specify an address in the second box.", 4, 4 32 72 22
}
on *:DIALOG:ADDSERVER:*:*: {
if ($devent == init) {
/loaddefaultservers
}
if ($devent == sclick) {
if ($did == 1 && $did(1).seltext) {
/did -ar $dname 2 $did(1).seltext
}
if ($did == 3 && $did(2)) {
/addserver $dname $did(2)
}
}
}
on *:DIALOG:SERVERMANAGER:*:*: {
if ($devent == init) {
/unset %servermanager_noautojoin
/loadservers
/did -u $dname 17
if (%servermanager_autostart == 1) {
/did -c $dname 17
}
}
if ($devent == sclick) {
if ($did == 6) {
/loadautojoin
}
if ($did == 12) {
if ($did(6).seltext && $did(11)) {
/addautojoin
}
}
if ($did == 13) {
if ($did(8).seltext) {
/removeautojoin
}
}
if ($did == 16) {
if ($did(15).state == 1) {
/set %servermanager_noautojoin 1
}
/connectall
}
if ($did == 17) {
if ($did(17).state == 1) {
/set %servermanager_autostart 1
}
if ($did(17).state == 0) {
/unset %servermanager_autostart
}
}
}
if ($devent == dclick) {
if ($did == 6) {
if ($did(15).state == 1) {
/set %servermanager_noautojoin 1
}
/server -m $did(6).seltext
/dialog -x SERVERMANAGER SERVERMANAGER
}
}
if ($devent == edit) {
if ($did == 3) {
/updateregistered $dname 3 18
}
if ($did == 18) {
/updateregistered $dname 3 18
}
}
if ($devent == menu) {
if ($did == 101) {
/dialog $iif($dialog(ADDSERVER),-vie,-md) ADDSERVER ADDSERVER
}
if ($did == 102) {
if ($did(6).seltext) {
/removeserver
}
}
if ($did == 104) {
var %temp = $?="WARNING: You're about to add ALL default servers to your serverlist. This might take a while! Enter Continue below to proceed:"
if (%temp == Continue) {
if ($file(servers.ini)) {
var %a = 0
var %b = $calc($ini(servers.ini,servers,0)-1)
while (%a <= %b) {
/addserver $dname $left($gettok($readini(servers.ini,servers,n $+ %a),2-3,58),-5)
inc %a
}
}
}
/dialog -vie $dname $dname
}
if ($did == 107) {
var %temp = $?="WARNING: You're about to remove ALL servers in your serverlist! Enter Continue below to proceed:"
if (%temp == Continue) {
/write -c serverlist.swf
/loadservers
}
/dialog -vie $dname $dname
}
}
}
alias -l loadservers {
/did -r SERVERMANAGER 6 8
var %a = 1
var %b = $lines(serverlist.swf)
while (%a <= %b) {
/did -a SERVERMANAGER 6 $gettok($read(serverlist.swf,%a),1,182)
inc %a
}
/did -z SERVERMANAGER 6
}
alias -l loaddefaultservers {
if ($file(servers.ini)) {
var %a = 0
var %b = $calc($ini(servers.ini,servers,0)-1)
while (%a <= %b) {
/did -a ADDSERVER 1 $left($gettok($readini(servers.ini,servers,n $+ %a),2-3,58),-5)
inc %a
}
}
}
alias -l loadautojoin {
/did -r SERVERMANAGER 8
var %a = 1
var %b = $lines(serverlist.swf)
while (%a <= %b) {
if ($gettok($read(serverlist.swf,%a),1,182) == $did(SERVERMANAGER,6).seltext) {
var %c = $gettok($read(serverlist.swf,%a),2,182)
var %d = 1
var %e = $numtok(%c,59)
while (%d <= %e) {
/did -a SERVERMANAGER 8 $gettok(%c,%d,59)
inc %d
}
/did -ar SERVERMANAGER 3 $gettok($read(serverlist.swf,%a),3,182)
/did -ar SERVERMANAGER 18 $gettok($read(serverlist.swf,%a),4,182)
var %a = %b
}
inc %a
}
/did -z SERVERMANAGER 8
}
alias -l addserver {
if ($file(serverlist.swf)) {
var %a = 1
var %b = $lines(serverlist.swf)
while (%a <= %b) {
if ($gettok($read(serverlist.swf,%a),1,182) == $2-) {
goto end
}
inc %a
}
}
/write serverlist.swf $2- $+ $chr(182)
/loadservers
:end
if ($1 == ADDSERVER) {
/dialog -x $1 $1
}
}
alias -l removeserver {
var %a = 1
var %b = $lines(serverlist.swf)
while (%a <= %b) {
if ($gettok($read(serverlist.swf,%a),1,182) == $did(SERVERMANAGER,6).seltext) {
/write -dl $+ %a serverlist.swf
}
inc %a
}
/loadservers
}
alias -l addautojoin {
var %a = 1
var %b = $did(SERVERMANAGER,11).lines
while (%a <= %b) {
var %c = %c $did(SERVERMANAGER,11,%a)
inc %a
}
var %a = 1
var %b = $lines(serverlist.swf)
while (%a <= %b) {
if ($gettok($read(serverlist.swf,%a),1,182) == $did(SERVERMANAGER,6).seltext) {
var %d = 1
var %e = $numtok(%c,59)
while (%d <= %e) {
/write -l $+ %a serverlist.swf $gettok($read(serverlist.swf,%a),1,182) $+ $chr(182) $+ $addtok($gettok($read(serverlist.swf,%a),2,182),$gettok(%c,%d,59),59)
inc %d
}
var %a = %b
}
inc %a
}
/did -r SERVERMANAGER 11
/loadautojoin
}
alias -l removeautojoin {
var %a = 1
var %b = $lines(serverlist.swf)
while (%a <= %b) {
if ($gettok($read(serverlist.swf,%a),1,182) == $did(SERVERMANAGER,6).seltext) {
var %c = $gettok($read(serverlist.swf,%a),2,182)
/write -l $+ %a serverlist.swf $gettok($read(serverlist.swf,%a),1,182) $+ $chr(182) $+ $remtok(%c,$did(SERVERMANAGER,8).seltext,0,59)
var %a = %b
}
inc %a
}
/loadautojoin
}
alias -l updateregistered {
var %a = 1
var %b = $lines(serverlist.swf)
while (%a <= %b) {
if ($gettok($read(serverlist.swf,%a),1,182) == $did(SERVERMANAGER,6).seltext) {
/write -l $+ %a serverlist.swf $gettok($read(serverlist.swf,%a),1,182) $+ $chr(182) $+ $gettok($read(serverlist.swf,%a),2,182) $+ $chr(182) $+ $did($1,$2) $+ $chr(182) $+ $did($1,$3)
var %a = %b
}
inc %a
}
}
alias -l connectall {
var %a = 1
var %b = $lines(serverlist.swf)
while (%a <= %b) {
/server -m $gettok($read(serverlist.swf,%a),1,182)
inc %a
}
/dialog -x SERVERMANAGER SERVERMANAGER
}
how about 2 hash tables
one for server
example: Servers irc.icq.com irc.icq.com
one for your channels
example: AutoJoin $network channels
then when your on said network it will autojoin said channels
on *:start: {
if (!$hget(AutoJoin)) { hmake AutoJoin 20 }
if ($exists(AutoJoin.hsh)) { hload AutoJoin AutoJoin.hsh }
if (!$hget(Servers)) { hmake Servers 20 }
if ($exists(Servers.hsh)) { hload Servers Servers.hsh }
set -u5 %a 1
set -u5 %b $hget(Servers,0).item
while %a <= %b {
if (%a == 1) { server $hget(Servers,%a).item | inc %a }
else { server -m $hget(Servers,%a).item | inc %a }
}
else { haltdef }
}
on *:connect: { join $hget(Autojoin,$network) }
i come across the same problems with my bot
I have a script similar to this, and the way i went around that bug is to specifically join that subserver. So if i specified a server without the sub-server, it would join a random one, override the original with the sub server, and use that as the server to join everytime. If you are interested in looking at how i went around it by viewing the code, i have it posted here on hawkee
@Bluepower10: You can add your own by typing it in the second box on the Add Server dialog (File > Add Server). The first box is for the default servers list, so if you don't have that, it should be empty, which doesn't matter as it adds the server from the second box (when you select something from the first box, it will be automatically copied to the second one)
@Aucun50: it should work perfectly without restarthing the dialog or even mIRC.
Edit: I've edited the description on the Add Server dialog. I think it should be clear now ;) If not, let me know