mIRC Home    About    Download    Register    News    Help

Topic Options
#201159 - 21/06/08 03:49 PM SVSNICK on Badnicks
Joe_Dean Offline
Vogon poet

Registered: 04/05/08
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.

Top
#201180 - 22/06/08 01:09 AM Re: SVSNICK on Badnicks [Re: Joe_Dean]
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
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?

Top
#201183 - 22/06/08 02:02 AM Re: SVSNICK on Badnicks [Re: Joe_Dean]
Tomao Offline
Hoopy frood

Registered: 07/07/07
Posts: 1129
Loc: United States
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.


Edited by Tomao (22/06/08 02:03 AM)

Top
#201193 - 22/06/08 06:56 AM Re: SVSNICK on Badnicks [Re: Tomao]
Joe_Dean Offline
Vogon poet

Registered: 04/05/08
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).

Top
#201194 - 22/06/08 07:03 AM Re: SVSNICK on Badnicks [Re: Joe_Dean]
Tomao Offline
Hoopy frood

Registered: 07/07/07
Posts: 1129
Loc: United States
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.


Edited by Tomao (22/06/08 07:04 AM)

Top
#201195 - 22/06/08 08:19 AM Re: SVSNICK on Badnicks [Re: Joe_Dean]
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
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.

Top