|
Joined: Jun 2007
Posts: 9
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Jun 2007
Posts: 9 |
Hi everybody i have a little problem i use this script for notice me when a person write my nick in a channel. on *:text:*:#:{
if ($me isin $1-) && ($chan !== $active) && ($nick != $read(Ti.Cercano.txt, r, $nick)) { //echo -a $timestamp [10iNFO]8 $nick 10su11 $chan 10sta dicendo: 12«11 $left($$1-,77) $+ ... 12» }
}
on *:action:*:#:{
if ($me isin $1-) && ($chan !== $active) { //echo -a $timestamp 10[10T10i 10H10a 10C10ercato8 $nick 10s10u 11 $chan $+ 10] 10s10ta 10d10icendo: $left($$1-,77) $+ ... 12» }
}
on *:notice:*:#:{
if ($me isin $1-) && ($chan !== $active) { //echo -a $timestamp 10[10T10i 10H10a 10C10ercato8 $nick 10s10u 11 $chan $+ 10] 10s10ta 10d10icendo: $left($$1-,77) $+ ... 12» }
}
the problem is that some nicks in Ti.Cercano.txt like |TEST| not work with this script, there are a solution, without use ? Thanks in advance
|
|
|
|
Joined: Oct 2003
Posts: 3,918
Hoopy frood
|
Hoopy frood
Joined: Oct 2003
Posts: 3,918 |
what made you use the 'r' switch in your $read? You'll find that that's the problem with nicks like that. If you read the help on $read you'll find the switch you need to use.
- argv[0] on EFnet #mIRC - "Life is a pointer to an integer without a cast"
|
|
|
|
Joined: Nov 2006
Posts: 1,559
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
At the moment you $read for a regex match (r switch): scan for the regular expression "$nick" in the text file. The char | (amongst other chars) is a "metachar" in regular expressions - it hasn't the literal meaning of a pipe. As you compare this match against the full nickname, I assume you want to match full nicknames that shall be excluded - so you may use for example "&& (!$read(Ti.Cercano.txt,w,$nick))". If you want a different matching method - please provide an example / description
|
|
|
|
Joined: Jun 2007
Posts: 9
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Jun 2007
Posts: 9 |
At the moment you $read for a regex match (r switch): scan for the regular expression "$nick" in the text file. The char | (amongst other chars) is a "metachar" in regular expressions - it hasn't the literal meaning of a pipe. As you compare this match against the full nickname, I assume you want to match full nicknames that shall be excluded - so you may use for example "&& (!$read(Ti.Cercano.txt,w,$nick))". If you want a different matching method - please provide an example / description whit it i have this error (!$READ(TI.CERCANO.TXT, Unknown command i only want that script ignore all nicks in ti.cercano.txt, if possible. thanks for the support horstl and argv0
|
|
|
|
Joined: Nov 2006
Posts: 1,559
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
This code was meant to replace the condition "&& ($nick != $read(Ti.Cercano.txt, r, $nick))" in the line of your code that starts with: if ($me isin $1-) && ($chan !== $active) && ($nick != $read(Ti.Cercano.txt, r, $nick)) { .... In addition, I assumed you have the nicks-to-exclude in your textfile in the format: nick1
anothernick
nick3
... Is this correct?
|
|
|
|
Joined: Jun 2007
Posts: 9
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Jun 2007
Posts: 9 |
with this code not work nicks with | char
|
|
|
|
Joined: Nov 2006
Posts: 1,559
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
I don't understand why it should fail. Please try the following complete, modified on text event. I only changed the output a bit. Replace your current on text event with this one. on *:text:*:#:{
if (($me isin $1-) && ($chan != $active) && (!$read(Ti.Cercano.txt,w,$nick))) {
echo -ta [10iNFO]08 $nick 10su11 $chan 10sta dicendo: 12«11 $iif(($len($1-) <= 77),$1-,$left($1-,77) $+ ...) 12»
}
}
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
It's failing, due to the fact that mIRC is evaluating the | character as a pipe (command separator).
Include the n switch with the w in the $read to prevent this.
|
|
|
|
Joined: Nov 2006
Posts: 1,559
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,559 |
Without the n switch mIRC evaluates the line read - now this code does nothing with the line read but check if there's a match at all. Adding the n switch doesn't hurt (in fact it's a good habit), but it's absence won't make the code fail for nicks that contain a pipe char (or consist of a single pipe char). //write -c test.txt $chr(124) | write test.txt abc| | echo -a $iif($read(test.txt,w,|),match) ... $iif($read(test.txt,w,abc|),match)
Last edited by Horstl; 22/02/09 08:54 PM.
|
|
|
|
Joined: Oct 2003
Posts: 3,918
Hoopy frood
|
Hoopy frood
Joined: Oct 2003
Posts: 3,918 |
I don't really get it, you've completely ignored our suggestions but still claim you have a problem? Have you looked at the help and realized you were using the wrong switch? do you know which switch you should be using yet?
- argv[0] on EFnet #mIRC - "Life is a pointer to an integer without a cast"
|
|
|
|
|