Modified the /relay alias so it can handle any combo of in/out called from any script. By starting out with a generous framework, you can avoid the need to make a lot of edits later on if you need to add capability.
Removed the -l so it's no longer a local, and can be executed from any script.
The $3 in.network is there in case you want to have it show the source network name too.
It's called by /scon -at1 relay $unsafe( out.net out.chan in.net in.chan msg.type MSG )
The -at1 executes at all networks which are CONNECTED, so it needs to know which network to show the message into.
The $$ in $$6- causes it to halt the output if the message is empty. It can't be in these cases, but could be in the event you ever want to relay 100% of a #channel's activity.
The $5 msg.type allows /relay to create different kind of outputs for different things. So far I've only created things for type=1 and type=2 where the output changes from (#fromchan) to (#fromchan@fromnet)
;$1 = out.network $2 = out.channel $3 in.network $4 in.channel $5 msg.type $6- MSG
alias relay {
if (($5 == 1) && ($network == $1) && ($me ison $2)) { msg $2 ( $+ $4 $+ ) $$6- }
if (($5 == 2) && ($network == $1) && ($me ison $2)) { msg $2 ( $+ $+($4,@,$3) $+ ) $$6- }
}
These are the ON TEXT that would call the /relay script. The /elseif are needed to keep the message from repeating twice if it contains both keywords. You can make it a little more efficient by changing the matchtext to limit the number of times the event gets triggered. You can be more accurate by using regex, but for wildcards in this case, you can see that all 3 keywords contain the letter E, so you can change the matchfield from :*: to :*[*E]*:
For the next channel they both contain N and a colon, however you can't use the colon because of confusing the EVENT syntax, so you can change the matchfield from :*: to :*N*:
If you want the output to contain the original person's nick, you can simply change the parameters sent to the /relay command.
from: $v2
to: $nick $v2
You can either have the nick be formatted in each ON TEXT like $+(<,$nick,>) or in the output changing $$6- to $+(<,$6,>) $$7-
on *:TEXT:*:##XX-Pre:{
var %strip $strip($1-)
if (($network == network1) && ([PRE] isin %strip)) { scid -at1 relay $unsafe( network3 #[PREADD] $network $chan 1 $v2) }
elseif (($network == network1) && ([UNNUKE] isin %strip)) { scid -at1 relay $unsafe( network3 #[PREADD] $network $chan 1 $v2) }
elseif (($network == network1) && ([NUKE] isin %strip)) { scid -at1 relay $unsafe( network3 #[PREADD] $network $chan 1 $v2) }
}
I gave a simplistic example of having 2 channels of the same name at 2 different networks. If you wished, you could have the relay output moved anywhere you want simply by editing their relay parms
on *:TEXT:*:#Pre-Spam:{
var %strip $strip($1-)
if (($network == network1) && (GENRE: isin %strip)) { scid -at1 relay $unsafe( network3 #[PREADD] $network $chan 1 $v2) }
elseif (($network == network1) && (INFO: isin %strip)) { scid -at1 relay $unsafe( network3 #[PREADD] $network $chan 1 $v2) }
if (($network == network2) && (GENRE: isin %strip)) { scid -at1 relay $unsafe( network3 #[PREADD] $network $chan 1 $v2) }
elseif (($network == network2) && (INFO: isin %strip)) { scid -at1 relay $unsafe( network3 #[PREADD] $network $chan 1 $v2) }
}