mIRC Homepage
Posted By: buster2007 display message when user quits - 20/08/05 07:58 AM
hi.
i'd like a script that shows when a user has quit irc if i have a query opened with him, and i'd like the message to be displayed in the query.
also if he rejoins irc and my query with him is still opened, i'd like it to show me a message in the query that he rejoined irc.

can you pls help me with this? give me some suggestions at least.
thanks
Posted By: buster2007 Re: display message when user quits - 20/08/05 09:24 AM
for quiting is quite simple, i know:

Code:
on 1:QUIT: {
  if ($query($nick)==$true) 
           echo $nick $nick has quit IRC ($1- )
}


but how do i test this on join??? if i put on join, i don't want the message displayed every thime that user joins a channel that i'm in also
thanks
Posted By: RusselB Re: display message when user quits - 20/08/05 01:24 PM
Rather than ON JOIN, I'd suggest using ON NOTIFY

/help on notify
Posted By: buster2007 Re: display message when user quits - 20/08/05 02:06 PM
yes but im not interrested in a specific user, but in all users, and i cannot add all users to my notify list. if i have a query with someone and he quits and then rejoins irc i want to have some message in my query telling me that.

when quitting irc.. the solution is above, but i don;t know or joining irc.

please help. thanks
Posted By: RusselB Re: display message when user quits - 20/08/05 10:11 PM
the ON JOIN event will only recognize a person when they join a room, not when they sign onto the network. If you are an IRCop on the network, then you can detect when a person signs onto the network.
Posted By: buster2007 Re: display message when user quits - 21/08/05 05:37 AM
yes i knew that.

however i need to somehow use ON JOIN to detect when they first join a channel (that i'm in also, of course) after they just quit irc and consider that to be "joining irc" (i don't see another way). but i don't know how to do it... i'm not so good at scripting.

please suggestions? thanks
Posted By: RusselB Re: display message when user quits - 21/08/05 05:54 AM
Code:
on *:quit:{
if $query($nick) { .hadd -m Query $nick $ctime }
}
on *:join:#:{
if $hget(Query,$nick) {
echo -a $nick has joined $chan and you had an open query with them when they quit at $asctime($hget(Query,$nick),mmm dd yyyy hh:nn:ss tt)
}
}
  
Posted By: buster2007 Re: display message when user quits - 21/08/05 06:31 AM
one small problem though smile
if i am in 10 different channels, and that users joins those channels, the code above displays the message 10 different times smile

that was my original problem also, i don't know how to display it only once.
thank you.
Posted By: buster2007 Re: display message when user quits - 21/08/05 07:46 AM
ok after looking through the help file, i did it.
thanks for the help RusselB (i didn't knew about the hash tables)
here's the final code:

Code:
 
on 1:QUIT: {
  if ($query($nick)) {
    .hadd -m QuitJoin $nick $ctime 
    echo -l $nick $nick ( $+ $right($address($nick,0),-2) $+ ) has quit IRC ( $+ $1- $+ )
  }
}
on 1:JOIN:#: {
  if ($hget(QuitJoin,$nick) && $query($nick)) {
    .echo -l $nick $nick ( $+ $right($address($nick,0),-2) $+ ) has rejoined IRC (had quit4 $duration($calc($ctime - $hget(QuitJoin,$nick))) ago)
    .hdel QuitJoin $nick
  }
}
on *:NICK: {
  if (($query($nick) || $query($newnick)) && $newnick != $me && $nick != $me) {
    .echo -l $newnick $nick is now known as  $+ $newnick
    if ($hget(QuitJoin,$nick)) .hdel QuitJoin $nick
  }
}
 


simple enough, i think. bye!
Posted By: IR_n00b Re: display message when user quits - 21/08/05 07:47 AM
do somthing with a /whois, i.e make it /whois them every minute or so, this is the best way if the server dosent have a autojoin channel.
© mIRC Discussion Forums