mIRC Home    About    Download    Register    News    Help

Print Thread
#201159 21/06/08 02:49 PM
Joined: May 2008
Posts: 127
J
Vogon poet
OP Offline
Vogon poet
J
Joined: May 2008
Posts: 127
Basically very similar to a swear protection script, where I add a bunch of wildcarded words to a file but use an on NICK/JOIN event, and if the nick has part or full of the wildcarded word from the file, the bot will use SVSNICK to change the users nick.

I'm not quite sure how I'd get this to work... would you use the $read identifier for something like this, and if so, how would you use it? I tried downloading some swear protection scripts, but they all use all these variables and stuff -- I just want something very very very simple; no dialogs or anything.

Any help is appreciated. Thanks.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Do you want to check if the nick is contained in the list, or if there is an option in the list that is contained in the nick? or both possibilities. The hardest one to code would be for the one where both possibilities need to be accounted for. Additionally, where would the bot obtain the nick that it has to supply to svsnick for the replacement nick?

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
perhaps something like this:

Code:
on *:JOIN:#: {
  var %b = /^(word1|word2|word3|word4)/i
  if ($regex($nick,%b)) { do something here }
}


You can add as many variable lines as you like in the same format.

Last edited by Tomao; 22/06/08 01:03 AM.
Joined: May 2008
Posts: 127
J
Vogon poet
OP Offline
Vogon poet
J
Joined: May 2008
Posts: 127
@RusselB: Not sure what you mean - both of those mean the same, to me at least. If full or partial of the nick is in the file (hence marked as a bad nick), it must be changed via SVSNICK - much like how a swear protection script would work, only we're using 'on NICK/JOIN' events instead of an 'on TEXT' event.

@Tomao: I don't want to have the words in the script as there will be many words; I want to add them to a seperate file.

Something like this would work perfectly, only I don't know how to correctly use the $read identifier to do a correct wildcard search.

http://www.paste.mircscripting.info/index.php?id=2989

If I used something like '$read(txt\badnicks.txt,w,* $+ $nick $+ *)', a users nick would only be changed if their entire nick was in the file, with optional characters before or after the actual nick. For example:

Quote:

xXxDickheadxXx has joined #chat


..and say in badnicks.txt we have 'dick' on one line... their nick wouldn't change unless their nick was something like: xXxDickxXx, DickXXX, xXx1337dick (because 'head' is not in any of these nicks).

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
You may be able to use a hash table for this kind of operation. I know RusselB is good with it. Perhaps he can assist you better.

Using text file to reference is slower in my opinion.

Last edited by Tomao; 22/06/08 06:04 AM.
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
The two are not the same. Here's an example of each.

Nick: Dickhead
Search: Dick

Using $+(*,$nick,*) would not match, since the dickhead is not in dick.
Using $+(*,%search,*) would match, since dick is in dickhead

As to a code, give this a try.. I'm unable to test it as I don't have access to svsnick at the moment.
Code:
on *:start:{
  if !$hget(BadNick) { .hmake BadNick 100 }
  if $exists(BadNick.hsh) { .hload BadNick BadNick.hsh }
}
on *:text:!addbadnick*:*:{
  .hadd -m BadNick $$2 $true
  .hsave BadNick BadNick.hsh
}
on *"text:!delbadnick*:*:{
  .hdel BadNick $$2
  .hsave BadNick BadNick.hsh
}
on *:text:!listbadnick:*:{
  .play $nick BadNick.hsh
}
on *:join:#:{
  if $hfind(BadNick,$nick,W) {
    .hinc BadNick 0
    svsnick $nick $+($network,$hget(BadNick,0))
  }
}
on *:nick:{
  if $hfind(BadNick,$newnick,W) {
    .hinc BadNick 0
    svsnick $nick $+($network,$hget(BadNick,0))
  }
}


This should change the nick to a nick that matches the name of the network followed by an incrementing number, rather than a random number as suggested in your post, as using a random number might cause the same number to be used more than once.


Link Copied to Clipboard