mIRC Home    About    Download    Register    News    Help

Print Thread
Relaying messages to (a) different server(s). #243475 23/11/13 05:22 PM
Joined: Aug 2013
Posts: 33
F
Farcrada Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Aug 2013
Posts: 33
Hello peeps!

Another question that I seek answers too. xD
So I've been going about for this all day long been searching Google and stuff, but I can't really find anything on it.

Now my questions is: Would it be possible or is there a code to send a message from one server to another without it writing and reading from a txt (Like I'm doing now.)?

So. If I post said message in server 1 in channel 200 I would like it to re-post the message in server 2 in channel 100. I have a feeling this is not possible seen as the commands go to the server you're connected on and not mIRC itself.

Thanks in advance for taking the time to read and (maybe) reply o this! <3
Farcrada

Re: Relaying messages to (a) different server(s). [Re: Farcrada] #243476 23/11/13 07:06 PM
Joined: Jan 2004
Posts: 1,327
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,327
Use the /scid command to switch the server connection the script is running on.

With scid you can either specify a connection id or use the -a switch to run the command on all connections. You can specify the command you want to run on the same line as /scid, or simply use it to switch servers and then program as usual afterward.

So you can either:

Code:
on *:connect:{
  if ($network == relay_to) { set %relay_to $cid }
}

on *:text:*:#:{
  if ($network == relay_from) {
    scid %relay_to msg #somechan $1-
    ;scid %relay_to
    ;msg #somechan $1-
  }
}

OR

on *:text:*:#:{
  if ($network == relay_from) {
    scid -a if ($network == relay_to) { msg #somechan $1- }
  }
}

Last edited by Loki12583; 23/11/13 07:08 PM.
Re: Relaying messages to (a) different server(s). [Re: Loki12583] #243522 25/11/13 01:13 AM
Joined: Oct 2012
Posts: 164
D
Deega Offline
Vogon poet
Offline
Vogon poet
D
Joined: Oct 2012
Posts: 164
Originally Posted By: Loki12583
You can specify the command you want to run on the same line as /scid
That is very unsafe, any $identifiers or %vars will be evaluated in the relayed msg.

Use the method that Loki commented out.
Code:
on *:text:*:#:{
  if ($network == relay_from) {
    scid %relay_to
    msg #somechan $1-
  }
}
Code:
on *:text:*:#:{
  if ($network == relay_from) { scid %relay_to | msg #somechan $1- }
}
OR
Use $safe($1-)
Code:
on *:text:*:#:{
  if ($network == relay_from) {
    scid -a if ($network == relay_to) { msg #somechan $safe($1-) }
  }
}
alias safe { bset -ct &a 1 $1 | return $!regsubex(safe, $bvar(&a,1-) ,/(\d+)(?: |$)/g,$chr(\1)) }


Re: Relaying messages to (a) different server(s). [Re: Deega] #243528 25/11/13 06:55 AM
Joined: Aug 2013
Posts: 33
F
Farcrada Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Aug 2013
Posts: 33
Holy shit! Thanks people! <3 Definitely helped me out!