mIRC Homepage

Help me make this script add multiple words to the

Posted By: gomp

Help me make this script add multiple words to the - 21/05/10 03:07 PM

on *:TOPIC:#superkids:{
if $istok(MrDude.SuperMan.tailpush.Geofax.repent.rox.ChopperS.DjTheWizz.DjTheW|zz.Mrdud3.superm4n,$nick,46) { mode $chan +b $address($nick,2) | kick $chan $nick You're banned from setting a topic! ... please set a topic; relevant to the channelsname! | topic $chan Open and free! (Anyone please set a topic; relevant to the channelsname.. It might spark an intersting chat!) }
elseif (superman isin $1-) { mode $chan +t | .timer 1 $rand(10,60) mode $chan -t | topic $chan Open and free! (Anyone please set a topic; relevant to the channelsname.. It might spark an intersting chat!) }
}




This script will autoban anyone who sets a topic containing "superman" .. But how do I make it do that to multiple words? I wouldm like for it to also ban if someone type "foreskin" and "supe3rM4n" ..



Also, is there a way to make it ban people who deletes the topic? If anyone banned by this script, set a blank topic. Nothing happens. And they manage to ruin the open channel for all the rest of us.. frown
Posted By: Tomao

Re: Help me make this script add multiple words to the - 21/05/10 08:50 PM

Code:
on !@*:topic:#superkids:{
  var %n = MrDude.SuperMan.tailpush.Geofax.repent.rox.ChopperS.DjTheWizz.DjTheW|zz.Mrdud3.superm4n
  var %w = foreskin|supe3rM4n|word3|word4|etc.
  if $istok(%n,$nick,46) { 
    ban -k # $nick 2 You're banned from setting a topic! ... please set a topic; relevant to the channelsname!
    topic $chan Open and free! (Anyone please set a topic; relevant to the channelsname.. It might spark an intersting chat!) 
  }
  elseif $istok(%w,$1-,124) { 
    mode # +t | .timer 1 $r(10,60) mode # -t
    topic # Open and free! (Anyone please set a topic; relevant to the channelsname.. It might spark an intersting chat!) 
  }
}
Just replace word3, etc..with more words you want to add, along with a pipe to divide between each word added.

I'm not sure about the empty topic. Are they using a character of some sort to set it as empty?
Posted By: gomp

Re: Help me make this script add multiple words to the - 22/05/10 12:16 PM

Originally Posted By: Tomao
Code:
on !@*:topic:#superkids:{
  var %n = MrDude.SuperMan.tailpush.Geofax.repent.rox.ChopperS.DjTheWizz.DjTheW|zz.Mrdud3.superm4n
  var %w = foreskin|supe3rM4n|word3|word4|etc.
  if $istok(%n,$nick,46) { 
    ban -k # $nick 2 You're banned from setting a topic! ... please set a topic; relevant to the channelsname!
    topic $chan Open and free! (Anyone please set a topic; relevant to the channelsname.. It might spark an intersting chat!) 
  }
  elseif $istok(%w,$1-,124) { 
    mode # +t | .timer 1 $r(10,60) mode # -t
    topic # Open and free! (Anyone please set a topic; relevant to the channelsname.. It might spark an intersting chat!) 
  }
}
Just replace word3, etc..with more words you want to add, along with a pipe to divide between each word added.

I'm not sure about the empty topic. Are they using a character of some sort to set it as empty?



Thanks! I will implement it now.

Edit: There is a problem with this. Is there a way to make it ban if the word is in the topic in any way?

It only works when the topic contains ONLY one of the words that are banned..




I mean: If someone set the topic to: foreskin
..then the script works!

But if someone set the topic to: foreskin is nice
...then the script does nothing.. frown





No characters no, that is the problem, if one set a empty topic. This is how it looks: 22 14:14:45 * Curious changes topic to ''
..and after that there just is no topic set.

Posted By: Horstl

Re: Help me make this script add multiple words to the - 22/05/10 01:16 PM

You have to either loop all the words of topic $1- (to check each for being a token of your badword string), or loop your badwords (to check each for being a token of topic $1-). Or use a more sophisticated method like $hfind(R). IMO a simple loop will suffice because topic changes are rather infrequent and performance shouldn't be a big issue.

Basically, you want to do what all "badword scripts" do. The only difference is that you'll check $1- of the "on topic" event instead of the "on text" event. Take a look at some existing badword scripts - you'll find dozends in these forums and a lot more on dedicated mIRCscript websites.
smile
Posted By: Tomao

Re: Help me make this script add multiple words to the - 22/05/10 06:31 PM

With Horstl's suggestion in mind, this will prevail:
Code:
on !@*:topic:#superkids:{
  var %a = foreskin|supe3rM4n|word3|word4|etc...
  var %n = $numtok(%a,124) | while (%n) {
    if $istok($strip($1-),$gettok(%a,%n,124),32) {
      ban -k # $nick 2 Please set a topic relevant to the channelsname!
      topic # Open and free! (Anyone please set a topic; relevant to the channelsname.. It might spark an intersting chat!)
    }
    dec %n
  }
}
© 2021 mIRC Discussion Forums