mIRC Home    About    Download    Register    News    Help

Print Thread
Using several events in a single script #268572 16/03/21 09:59 PM
Joined: Mar 2021
Posts: 9
S
saner Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2021
Posts: 9
Hello everyone thanks first for the posted scripts as
single script is this script working

but I have problem to post several things in my channel together because there is a script for me
just thought to insert several single scripts in one script file

So I tried it, but then only the first script code will be posted in my channel and the others underneath will not work

Quote

### this channel on iRC-NETWORK-3 ###
ALL INTO ONE TO MY CHANNEL #[PREADD] posting
-------------------------------------------------------------------------------
### this channel on iRC-NETWORK-1 ###
on *:TEXT:*:##XX-Pre:{ if ([PRE] isin $strip($1-)) { scon 2 msg #[PREADD] $v2 } }

### this channel on iRC-NETWORK-1 ###
on *:TEXT:*:##XX-Pre:{ if ([UNNUKE] isin $strip($1-)) { scon 2 msg #[PREADD] $v2 } }

### this channel on iRC-NETWORK-1 ###
on *:TEXT:*:##XX-Pre:{ if ([NUKE] isin $strip($1-)) { scon 2 msg #[PREADD] $v2 } }

### this channel on iRC-NETWORK-2 ###
on *:TEXT:*:#Pre-Spam:{
if (GENRE: isin $strip($1-)) { /scon 2 /msg #[PREADD] $v2 } }

### this channel on iRC-NETWORK-2 ###
on *:TEXT:*:#Pre-Spam:{
if (INFO: isin $strip($1-)) { /scon 2 /msg #[PREADD] $v2 } }



Quote

### this channel on iRC-NETWORK-2 ###
ALL INTO ONE TO MY CHANNEL #[PREADD] posting
-------------------------------------------------------------------------------

### this channel on iRC-NETWORK-1 ###
on *:TEXT:*:#Pre:{
if (PRE: isin $strip($1-)) { /scon 2 /msg #[PREADD-2] $v2 } }

### this channel on iRC-NETWORK-1 ###
on *:TEXT:*:#Pre.Spam:{
if (GENRE: isin $strip($1-)) { /scon 2 /msg #[PREADD-2] $v2 } }

### this channel on iRC-NETWORK-1 ###
on *:TEXT:*:#Pre.Spam:{
if (INFO: isin $strip($1-)) { /scon 2 /msg #[PREADD-2] $v2 } }

### this channel on iRC-NETWORK-1 ###
on *:TEXT:*:#Pre.Nuke:{
if (NUKE: isin $strip($1-)) { /scon 2 /msg #[PREADD-2] $v2 } }



greets
saner

Re: Using several events in a single script [Re: saner] #268584 19/03/21 02:46 PM
Joined: Jan 2004
Posts: 1,561
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,561
you can put several different kind of events in a channel, but each type of event can trigger only once per scriptfile. So you'll need to either put these into different scriptfiles, or merge everything into 1 event. You can do like below. What's not clear is whether you are wanting to send a message multiple times if it contains 2 or more of these labels. Also not clear is whether you want to have the msg sent to the destination channel on the same network where the message originates, or whether you want it to have messages from several networks going to 1 channel at 1 network. You'd need to either use /scon or /scid to send the messages to the other network/#channel or send the messages to a @Queue window from where a different timer script checks that window to display them in the destination.

https://en.wikichip.org/wiki/mirc/commands

If you use /scon or /scid, you'd need to take steps to avoid having your message risk being evaluated which could either mess up the display, or when people see that your messages are being evaluated, they could take steps to create a script which could evaluate something dangerous for you. Parking messages in the @queue window would avoid the evaluation problem, and also allows you to have the relayed messages be spaced far enough apart to avoid flooding - though you can also defend against this by enabling flood protection options/irc/flood

Code
on *:TEXT:*:#:{

var %strip $strip($1-)

if (($network == network1) && ($chan == #channelA)) {
    if ([NUKE] isin %strip) { scon 2 msg #[PREADD] $v2 }
elseif ([UNNUKE] isin %strip) { scon 2 msg #[PREADD] $v2 } }
elseif ([PRE] isin %strip) { scon 2 msg #[PREADD] $v2 }
}

if (($network == network1) && ($chan == #channelB)) {
    if ([NUKE] isin %strip) { scon 2 msg #[PREADD] $v2 }
elseif ([UNNUKE] isin %strip) { scon 2 msg #[PREADD] $v2 } }
elseif ([PRE] isin %strip) { scon 2 msg #[PREADD] $v2 }
}

if (($network == network2) && ($chan == #channelA)) {
    if ([NUKE] isin %strip) { scon 2 msg #[PREADD] $v2 }
elseif ([UNNUKE] isin %strip) { scon 2 msg #[PREADD] $v2 } }
elseif ([PRE] isin %strip) { scon 2 msg #[PREADD] $v2 }
}





 }

Re: Using several events in a single script [Re: maroon] #268589 19/03/21 10:23 PM
Joined: Mar 2021
Posts: 9
S
saner Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2021
Posts: 9
Hi
thank you for the answer
let's Pmsg. keep writing otherwise it will be confusing here in the posting

love from
s4n3r

Re: Using several events in a single script [Re: maroon] #268590 19/03/21 10:23 PM
Joined: Jan 2004
Posts: 1,561
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,561
update: an older thread related to something like this is:

https://forums.mirc.com/ubbthreads.php/activetopics/30/1

Re: Using several events in a single script [Re: maroon] #268591 20/03/21 11:45 AM
Joined: Mar 2021
Posts: 9
S
saner Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2021
Posts: 9
I can't find what I'm looking for in your old posting
So I need network 1 source with prechannel where pre / nuke / unnuke is posted and should be posted on network2 in a channel

Re: Using several events in a single script [Re: saner] #268592 20/03/21 12:36 PM
Joined: Jan 2004
Posts: 1,561
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,561

Re: Using several events in a single script [Re: maroon] #268593 20/03/21 08:38 PM
Joined: Mar 2021
Posts: 9
S
saner Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2021
Posts: 9
Code
on *:TEXT:*:#firstchannel:{
  if $network == firstnetwork { scid -at1 relay $unsafe($chan $1-) }
}

alias -l relay {
  if $network == secondnetwork && $me ison #secondchannel {
    msg #secondchannel ( $1 ) $2-
  }
}


Hi I found the script in your link
that is already very good for a function!

What is the code if I have 3 channels in ircnetwork1 and want to have them in one channel in ircnetwork2?

thanks in advance

ADD MSG
hi got the script that i posted last just loaded but not working
with network only because network name or irc address ???

greets


Last edited by saner; 20/03/21 08:49 PM.
Re: Using several events in a single script [Re: saner] #268594 21/03/21 01:32 AM
Joined: Jan 2004
Posts: 1,561
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,561
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)

Code
;$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-

Code
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) }
}

Re: Using several events in a single script [Re: maroon] #268595 21/03/21 02:05 AM
Joined: Mar 2021
Posts: 9
S
saner Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2021
Posts: 9
THX

Good work ;-)

okay one I need something else I write for network only Efnet or irc.efnet.org ???

I still have a question what does "$ unsafe" mean ???

love greets

Last edited by saner; 21/03/21 02:08 AM.
Re: Using several events in a single script [Re: saner] #268596 21/03/21 03:03 AM
Joined: Jan 2004
Posts: 1,561
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,561
It is comparing $network with network1, so you need to change network1 to whatever the $network string shows: //echo -a $network

The $unsafe() prevents the /scon command, or a timer, from causing any string within $1- to be evaluated. Otherwise, any word beginning with $ could be executed simply by being in the /scon or /timer command line, or the word beginning with % could reveal the content of any of your global variables. It prevents these evaluates by mime-encoding the string before placing it into the timer's command line, but then decoding the string after it gets there. This next example shows that the timer contains a word beginning with a dollar which gets evaluated into the result. However using $unsafe() prevents the word from being changed. The same thing would happen by placing the ON TEXT's $1- into the /scon command line

Code
//tokenize 32 foo $ $+ version bar | echo 4 -a $ $+ 1- is: $1- | .timerfoo1 1 1 echo -a literal $1- | .timerfoo2 1 1 echo -a unsafed: $unsafe($1-) | timerfoo?



edit: the $network will of course be different on each network, so the network1 is the value of $network on the network where the ON TEXT triggers.

Last edited by maroon; 21/03/21 03:24 AM.
Re: Using several events in a single script [Re: maroon] #268729 15/04/21 09:06 PM
Joined: Mar 2021
Posts: 9
S
saner Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2021
Posts: 9
hello maroon
can you help me for last i hope this working then




Yours, what am I doing wrong, I'll do a resolution like network and channel are called
of which I would like to copy a copy in a different irc network in a channel

Here is the network source
ircnetwork = XLroot.ix is a PRIVATE irc server itself houster
Source CHannels in this network
first channel = ## XL-Pre and all ANNOUCES in this channel with [PRE] to the second network in one channel
Secound CHannel = ## XL and the ANNOUNCE with [XL] all in the other network to one channel


announce the two channel to my IRC NETWORK in one channel together please
ircnetwork = LinkNet is the target network irc
The two source irc channels and the ANNOUNCE secound
to my one channel in this network the channekl # a4e-4T
in this channel the two channel source to my channel

so i hope you understand my concern and can send me a ready-made script for meibn mirc or post it in the forum

greets
Saner

Re: Using several events in a single script [Re: saner] #268730 16/04/21 12:37 AM
Joined: Jan 2004
Posts: 1,561
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,561
I'm sorry, I have trouble understanding what you wrote

Re: Using several events in a single script [Re: saner] #268731 16/04/21 07:57 AM
Joined: Jan 2012
Posts: 122
Epic Online
Vogon poet
Online
Vogon poet
Joined: Jan 2012
Posts: 122
Since your task is quite confusing, I'm suggest you try to depict the graphic schema (plan) in the form of a picture of what you would like to get as a result from the work of the created script.
Perhaps this will be clearer and understandable in any language, to be able to help you.

Example:
         [Linked Image from i.ibb.co]


🅸🆁🅲 - 𝔦'𝔱𝔰 𝔸 𝕂𝖎ɴ𝙙 ᴏ𝙛 𝕄𝙖𝖌𝙞𝙘