|
Er1C
|
Er1C
|
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.
|
|
|
|
DaveC
|
DaveC
|
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.
|
|
|
|
Er1C
|
Er1C
|
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 !!
|
|
|
|
Er1C
|
Er1C
|
what is the meaning of $v2 ?
|
|
|
|
Joined: Nov 2003
Posts: 2,321
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,321 |
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)) $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".
|
|
|
|
Er1C
|
Er1C
|
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,321
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,321 |
Scrap the code you have so far, it has a security problem. Try this: 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.
|
|
|
|
Er1C
|
Er1C
|
Works smoothly, both nuke and pre now. Thank you so much !
|
|
|
|
Er1C
|
Er1C
|
And then another question, what if I want to send this too another channel as well.
|
|
|
|
DaveC
|
DaveC
|
it has a security problem. Oh dear, it did indeed, slipped right on past me, good catch.
|
|
|
|
Er1C
|
Er1C
|
hehe ok but how can i let this work for another channel too?
|
|
|
|
DaveC
|
DaveC
|
on $*:text:/\[(PRE|NUKE)\]/iS:#chan1,#chan2,#chan3,#chan4:{
var %text = $strip($1-)
scon 2 msg #destinationchan % $+ text
}
|
|
|
|
Er1C
|
Er1C
|
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
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.
|
|
|
|
DaveC
|
DaveC
|
on $*:text:/\[(PRE|NUKE|UNNUKE)\]/iS:#CHANNELSOURCE:{
var %text = $strip($1-)
/scon 2 /msg #CHANNEL1 % $+ text
msg #CHANNEL2 %text
}
|
|
|
|
Joined: Nov 2003
Posts: 2,321
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,321 |
Some networks allow multiple targets in a PRIVMSG (/msg) command, so you might also like to try the following; on $*:text:/\[(PRE|NUKE|UNNUKE)\]/iS:#CHANNELSOURCE:{
var %text = $strip($1-)
scon 2 msg #CHANNEL1,#CHANNEL2 % $+ text
}
|
|
|
|
DaveC
|
DaveC
|
oops channel2 was on network #1 tho 
|
|
|
|
Bi4a
|
Bi4a
|
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,013
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,013 |
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
|
|
|
|
Bi4a
|
Bi4a
|
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,013
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,013 |
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.
|
|
|
|
Bi4a
|
Bi4a
|
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,013
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,013 |
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.
|
|
|
|
Bi4a
|
Bi4a
|
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,013
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,013 |
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:
on *:text:*:#chat:{
if $network == efnet {
; find the cid of network irclv where you are on #channel
scon -at1 if ($network == irclv) && ($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 -> $+(<,$nick,> :) $1-
; Reset the active connection to the original one
scon -r
}
}
}
|
|
|
|
Bi4a
|
Bi4a
|
heh well it's adress is irc.lv:6667 and your command reply the following : IRCLV
|
|
|
|
Bi4a
|
Bi4a
|
well thanks  it works  many thanks!
|
|
|
|
Bi4a
|
Bi4a
|
well i've gopt another question i'm using this script
on *:text:*:#chat:{
if $network == efnet {
; find the cid of network irclv where you are on #channel
scon -at1 if ($network == irclv) && ($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 -> $+(<,$nick,> :) $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
|
|
|
|
TryinToLearn
|
TryinToLearn
|
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. 
|
|
|
|
|