mIRC Homepage
Posted By: NaKrull Kick on certain words - 18/05/06 06:59 PM
I want a scirpt, that kicks certain players when they say a certain word.
Posted By: bwr30060 Re: Kick on certain words - 18/05/06 07:15 PM
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.
Posted By: schaefer31 Re: Kick on certain words - 18/05/06 08:55 PM
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.
Posted By: bwr30060 Re: Kick on certain words *DELETED* - 18/05/06 09:00 PM
Post deleted by bwr30060
Posted By: FiberOPtics Re: Kick on certain words - 18/05/06 09:06 PM
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.
Posted By: bwr30060 Re: Kick on certain words *DELETED* - 18/05/06 09:13 PM
Post deleted by bwr30060
Posted By: schaefer31 Re: Kick on certain words - 18/05/06 09:14 PM
Your code will trigger on any word regardless of if they are in the text file.
Posted By: FiberOPtics Re: Kick on certain words - 18/05/06 09:14 PM
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
Posted By: KingTomato Re: Kick on certain words - 20/05/06 04:11 PM
Not to self promote, but maybe this script will help?
© mIRC Discussion Forums