Note: The mainteinance of the scripting examples is discontinued since I no longer have an interest to continue doing so. The pages will remain here, for now, but that might not be the case in the future. You are free to download all the material on these pages and set a up mirror, or even continue the maintenance of the material by enhancing the examples yourself.

All the material in these examples are for the mIRC version 6.03. It is very likely that some or most of these examples won't work in future versions.

Scripting protection against autorejoin

One of the most questionable feature in IRC clients is automatic rejoin after kick. I understand that on some cases this is useful, for example when you are a trusted channel operator or when kicks are used for entertainment. However usually this feature is annoying beyond all belief: if you want to get rid of someone, you definitely don't want to see the same user returning back like nothing had happened.

The best way to store data is to use hash tables. I know that they aren't very easy to learn for a beginner. However as soon as you start to understand them, you probably don't want to use complex variables which are forced to evaluate with unreadable evaluation brackets. In this example we are using a hash table called kick-<cid><channel> which has kicked nicks as keys and $true as data value. So if Geetee gets kicked on #mirc when the connection id is 3, a hash table called kick-3#mirc will have a item called Geetee and data $true. The item will be removed after five seconds. If user joins in less than five seconds, it can be assumed that it's automatic rejoin. Naturally you can change this value to something better if you want to.

There is no need to have any aliases for protection against automatic rejoin. The on KICK event checks that you have kicked someone and sets the hash table item ($nick is you, $knick is the user getting kicked). The on JOIN event triggers when you are operator on the channel and when it has been less than five seconds since the nick was kicked. Then the user is banned and kicked. Note that autorejoin protection should never be just a kick. If you only kick someone who has automatic rejoin, you will get into infinite loop.

This script has one known problem: if channel's banlist is full, the script will result in infinite loop because the ban doesn't get through. On normal cases this is very unlikely to happen but in case it happens, you have been warned. The reason why I can't give a script that takes this into account is that there is no way for the script to know what is the maximum ban limit. It would also require you to have a synchronized IBL.

Example script

on *:KICK:#: {
  if ( ($nick == $me) && ($knick != $me) ) hadd -mu5 $+(kick-,$cid,$chan) $knick $true
on @*:JOIN:#: {
  if ( $hget($+(kick-,$cid,$chan),$nick) ) {
    mode $chan +b $mask($fulladdress,3)
    kick $chan $nick Autorejoin

If you're wondering why there's a check for $knick in the on KICK event, it's because of a rather rare but possible scenario. You could kick yourself, join the channel very quickly, and get auto-opped. If this happened, the script would ban and kick yourself if the check wasn't there.

Last updated 2003-04-05, Janne 'Geetee' Nikula,