mIRC Home    About    Download    Register    News    Help

Print Thread
D
druiddk
druiddk
D

Hmm... can't find anything in documentation on this subject... Is it possible to have an on 1:TEXT for multiple servers?

Like /server some.server.efnet.org
/server -m other.server.ircnet.net

:-)

M
MonoSex
MonoSex
M
Code:
on 1:TEXT:*:*:{
  if ($server == [color:green]some.server.efnet.org[/color]) { commands}
  elseif ($server == [color:green]other.server.ircnet.net[/color]) { commands }
}

You can also use $network.

H
Hammer
Hammer
H
Each on TEXT event will fire within the context of the server on which the event fired. The same event will fire on all servers if they occur there. You can think of each connection ($scon or $scid) as being its own mIRC instance. The new multi-server scripting identifiers and commands allow you to breach the connection boundaries.

You can limit which servers or networks the event actually works on if you so choose to, using one of the following ideas (as well as others):

if ($network == EFnet)
if ($server == irc.somewhere.net)
if ($cid == 2)

D
druiddk
druiddk
D
Okay cool!

so:

Code:
on 1:TEXT:hello:#say_hello:{
if ($cid == 2) { .msg $nick why hello there! }
} 


I take it will then msg $nick on the server it was triggered on...
But what if i want to msg a nick on the OTHER server

like .msg hellofetish $nick said hello on $network

H
Hammer
Hammer
H
Then you can use the /scon or /scid command to cross the connection boundry.

/scid 1 msg hellofetish $nick said hello on $network

Also, keep in mind that $cid is a changeable value. If you open 3 connections, they will be numbered 1, 2 and 3, respectively. (And $scid(N) will match $scon(N).)

$scid(1) == $scon(1)
$scid(2) == $scon(2)
$scid(3) == $scon(3)

If you then close the first two connections and open two different server connections (with /server -m), now you have 3 connections open again, but the $cid's will be 3, 4 and 5, which does not match the $scon(N) anymore. $scon's follow the total number of connections you have open.

$scid(3) == $scon(1)
$scid(4) == $scon(2)
$scid(5) == $scon(3)


Link Copied to Clipboard