mIRC Homepage
Posted By: Cyrex Another socket question - 16/07/04 08:12 PM
I have my socket bot scripted so it will rejoin the channel when it gets kicked.

I am using this in my bot's on sockread event:

if ($2 == KICK) { sockwrite -n $sockname JOIN $3 }

The problem with the above code is that the bot is trying to join the channel even when someone else gets kicked from the channel. There's no need for that. How can I determine that it was my socket bot that got kicked, and only respond if it is the socket bot?
Posted By: Coolkill Re: Another socket question - 16/07/04 09:37 PM
Its silly but believe it or not the bot doesnt know its own nickname, as a result, you have to from the start, monitor the bots nickname, in a variable or some other method.

if (($2 == KICK) && ($4 == %variable)) {
sockwrite -n $sockname JOIN $3
}


Where you replace %variable with the one that is storing your bots nickname, also you might concider adding some 'protection' to stop the bot rejoining after X times.

You can track the nickname using, for example:

if (($2 == NICK) && (*.dal.net* iswm $1)) {
set %variable $remove($3,:)
}

$1 being the server you are currently connected too, and *dal.net* being something that is GUARENTEED to be present in every server address.

Eamonn.
© mIRC Discussion Forums