mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
Joined: May 2005
Posts: 25
E
Er1C Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2005
Posts: 25
Hi!

I'm using a script that copies whole lines from a channel on servera to a channel on serverb.

on 1:TEXT:*PRE*: #CHANNELONSERVERA:{
if ((Pre isin $strip($1))) { /scon 2 /msg #CHANNELONSERVERB $strip($1-) }
}

This works.

BUT, it sends also lines I don't want.

These are the lines I want:

[PRE]::[DVX/UNKNOWN]::[Battlefield 2 GAMEGUiDE DVX]::[06/21/05 20:13:11]

and I don't want these lines:

!pre spurs

and

[PRETiME]::[SERiES-US]::[NBA.Finals.2005.Spurs.vs.Pistons.Game.5.HDTV.XViD-VSS]::[1d 9h 56m 39s ago]::[06/20/2005]

So I'm using on 1:TEXT:*PRE* in my script and want only the lines with [PRE] so I changed it to *[PRE]* but then it doesn't work. Howcome? Also [PRE] without the wildcards doesn't work.

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
on *:TEXT:*[PRE]*:#CHANNELONSERVERA:{ scon 2 msg #CHANNELONSERVERB $strip($1-) }
This well catch only lines with [PRE] (case insensitive) in them.
HOWEVER if there is colors in the line as in [PRE] then it wont match. becuase the color is characters.

on *:TEXT:*:#CHANNELONSERVERA:{ if ([PRE] isin $strip($1-)) { scon 2 msg #CHANNELONSERVERB $v2 } }
well match [PRE] being in with or without colors.

Joined: May 2005
Posts: 25
E
Er1C Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2005
Posts: 25
Quote:
on *:TEXT:*[PRE]*:#CHANNELONSERVERA:{ scon 2 msg #CHANNELONSERVERB $strip($1-) }
This well catch only lines with [PRE] (case insensitive) in them.
HOWEVER if there is colors in the line as in [PRE] then it wont match. becuase the color is characters.

on *:TEXT:*:#CHANNELONSERVERA:{ if ([PRE] isin $strip($1-)) { scon 2 msg #CHANNELONSERVERB $v2 } }
well match [PRE] being in with or without colors.


It was in colors indeed, the 2nd option works. FANTASTIC !!

Joined: May 2005
Posts: 25
E
Er1C Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2005
Posts: 25
what is the meaning of $v2 ?

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Take a look at the help file (the help file has a fairly decent explanation of almost everything, you can view help on a specific topic by typing /help <topic> (in this case /help $v2))

Quote:
$v1 & $v2

Returns the first and second parameters of an if-then-else comparison. So, in the case of this comparison:

if (text isin sometext) { ... }

$v1 will return "text" and $v2 will return "sometext".


New username: hixxy
Joined: May 2005
Posts: 25
E
Er1C Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2005
Posts: 25
Ok thanks!

But now I've got another problem.

There is another type of line I want to copy the same way. But now the word is [NUKE] instead of [PRE]. So I copied the first code and changed the words [NUKE].

But this doesn't work. I know [ and ] are in color and I use the 2nd solution you gave me.

What can be wrong?

-edit-

it looks like this

on *:TEXT:*:#chan1:{
if ([PRE] isin $strip($1-)) { /scon 2 /msg #chan2 $v2 } }
}

on *:TEXT:*:#chan1:{
if ([NUKE] isin $strip($1-)) { /scon 2 /msg #chan2 $v2 } }
}

Last edited by Er1C; 21/06/05 09:29 PM.
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Scrap the code you have so far, it has a security problem.
Try this:

Code:
on $*:text:/\[(PRE|NUKE)\]/iS:#:{
  var %text = $strip($1-)
  scon 2 msg #chan2 % $+ text
}

Last edited by tidy_trax; 21/06/05 09:37 PM.

New username: hixxy
Joined: May 2005
Posts: 25
E
Er1C Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2005
Posts: 25
Works smoothly, both nuke and pre now. Thank you so much !

Joined: May 2005
Posts: 25
E
Er1C Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2005
Posts: 25
And then another question, what if I want to send this too another channel as well.

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
it has a security problem.


Oh dear, it did indeed, slipped right on past me, good catch.

Joined: May 2005
Posts: 25
E
Er1C Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2005
Posts: 25
hehe ok but how can i let this work for another channel too?

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Code:
on $*:text:/\[(PRE|NUKE)\]/iS:#chan1,#chan2,#chan3,#chan4:{
  var %text = $strip($1-)
  scon 2 msg #destinationchan % $+ text
}

Joined: May 2005
Posts: 25
E
Er1C Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2005
Posts: 25
no there is one source channel but i need to echo it to a 2nd channel, that's what i mean

-edit-

So it's looking like this now

Code:
  

on $*:text:/\[(PRE|NUKE|UNNUKE)\]/iS:#CHANNELSOURCE:{

  var %text = $strip($1-)

  /scon 2 /msg #CHANNEL1 % $+ text

}



i need to send it to #CHANNEL2 too, on the same server as #CHANNELSOURCE so not on another server like #CHANNEL1

Last edited by Er1C; 22/06/05 08:54 AM.
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Code:
on $*:text:/\[(PRE|NUKE|UNNUKE)\]/iS:#CHANNELSOURCE:{
  var %text = $strip($1-)
  /scon 2 /msg #CHANNEL1 % $+ text
  msg #CHANNEL2 %text
}

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Some networks allow multiple targets in a PRIVMSG (/msg) command, so you might also like to try the following;

Code:
on $*:text:/\[(PRE|NUKE|UNNUKE)\]/iS:#CHANNELSOURCE:{
  var %text = $strip($1-)
  scon 2 msg #CHANNEL1,#CHANNEL2 % $+ text
}


New username: hixxy
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
oops

channel2 was on network #1 tho frown

Joined: Jul 2005
Posts: 7
B
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
B
Joined: Jul 2005
Posts: 7
i've got a simple question.
i'm a newbie so all i want to know how exactly and where to put that script in
example where should i put the script in? in aliases.ini or in script ini or where?
and second how to write correctly the channel adress
on $*:text:/\[(a\]/iS:#chat irc.efnet.nl:
or simply like this, withour server name? or should i mention the servers name as well?
on $*:text:/\[(a\]/iS:#chat

thanks ahead!

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
That's an invalid regex you got there, since there's an opening bracket ( but not a closing one.

Where you put events, that is in the remote. In mIRC, press alt+r, which takes you to the scripts editor. Then navigate to tab "Remote" and paste the code there.

On text events are like: on <eventprefixes/userlevel>:text:<matchtext>:<location>:

So for you:

on $*:text:<some regex expression>:#chat:{
if ($network == efnet) {
; do things
}
}

I use a check for network being efnet, instead of $server == irc.efnet.nl, because you might not always be on that specific server on efnet.

For some more information about on text events, check here


Gone.
Joined: Jul 2005
Posts: 7
B
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
B
Joined: Jul 2005
Posts: 7
well i've tried to edit that but still nothing happens - maybe you'll shou me where's the mistake ?


on $*:text:*:#channel1 {
if ($network == irc.efnet.nl){ var %text = $strip($1-) scon 2 msg #channel2 {
if ($network == irc.lv) $+ text}
}
}

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
There are many mistakes:

First of all, since you are not using a regular expression as matchtext anymore, you should remove the $ event prefix. ALthough concidentally, in this case it is almost the same as if you wouldn't put the $ prefix, you should never use $ unless you'll use a regex pattern as matchtext.

Second,

if ($network == irc.efnet.nl){ var %text = $strip($1-) scon 2 msg #channel2 {

has many mistakes

$network returns a network, in this case, as I specifically said, it would return Efnet.
$server would return irc.efnet.nl, so as you see, that if comparison can never be true.

Thirdly, there must be a space between ) and {

Forth, you are setting a variable %text with value: $strip($1-) scon 2 msg #channel2 {
that doesn't seem right.

Fifth, if ($network == irc.lv) $+ text} doesn't make sense at all.... I don't even know what you want to do with that.

You should just tell us what you want to do, and we will code it for you, as this is going nowhere.


Gone.
Page 1 of 2 1 2

Link Copied to Clipboard