mIRC Homepage

Auto reset topic, if the new topic includs a word.

Posted By: gomp

Auto reset topic, if the new topic includs a word. - 29/04/10 12:39 PM

Say I had a quake 2 related channel. (the game.) And had it sett to -t ..

But this one kid, avoids ban, and come in and always sett the same topic. Say he set: "toyman rules"
"toyman is the best"

Etcetera..

Is there a script, that could detect that word, and automatically reset the topic to something I have premade?


Like if he sat any topic containing the word 'toyman', I would immediately reset it to something like; "Feel free to set any topic relevant to quake 2, it might spark an interesting chat!" ..

PS: Also it would be nice if it would set the channel +t for a random time, between 10 seconds and 1 minute.. But that is not needed. smile





I know I could just set it to +t .. But it is sad that one kid shall be able to ruin an open channel like this..


Alternatively, is there a script that; every time a "nickname" set any topic, ... makes me reset it, and ban the person?
Posted By: Riamus2

Re: Auto reset topic, if the new topic includs a word. - 29/04/10 01:01 PM

I don't have mIRC in front of me to get the exact format, but use /help on topic . I'm pretty sure that's a valid event.
Posted By: 5618

Re: Auto reset topic, if the new topic includs a word. - 29/04/10 01:02 PM

The code should be self-explanatory...
Code:
on *:TOPIC:#channel:{
  if ($nick == personsnick) { mode $chan +b $address($nick,2) | kick $chan $nick You're banned from setting a topic | topic $chan Your new topic here }
  elseif (toyman isin $1-) { mode $chan +t | .timer 1 $rand(10,60) mode $chan -t | topic $chan Feel free to set any topic relevant to quake 2, it might spark an interesting chat! }
}
Posted By: gomp

Re: Auto reset topic, if the new topic includs a word. - 29/04/10 01:48 PM

Thanks a lot! laugh

Seems to be just what I am after.

I'll implement it now.

Edit: Tested it now, it seems to be just what I needed! Thanks a lot! Tell me if there is anything I can do for you, back! laugh
Posted By: gomp

Re: Auto reset topic, if the new topic includs a word. - 29/04/10 01:54 PM

If he uses multiple nicknames. Like "toyman", "toyM4n", etcetera..

How would I add those in that script?

Just add it several times with different nick? Or would that conflict?

I understood that code, and edited in the things, thanks for making it so obvious!

But unsure how to make it work for multiple nicks. smile

Thanks again though! I usually have a hard time making myself understood in English. But you got it! laugh
Posted By: HorseC

Re: Auto reset topic, if the new topic includs a word. - 29/04/10 03:40 PM

Originally Posted By: gomp
If he uses multiple nicknames. Like "toyman", "toyM4n", etcetera..

How would I add those in that script?

Just add it several times with different nick? Or would that conflict?

I understood that code, and edited in the things, thanks for making it so obvious!

But unsure how to make it work for multiple nicks. smile

Thanks again though! I usually have a hard time making myself understood in English. But you got it! laugh


from /help if

'Combining comparisons

You can combine comparisons by using the && for AND and || for OR characters.'

so...


try if ( ($nick == nick1) || ($nick == nick2) || ($nick3 == nick3 ) )

NOTE: if comparison starts with (( and last ends with )) to make it a group of comparisons to make..

Hope this helps, and I would suggest you start to use /help from
within mIRC.. everything you need to know is in there for future scripting.

Posted By: gomp

Re: Auto reset topic, if the new topic includs a word. - 29/04/10 03:47 PM

I did not fully understand that.. But I shall test it now. And thank you! smile

Edit: I have now tested it, and much more.. But I can only make it work with one nick.. :|
Posted By: chacha

Re: Auto reset topic, if the new topic includs a word. - 29/04/10 05:21 PM

what about $istok(nick1.nick2.nick3,$nick,46)
Posted By: Tomao

Re: Auto reset topic, if the new topic includs a word. - 30/04/10 01:38 AM

Maybe HorseC was trying to be basic or rudimentary so newbies understand better.
Posted By: gomp

Re: Auto reset topic, if the new topic includs a word. - 30/04/10 09:11 AM

Originally Posted By: Tomao
Maybe HorseC was trying to be basic or rudimentary so newbies understand better.


I do not understand much coding. But that code from 5618 was very easy to understand.

I only wish I had asked for it to include several nicknames. frown

I shall try the suggestions above here today though! I hope it works. laugh
Posted By: gomp

Re: Auto reset topic, if the new topic includs a word. - 30/04/10 09:21 AM

Originally Posted By: chacha
what about $istok(nick1.nick2.nick3,$nick,46)


That worked! laugh

Thanks a lot!

Is there a limit to how many nicks one can add that way? smile
Posted By: Riamus2

Re: Auto reset topic, if the new topic includs a word. - 30/04/10 01:13 PM

As many as you like... up to the line length limit in mIRC (which on 6.35 and newer is something like 4000 characters). You'll know if you reach it because you'll get a line too long error message when trying to run it.
Posted By: gomp

Re: Auto reset topic, if the new topic includs a word. - 30/04/10 01:14 PM

Neat!

Thanks a lot to all you who helped me make this script! it works perfectly! laugh
© 2021 mIRC Discussion Forums