mIRC Home    About    Download    Register    News    Help

Print Thread
#149428 18/05/06 06:59 PM
Joined: May 2006
Posts: 1
N
NaKrull Offline OP
Mostly harmless
OP Offline
Mostly harmless
N
Joined: May 2006
Posts: 1
I want a scirpt, that kicks certain players when they say a certain word.

#149429 18/05/06 07:15 PM
Joined: May 2005
Posts: 449
Fjord artisan
Offline
Fjord artisan
Joined: May 2005
Posts: 449
Code:
on 1:text:*:#:{
  if ($read,w,word.txt,* $+ $1- $+ *)  { 
kick $chan $nick
}
}

This assumes that you have a file in your mIRC directory called word.txt. You can change that to whatever you want.

Last edited by bwr30060; 18/05/06 07:16 PM.
#149430 18/05/06 08:55 PM
Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
Don't you mean $read(word.txt,w,$+(*,$1-,*)) ? Besides that, I'm not sure why you would want to be doing a wildcard check on the entire line of text. It's not going to find these words unless they are by themselves in this case. And what if he isn't opped? He'll get an error message.


To the original poster: use the search link at the top as there are about 5000 other topics on here for this exact same thing.

Joined: May 2005
Posts: 449
Fjord artisan
Offline
Fjord artisan
Joined: May 2005
Posts: 449
Post deleted by bwr30060

#149432 18/05/06 09:06 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
No you made a logical thinking mistake.

With $read(..,w,* $+ $1- $+ *) you will compare the *the entire line* to each line in the text file. But the text file will contain individual words (like a swear word) on each line.

If a person says a swearword in his sentence, then this sentence will never match any swear word in the text file, because well, how can a whole sentence match 1 word right?

What you'd really want to do is the opposite: do a search to see if any of the words in the text file match the sentence said, instead of the other way round. So just that you're clear on the matter: the matchtext that you used in the $read, will check if the entire sentence matches the lines in the text file, which can never happen, unless the sentence was a single word. Since most sentences aren't single words, this is not the right way to go.

I don't think people correct you because of a power trip, rather they try to help the people with good advice, not misinform them. Everyone makes mistakes though, that's ok, but don't look the other way when people correct you.

Anyway, this sort of thing has been done a zillion times before, so schaefer is right when he advises to use the Search feature.


Gone.
Joined: May 2005
Posts: 449
Fjord artisan
Offline
Fjord artisan
Joined: May 2005
Posts: 449
Post deleted by bwr30060

Last edited by bwr30060; 18/05/06 09:14 PM.
#149434 18/05/06 09:14 PM
Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
Your code will trigger on any word regardless of if they are in the text file.

#149435 18/05/06 09:14 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Try this:

Code:
//write words.txt $+(is,$lf,test) | echo -a > $read(words.txt,nw,*this is a test*)


The matchtext sentence even contains both words in the text file, yet you clearly see it doesn't match wink


Gone.
#149436 20/05/06 04:11 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Not to self promote, but maybe this script will help?


-KingTomato

Link Copied to Clipboard