mIRC Home    About    Download    Register    News    Help

Print Thread
ON Event for script leaving a channel? #255249 03/10/15 11:57 AM
Joined: Mar 2014
Posts: 16
D
davethejackal Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Mar 2014
Posts: 16
What ON event triggers when my bot/script leaves a channel. I had though ON PART would work but it doesn't seem to.

Re: ON Event for script leaving a channel? [Re: davethejackal] #255250 03/10/15 12:22 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
on part, check if ($nick == $me) { do stuff }


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: ON Event for script leaving a channel? [Re: Nillen] #255252 03/10/15 01:32 PM
Joined: Mar 2014
Posts: 16
D
davethejackal Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Mar 2014
Posts: 16
Does this work even when you just exit MIRC. I have used it but it doesn't seem to.

Re: ON Event for script leaving a channel? [Re: davethejackal] #255253 03/10/15 01:36 PM
Joined: Feb 2015
Posts: 243
O
OrFeAsGr Offline
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
ehm.. i think it's obvious that parting a channel isn't even by far related to exiting mIRC..
The event that triggers when you exit mIRC is
on *:EXIT:

Re: ON Event for script leaving a channel? [Re: OrFeAsGr] #255255 03/10/15 01:53 PM
Joined: Mar 2014
Posts: 16
D
davethejackal Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Mar 2014
Posts: 16
Ehm I'd have thought it was obvious that you leave a channel when you exit IRC or disconnect from a server...

The problem is that you can't tell which channels you were in during an exit / disconnect event and the part doesn't seem to be triggered.

Re: ON Event for script leaving a channel? [Re: davethejackal] #255257 03/10/15 02:03 PM
Joined: Dec 2008
Posts: 1,513
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,513
In this case use : ON *:DISCONNECT: { } event, the on part event does not trigger while u disconnect from an server and i am sure that ON EXIT is not useful here.

Be careful that in the ON *:DISCONNECT: { } event you must add an loop to track down the channels that you are in using the $chan identifier.

e.g:

Code:
ON *:DISCONNECT: {
  var %t = $chan(0)
  var %i = 1
  while (%i <= %t) {
    var %c = $chan(%i)
    var %tot = $addtok(%tot,%c,44)
    inc %i
  }
  echo -a Disconnected from $server IRC Server, you were into the: $iif(%tot,$v1,None) channel(s).
}


/help on disconnect
/help $chan (it has 2, read both to understand)

Last edited by westor; 03/10/15 02:10 PM.

Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Re: ON Event for script leaving a channel? [Re: westor] #255258 03/10/15 02:23 PM
Joined: Mar 2014
Posts: 16
D
davethejackal Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Mar 2014
Posts: 16
Originally Posted By: westor
In this case use : ON *:DISCONNECT: { } event, the on part event does not trigger while u disconnect from an server and i am sure that ON EXIT is not useful here.

Be careful that in the ON *:DISCONNECT: { } event you must add an loop to track down the channels that you are in using the $chan identifier.

e.g:

Code:
ON *:DISCONNECT: {
  var %t = $chan(0)
  var %i = 1
  while (%i <= %t) {
    var %c = $chan(%i)
    var %tot = $addtok(%tot,%c,44)
    inc %i
  }
  echo -a Disconnected from $server IRC Server, you were into the: $iif(%tot,$v1,None) channel(s).
}


/help on disconnect
/help $chan (it has 2, read both to understand)


That is great but I want a catchall. Correct me if I am wrong but that doesn't fire if I just close a chat window for a specific channel.

Re: ON Event for script leaving a channel? [Re: davethejackal] #255259 03/10/15 02:50 PM
Joined: Dec 2008
Posts: 1,513
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,513
If you manually close an channel window then you must use the ON *:PART:#: { if ($nick == $me) { do_stuff } } event.


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Re: ON Event for script leaving a channel? [Re: westor] #255265 04/10/15 12:43 AM
Joined: Mar 2014
Posts: 16
D
davethejackal Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Mar 2014
Posts: 16
Originally Posted By: westor
If you manually close an channel window then you must use the ON *:PART:#: { if ($nick == $me) { do_stuff } } event.


Is "on part" called when you exit from mIRC, before the DISCONENCT/QUIT etc events?

Re: ON Event for script leaving a channel? [Re: davethejackal] #255266 04/10/15 01:05 AM
Joined: Feb 2015
Posts: 243
O
OrFeAsGr Offline
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
ON *:PART:#: { do this }
This will trigger when you part a channel. Not when you EXIT mIRC nor when you disconnect from a network.
ON *:EXIT: { do that }
This will trigger when mIRC Closes. aka when you EXIT mIRC
ON *:DISCONNECT: { do the other thing }
This will trigger when you disconnect from a network. Also triggers when you exit mIRC because it disconnects from networks when it closes. But for mIRC Exit use ON *:EXIT:
ON *:QUIT: { do something }
Triggers when other users quit from a network.