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.
Joined: Jul 2005
Posts: 7
B
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
B
Joined: Jul 2005
Posts: 7
i want to echo a line from a server on example efnet network(or even all lines) to another channel on another server (for example on irc.lv network
like this topic was about it.
there are many variants of script in this topic and noone seems to work for me.
like i said already i'm a newbie and could not get things work right by myself.

Last edited by Bi4a; 14/07/05 02:55 PM.
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
What is the name of the network that you want to relay messages too?

In your example you are using a $cid of 2, but you don't realise that this can change with different sessions of mIRC or even in the same session of mIRC...

The multi-server scripting explanation can be found in the help file, type /help $cid, but it will be too hard for you to understand at this point.

I can see from your example, that you want to relay text from network EFnet, channel #chat, to another network. Tell me which network and channel, and I'll cook it up for you.


Gone.
Joined: Jul 2005
Posts: 7
B
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
B
Joined: Jul 2005
Posts: 7
yes you're correct
i want to relay text from channel #chat on irc.efnet.nl (i always use this server) network to channel #tempchan (as an example, i'll change it later) on irc.lv network

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Are you sure irc.lv is the name of the network?

On that network, type //echo -a $network

and let me know what it says.

Here's an example:
Code:
on *:text:*:#chat:{
  if $network == efnet {
    ; find the cid of network irclv where you are on #channel
    scon -at1 if ($network == irclv) &amp;&amp; ($me ison #channel) var % $+ cid = $!cid
    if %cid { 
     ; Set the active connection to network irclv
      scid %cid
     ; Relay the message on  #channel
      msg #channel Relay from #chat on Efnet -&gt; $+(&lt;,$nick,&gt; :) $1-
     ; Reset the active connection to the original one
      scon -r
    }
  }
}



Gone.
Joined: Jul 2005
Posts: 7
B
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
B
Joined: Jul 2005
Posts: 7
heh well it's adress is irc.lv:6667 and your command reply the following : IRCLV

Joined: Jul 2005
Posts: 7
B
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
B
Joined: Jul 2005
Posts: 7
well thanks smile it works wink
many thanks!

Joined: Jul 2005
Posts: 7
B
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
B
Joined: Jul 2005
Posts: 7
well i've gopt another question

i'm using this script
Code:
on *:text:*:#chat:{
  if $network == efnet {
    ; find the cid of network irclv where you are on #channel
    scon -at1 if ($network == irclv) &amp;&amp; ($me ison #channel) var % $+ cid = $!cid
    if %cid { 
     ; Set the active connection to network irclv
      scid %cid
     ; Relay the message on  #channel
      msg #channel Relay from #chat on Efnet -&gt; $+(&lt;,$nick,&gt; :) $1-
     ; Reset the active connection to the original one
      scon -r
    }
  }
}


and it works fine, but what should i change if i want to catch only special line that are in color or bold (script now cathes all lines from the channel).
For example i need to catch these line (test)
tried to change first line to
on *:text:(test):#chat:{
but nothing happens cuz it's in yellow color

Joined: Aug 2006
Posts: 1
T
Mostly harmless
Offline
Mostly harmless
T
Joined: Aug 2006
Posts: 1
Well I've been reading this discussion on how to echo and I get most of the part. My question is How can I echo a Specific Part of A Line

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

I understand the above code will show everything that has the 1st word PRE/NUKE, but what if I want to only see PRE's from something specific.

Example (used from Er1C's post):
[PRE]::[DVX/UNKNOWN]::[Battlefield 2 GAMEGUiDE DVX]::[06/21/05 20:13:11]

What if i only wanted to see PRE's from only DVX how would i go about entering that in a code? I'm confused myself on how to go about with this because its easier to echo the 1st word because it says PRE, but what about the last word, DVX. Any help is greatly appreciated. smile

Page 1 of 2 1 2

Link Copied to Clipboard