mIRC Homepage
Posted By: FWDeath optional <@network> parameter - 02/12/04 09:15 PM
it might be helpful if for certain commands there was another parameter for network...such as for the /msg #channel command and On Text

this would be helpful for us that run the same bot on multiple networks but only wish things to be done on certain channels on certain networks..

for example I run the a channel by the same name on 2 different networks. what I'd like to do is take all things said in 1 channel and message them to the other channel on the other network....
Format: on <level>:TEXT:<matchtext>:<*><?><#[,#]>,<@network>:<commands>
example:
on ^1:text:*:#terrortories,@funnet.org:/msg #terrortories @gamesnet.net < $+ $nick $+ > $1-


I do know certain scripting methods to achieve this, but they tend to be drawn out and require a lot of extra thought..


here are some that could benefit from an option <network> parameter:
On Text
on Part
On Join
/msg
/describe
Posted By: Mentality Re: optional <@network> parameter - 02/12/04 09:36 PM
A simple if statement can help:

if ($network == Networkname) { do stuff }

i.e.

on *:text:*:#terrortories:{
if ($network == Funnet) {
scon 2 msg #terrortories < $+ $nick $+ > $1-
}
}


The '2' assumes that the network you're messaging (Gamesnet) is the second one in your switchbar (the second one connected to).

Also see /help if then else and /help /scon.

Note: you only need to use the ^ prefix when halting text, and it appears you're not, so I removed it. And make sure you see qwerty's good point below grin

Regards,
Posted By: DaveC Re: optional <@network> parameter - 02/12/04 10:00 PM
Code:
alias get.scon {
  if ($1 != $null) {
    var %i = $scon(0)
    while (%i) {
      if ($scon(%i).network == $1) return %i
      dec %i
    }
  }
  return 0
}

(there might be a better way of getting then i dont know it)

add that somewhere then use

on ^1:text:*:#terrortories:if ($network = funnet.org) { /scon $get.scon(gamesnet.net) msg #terrortories < $+ $nick $+ > $1- }

PS im assuming funnet.org and gamesnet.net are the $network names here and not funnet and gamesnet, correct as needed.
Posted By: qwerty Re: optional <@network> parameter - 02/12/04 10:08 PM
$1- inside /scon is a big no-no. If $1- contains identifier strings, those will be evaluated, so imagine what can happen if somebody says something about $findfile(). The simplest safe way to do it is
Code:
on ^*:text:*:#terrortories:{
  if ($network == Funnet) { 
    scon $$get.scon(gamesnet.net)
    msg #terrortories $+(&lt;,$nick,&gt;) $1-
    scon -r
  }
}
Posted By: DaveC Re: optional <@network> parameter - 02/12/04 10:40 PM
yep i didnt focus on that i must admit, just looked at getting the msg to the right network, would be better to put the whole lot in an alias so hes just got a /msg.network networkname reciever message, and it does all that in it etc etc
Posted By: TroyBoy Re: optional <@network> parameter - 07/12/04 04:30 PM
$network doesnt work on all networks.
I think it was "newnet" that didnt allow it for some reason.
I didnt get any answer from their help channel as to why it doesnt work.
Posted By: Mentality Re: optional <@network> parameter - 07/12/04 05:45 PM
Hm, works here, although I didn't try all their servers.

As far as I know, it's a line in the IRCd which sets the network's name and where mIRC gets $network from.

Regards,
Posted By: theRat Re: optional <@network> parameter - 09/12/04 12:01 PM
005 numeric contains network, if it does $network will be filled from there, if not, mIRC looks the server from servers.ini and if found uses the group as $network.

IRCnet didn't suppot 005 in the past, don't know what the situation is today.
Posted By: Iori Re: optional <@network> parameter - 09/12/04 01:47 PM
mIRC can also get the network name from numeric 001, the original method of obtaining it - apart from the group name in servers.ini. laugh
© mIRC Discussion Forums