mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2014
Posts: 16
D
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.

Joined: Dec 2013
Posts: 779
N
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
Joined: Mar 2014
Posts: 16
D
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.

Joined: Feb 2015
Posts: 243
O
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:

Joined: Mar 2014
Posts: 16
D
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.

Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
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 <-
Joined: Mar 2014
Posts: 16
D
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.

Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
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 <-
Joined: Mar 2014
Posts: 16
D
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?

Joined: Feb 2015
Posts: 243
O
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.


Link Copied to Clipboard