mIRC Home    About    Download    Register    News    Help

Print Thread
Another socket question #90757 16/07/04 08:12 PM
Joined: Apr 2004
Posts: 66
C
Cyrex Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Apr 2004
Posts: 66
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?

Re: Another socket question #90758 16/07/04 09:37 PM
Joined: Dec 2002
Posts: 788
C
Coolkill Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
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.