A quiet little channel link that works entirely on socket connections.
Features
Multi-server
Runs quietly in the background
Mostly self-sufficient
Easy to use
Commands
/startlink [channel2 ...] [server2 [channel2 ...] ...]
/stoplink [reason]
Updates
1.1
Fixed nick changing glitch
Fixed problem with quit/part messages
Custom bot nick
1.2
Bot will now announce channels/servers that are linked upon joining a channel
WARNING! This script will accept unlimited servers and unlimited channels, your PC and/or the servers you connect to will not.
;Config
;Nick for bot to use
alias linkbotnick return LinkBot
;End of Conf
alias startlink {
if (*.*.* !iswm $1) { echo -at First parameter must be a server, link aborted
return
}
var %x 1
while (%x <= $0) {
var %c $gettok($1-,%x,32)
if (*.*.* iswm %c) { set %linkservers $addtok(%linkservers,%c,32) }
elseif ($left(%c,1) == $chr(35)) { set %linkchannels. [ $+ [ $gettok(%linkservers,-1,32) ] ] $addtok(%linkchannels. [ $+ [ $gettok(%linkservers,-1,32) ] ],%c,44) }
else { var %i $addtok(%i,%c,32) }
inc %x
}
if (%i) { echo -at ERROR! Invalid paramters: %i $+ . Parameters must be channels or servers }
var %s $numtok(%linkservers,32)
while (%s) {
if (!%linkchannels. [ $+ [ $gettok(%linkservers,%s,32) ] ]) { var %is $addtok(%is,$gettok(%linkservers,%s,32),32) }
dec %s
}
if (%is) { echo -at ERROR! Channels were not specified for the following servers: %is }
else { var %x $numtok(%linkservers,32)
while (%x) {
sockopen $+(linkbot-,$gettok(%linkservers,%x,32)) $gettok(%linkservers,%x,32) 6667
sockmark $+(linkbot-,$gettok(%linkservers,%x,32)) %linkchannels. [ $+ [ $gettok(%linkservers,%x,32) ] ]
dec %x
}
}
}
on *:SOCKOPEN:linkbot-*:{
sockwrite -nt $sockname nick $linkbotnick
sockwrite -nt $sockname user LinkBot LinkBot LinkBot :mIRC Socket Link Bot by CodeNinja
sockwrite -nt $sockname join $replace(%linkchannels. [ $+ [ $gettok($sockname,2-,45) ] ],$chr(32),$chr(44))
}
on *:SOCKREAD:linkbot-*:{ sockread %data
if ($sockerror) { stoplink $sockname encountered an error | halt }
tokenize 32 %data
if (($2 == PRIVMSG || $2 == MODE) && $3 == $linkbotnick) { return }
elseif ($2 == KICK && $4 == $linkbotnick) { sockwrite -nt $sockname JOIN $3 }
elseif (47? iswm $2) { delinkchan $gettok($sockname,2-,45) $4 }
elseif ($1 == PING) { sockwrite -nt $sockname PONG $2 }
elseif ($2 == JOIN && $+(:,$linkbotnick,!*@*) iswm $1) { showlinks $sockname $right($3,-1) }
elseif ($regex($2,/(privmsg|topic|mode|kick|nick|quit|part|join)/i)) { botrelay $sockname $2 $remove($1,:) $3- }
}
on *:SOCKCLOSE:linkbot-*:{ stoplink $sockname connection closed }
alias -l botrelay { var %x $sock(linkbot-*,0)
var %chan $iif($left($4,1) == $chr(35) || $2 == JOIN,$iif($2 == JOIN,$right($4,-1),$4),ALL)
while (%x) {
var %name $sock(linkbot-*,%x)
var %y $numtok($sock(%name).mark,44)
while (%y) {
if ($gettok($sock(%name).mark,%y,44) != %chan) { sockwrite -nt %name PRIVMSG $gettok($sock(%name).mark,%y,44) $+(:,7,$chr(91),14,$replace($gettok($1,2-,45),.,7.14),7/14,%chan,7,$chr(93),) $getlinkstr($gettok($3,1,33),$gettok($3,2,33),$iif($4 == %chan,$5-,$4-)). [ $+ [ $2 ] ] }
dec %y
}
dec %x
}
}
alias stoplink { var %x $sock(linkbot-*,0)
while (%x) {
sockwrite -nt $sock(linkbot-*,%x) QUIT :Link stopped: $iif($1,$1-,No Reason)
sockclose $sock(linkbot-*,%x)
dec %x
}
unset %linkservers
unset %linkchannels.*
}
alias -l getlinkstr {
;Nick Host Params
;(privmsg|topic|mode|nick|kick|quit|part)
;echo -t @debug $1 $chr(124) $2 $chr(124) $3 $chr(124) $4 $chr(124) $5
if ($prop == privmsg) { if ($+(:,$chr(1),ACTION,*,$chr(1)) iswm $3-) { return * $1 $right($remove($3,$chr(1)),-8) }
else { return $+(<,$1,>) $right($3,-1) }
}
elseif ($prop == topic) { return * $1 has changed topic to $+(",$right($3,-1),") }
elseif ($prop == mode) { return * $1 has set mode: $3 }
elseif ($prop == kick) { return * $1 has kicked $gettok($3,1,32) $+($chr(40),$right($gettok($3,2-,32),-1),$chr(41)) }
elseif ($prop == quit) { return * $1 $+($chr(40),$2,$chr(41)) has quit $+($chr(40),$right($3,-1),$chr(41)) }
elseif ($prop == part) { return * $1 $+($chr(40),$2,$chr(41)) has parted $+($chr(40),$right($3,-1),$chr(41)) }
elseif ($prop == join) { return * $1 $+($chr(40),$2,$chr(41)) has joined }
elseif ($prop == nick) { return * $1 has changed nick to $right($3,-1) }
}
alias -l showlinks { var %l
var %x $numtok(%linkservers,32)
while (%x) {
var %l $addtok(%l,$gettok(%linkservers,%x,32),32)
var %l $addtok(%l,%linkchannels. [ $+ [ $gettok(%linkservers,%x,32) ] ],32)
dec %x
}
sockwrite -nt $1 PRIVMSG $2 :The following servers/channels are linked: %l
}
alias -l delinkchan { set %linkchannels. [ $+ [ $1 ] ] $remtok(%linkchannels. [ $+ [ $1 ] ],$2,44)
if (!%linkchannels. [ $+ [ $1 ] ]) { set %linkservers $remtok(%linkservers,$1,32)
sockclose linkbot- [ $+ [ $1 ] ]
}
}
ok i got it to connect to 2 different servers with the same channel , now just what is the purpose of this, are you suppose to see each channel text as 1 channel from both servers
for the nick change i just change all from LinkBot to BillyBob
is this suppose to relay channel text to both channels on different servers???
heya
um im not entirely sure how to firstly set this up and secondly what exactly it dose.
Is this like a multiserver channel relay bot?
only this comment___
sk68
The Whistler, the script runs on sockets, meaning it creates its own bot and uses that to link, you dont have to have a bot running, thats the beauty of it :)
Also, if no bot is joining your channel, make sure the nick it is trying to use (LinkBot by default) is available, as of now there is no support for alt nicks though, this will be added to a future update
make me think otherwise ... so the bot dosent need to be on 2 servers? or 2 chans? im a little confused there.
anyway, regarding setting this up, im also a bit confused.. you said:
/startlink [channel2 ...] [server2 [channel2 ...] ...]
i assuminged initialy i do something like this
/startlink euroserv.fr.quakenet.org #pangaea irc.undernet.org #pangaea
= * Invalid format: $gettok (line 14, MULTI-SERVER-RELAY-2222)
x@channels.undernet.org No such nick .. etc etc
anyway, not quite sure how i set it up, also i notice you have used () and [] .. is there any difference? or are you trying to emphasises that something else must go in either the () or []? or are the meant to be there as part of the code? :/
anyway looks like a nice script
i can't say for certain, but i imagine that sk68 may have been able to identify the 14th line in his script at some point during the last 6 months.
while this is bumped and in case this problem continues to plague anyone, i'll just point out that this error comes from a version of mIRC that is almost 5 years old and happens because the ',%x' is seen as being a separate local variable declaration, leaving '$gettok(' unclosed. there are two possible fixes. add the = sign, as the help file has always advised:
var %c = $gettok($1-,%x,32)
or, make sure that '%x' is separated from the comma behind it:
var %c $gettok($1-,$(%x),32)
The Whistler, the script runs on sockets, meaning it creates its own bot and uses that to link, you dont have to have a bot running, thats the beauty of it :)
Also, if no bot is joining your channel, make sure the nick it is trying to use (LinkBot by default) is available, as of now there is no support for alt nicks though, this will be added to a future update