mIRC Home    About    Download    Register    News    Help

Print Thread
#205710 29/10/08 09:23 AM
Joined: Nov 2003
Posts: 102
T
Vogon poet
OP Offline
Vogon poet
T
Joined: Nov 2003
Posts: 102
I am in need of a script that will scan ALL the users in my channel every 60 seconds - 5min (not sure what would work best) seconds or minutes. But anyways i want it to scan my channel for users in a banned channel and i want it to kick them and send a msg to them telling them why they was kicked. I have a script right now that bans them as they join if they are in the banned channel...But once they are inside my room they can join any banned room they want and thats no good. Somone able to help ? Never been let down here before smile


Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>
ToRmEnTeD #205724 29/10/08 10:55 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
on *:join:#:{
  set %good_room $chan
  $+(.timer,$nick) 0 300 check_rooms $nick
}
on *:part:#:{
  $+(.timer,$nick) off
}
on *:kick:#:{
  $+(.timer,$knick) off
}
on *:quit:{
  $+(.timer,$nick) off
}
alias check_rooms {
  .enable #room_check
  .whois $1
}
#room_check off
raw 318:*:{
  .disable #room_check
  haltdef
}
raw 311:*:{
  if #bad_room1 isin $3- {
    .ban -k %good_room $2 $v1 detected
  }
  elseif #bad_room2 isin $3- {
    .ban -k %good_room $2 $v1 detected
  }
}
#room_check end


This is set to run every 5 minutes after they join the channel

ToRmEnTeD #205725 29/10/08 11:00 PM
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Code:
raw 319:*: { 
  if ($regex($3-,/#(channel_1|channel_2|channel_3|channel_4)/i)) {
    var %b = $comchan($2,0) | while (%b) { 
      if ($me isop $comchan($2,%b)) { kick $comchan($2,%b) $2 You're not welcome here, as you are in a banned channel. }
      dec %b
    }
  }
}
raw 366:*: {
  var %w = 1,%nick
  while $nick($2,%w) {
    .timer 0 $calc(%w * 60) whois $v1
    inc %w
  }
}


This script will whois your channel every 60 seconds. If it finds anybody who's also in a banned channel, and while in yours, it will kick him or her based on the channels added.

All you have to do is replace the channel_1 channel_2... with your banned channels. Add more channels in the same format.

I see RusselB already has one made for you, but you can give it a try and see what you like.

Last edited by Tomao; 29/10/08 11:03 PM.
Tomao #205731 30/10/08 01:52 AM
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Seeing your code here and in some recent threads, I cannot forbear to say that you shouldn't triffle "too much" with regexes smile
For example, a channels name may contain the | char. Same goes for nicks. To play more safe, you'd have to escape (threat literally) text that may contain "metachars" with \Qtext\E. And to play even more safe, possible occurances of \E in the text itself with: $+(\Q,$replacecs(text,\E,\E\\E\Q),\E).

I forgot about this in another recent thread as well, and gave:
on $*:text:$($+(/\b,$me,\b/Si)):*: { stuff }
instead of the better:
on $*:text:$($+(/\b\Q,$me,\E\b/Si)):*: { stuff }
or respectively:
on $*:text:$($+(/\b\Q,$replacecs($me,\E,\E\\E\Q),\E\b/Si)):*: { stuff }

One could say that's nit-picking and the scenario is unlikely. Maybe it is... but then, missing a highlight is less dreadful than kicking or being kicked for the wrong reasons. laugh

(In the concrete example here, I'd use $istok instead)

Horstl #205732 30/10/08 03:44 AM
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Thanks for your straightforward suggestion, Horstl! laugh

I personally find regular expressions being a useful language to learn, especially helpful in mirc scripting. Naturally without noticing the overuse of it, I tend to adapt myself to it all the time, to be fascinated by it with the immanent possibilities.

I understand there are tokens identifiers to use that can get a simple task done, and I shouldn't constrain myself in one area without discovering the other. Though as interested I am in studying the regexes as I've started out, I'll take your word for it and diversify my habits a bit.

Also, upon trying your suggestions, I didn't seem to get them triggered for some reason:

Code:
on $*:text:$($+(/\b\Q,$me,\E\b/Si)):*: { echo -a true }


Nothing was returned when I called my name.

But using
Code:
on $*:TEXT:$(* $+ $me $+ *):#: { echo -a true }
returned true to me.

Tomao #205739 30/10/08 04:02 PM
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Maybe a conflict with other on text events in that scriptfile?
I did test it again, and it's working as expected:

[Bot] •• horstl
true
[Bot] •• Horstl, test
true
[Bot] •• this shoudnt trigger 123horstl
[Bot] •• Horstl?
true
[Bot] •• works Horstl! (containing control codes in the "nick")
true


Link Copied to Clipboard