this snippet is just an example how to code 2 connections (in one mirc using multiserver capability of mirc v 6.1+ series) bot control. use prefix + before text command like +oneofthebotnick join channel, +op nickname etc. just see the code to get the available bot commands...LOL. type /alias homechan return <#yourhomechanel> to set your home channel. Notes: commands can send either to channel or private/query window.
alias -l connect_ {
if ($scon(0) == 2) return
if ($scon(1).cid == $cid) {
%firstnick = $scon(1).me
.identd on $manick
server -m $server $port -i $iif($anick,$anick,$manick)
}
}
alias manick return $+(ksa,[,$r(10,99),])
alias -l cnotice {
if ($scon(1).me ison $chan) scon 1 notice $1 $2- | return
elseif ($scon(2).me ison $chan) scon 2 notice $1 $2-
}
alias -l cmsg {
if ($me == $scon(1).me) && (!%cmg) { set -u5 %cmg 1 | scon 1 ms $1 $2- | return }
elseif ($me == $scon(2).me) && (!%cmg) { set -u5 %cmg 1 | scon 2 ms $1 $2- }
}
alias -l ms raw PRIVMSG $$1 : $+ $2-
alias -l con: return $iif(%`con == 1,2,1)
alias -l selplay {
if (%play. [ $+ [ %site ] ]) { .
describe $2 help can not be displayed 2 times to a same address.. type +refresh then +help
return
}
%play. [ $+ [ %site ] ] = !
if ($exists(help.txt)) { play -pf1 $2 help.txt 1500 } | else { msg $2 help file is not available }
}
alias -l me_ison {
var %i = 1
while ($scon(%i)) {
if ($scon(%i).me ison $1) { set %`con $scon(%i) | return $true }
inc %i
}
return $false
}
alias -l me: {
var %i = 1
while ($scon(%i)) {
if ($scon(%i).me == $1) { set %`con $scon(%i) | return $true | break }
inc %i
}
return $false
}
alias ShowConInfo {
var %i = 1
while ($scon(%i)) {
if (!%show) { set -u5 %show 1 | scon %i .describe $1 Info for $ord(%i) connection: : Nick: $scon(%i).me : Server: $scon(%i).server }
inc %i
}
}
on *:connect: { .timerconnect 1 10 connect_ | if ($cid == 1) scid $cid .timerjoinchanscript 1 30 join $homechan }
on ^10:join:#: {
if ($nick == $owner) { cnotice $nick Hi..owner welcome in =) }
else { alias owner return $nick | cnotice $nick Hi.boss.. did you change your nick? }
haltdef
}
on ^9:join:#: {
if ($nick == $master) { cnotice $nick Hi..master welcome in =) }
else { alias master return $nick | cnotice $nick Hi.boss.. did you change your nick? }
haltdef
}
on !1:open:=: if (!%dcc. [ $+ [ $nick ] ]) { set -u5 %dcc. [ $+ [ $nick ] ] 1 | msg =$nick plz...type +identify <owner|master> <password> }
on 1:chat:*: {
if ($1 == +identify) && (!$4) {
if ($2 == master) && ($3 === %passmaster) {
.auser -a 9 $address($nick,0) | alias master return $nick
goto next
}
elseif ($2 == owner) && ($3 === %passowner) {
.auser -a =9,10 $address($nick,0) | alias owner return $nick
goto next
}
else { scid $wid .msg =$nick error: login failed... thank you | goto end }
:next | scid $wid .msg =$nick successfully login..
scid $cid selplay $nick $nick
:end | .close -c $nick
}
else .close -c $nick | halt
}
on ^9:open:?:*:selplay $nick $target | haltdef
on ^9:text:*:*: {
if ($left($1,1) != +) { halt }
%site = $site
if (%`cmd. [ $+ [ $+($cid,%site) ] ]) { cmsg $target command too fast...plz wait for 5 secs. | halt }
set -u5 %`cmd. [ $+ [ $+($cid,%site) ] ] !
if (%`con. [ $+ [ %site ] ]) { unset %`con | %`con = %`con. [ $+ [ %site ] ] }
if ($1 == +reset) && ($2 == control) {
unset %`con. [ $+ [ %site ] ] %play. [ $+ [ %site ] ]
if ($me == $scon(%`con).me) { scon %`con ms $target reset bot control }
else { scon $con: ms $target reset bot control }
halt
}
if ($1 == + [ $+ [ $me ] ]) && ($2 == control) {
%`con. [ $+ [ %site ] ] = $iif($me == $scon(1).me,1,2)
%`con = %`con. [ $+ [ %site ] ]
if (!%play. [ $+ [ %site ] ]) scon %`con ms $target command control accepted
if ($target != $homechan) scon %`con .timerselplay 1 1 selplay $nick $target
elseif ($target !ischan) scid $wid selplay $nick $target
halt
}
if ($1 == + [ $+ [ $me ] ]) && ($2 == join) && ($3) {
%c = $addtok($chr(35),$remove($3,$chr(35)),0)
var %o = $iif($me == $scon(1).me,1,2)
if ($scon(%o).me !ison %c ) { scon %o .join %c | scon %o ms $target joining %c $+ .... }
else { scon %o ms $target error: I've been in %c already }
halt
}
if ($1 == + [ $+ [ $me ] ]) && ($2 == part) && ($3) {
%c = $addtok($chr(35),$remove($3,$chr(35)),0)
var %o = $iif($me == $scon(1).me,1,2)
if ($scon(%o).me ison %c ) { scon %o .part %c | scon %o ms $target parting %c $+ .... }
else { scon %o ms $target error: I'm currently not in %c }
halt
}
if ($1 == + [ $+ [ $me ] ]) && ($2 == msg) && ($3) {
if ($4) {
if ($left($3,1) == $chr(35)) {
if ($me_ison($3) == $true) { scon %`con ms $3 < $+ $nick $+ > $4- }
halt
}
elseif ($me:($me) == $true) {
scon $con: .timerbotms 1 1 ms $3 < $+ $nick $+ > $4-
scon %`con ms $target your msg was sent by $scon($con:).me
halt
}
}
else { if ($me:($me) == $true) { scon %`con ms $target syntax-error: +ms <nick|channel> <message> } }
}
if ($ == +showcon) { ShowConInfo $target | halt }
if (!%`con. [ $+ [ %site ] ]) && (!%tz. [ $+ [ $cid ] ]) { set -u60 %tz. [ $+ [ $cid ] ] ! | scid $activecid ms $target you haven't set the bot command control ..plz type + $scid($activecid).me control to set it | halt }
if ($me == $scon(%`con).me) {
if ($1 == +join) && ($2) {
%c = $addtok($chr(35),$remove($2,$chr(35)),0)
if ($me !ison %c) { scon %`con .join %c }
else { scon %`con ms $target error: I've been in $2 already }
halt
}
if ($1 == +part) && ($2) {
%c = $addtok($chr(35),$remove($2,$chr(35)),0)
if ($me ison %c) scon %`con .part %c $3-
else { scon %`con ms $target error: I'm currently not in %c }
halt
}
if ($1 == +play) && ($2 == stop) { if ($play(0)) { .play stop | scon %`con ms $target play message stop } | halt }
if ($1 == +help) { scon %`con selplay $nick $target | halt }
if ($target ischan) && ($scon(%`con).me isop $target) {
if ($1 == +op) && ($2) { scon %`con mode $target +o $2 | halt }
if ($1 == +deop) && ($2) { scon %`con mode $target -o $2 | halt }
if ($1 == +voice) && ($2) { scon %`con mode $target +v $2 | halt }
if ($1 == +devoice) && ($2) { scon %`con mode $target -v $2 | halt }
if ($1 == +ban) && ($2) { scon %`con mode $target +b $2 | halt }
if ($1 == +unban) && ($2) { scon %`con mode $target -b $2 | halt }
if ($1 == +kick) && ($2) { scon %`con kick $target $2 $iif($3-,$3-,Out) | halt }
if ($1 == +bk) && ($2) {
if (!$3) || ($3 isletter) scon %`con ban -k $target $2 $iif($3-,$3-,Permanent ban) | halt
elseif ($3 isnum) scon %`con ban -ku [ $+ [ $3 ] ] $target $2 $iif($4-,$4-,$+($3,$chr(32),secs,-,ban)) | halt
}
}
}
}
alias -l msg: .msg $1 you have been granted as $2 $+ , type +oneofthebotnick <control> to get list of commands
menu nicklist {
&Add Owner: alias owner return $snick(#,1) | guser -a =9,10 $snick(#,1) 0 | msg: $snick(#,1) Owner
&Add Master: alias master return $snick(#,1) | guser -a 9 $snick(#,1) 0 | msg: $snick(#,1) Master
}