mIRC Home    About    Download    Register    News    Help

Print Thread
/close doesn't trigger ON CLOSE? #191439 09/12/07 01:52 AM
Joined: Mar 2006
Posts: 22
R
rehinged Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Mar 2006
Posts: 22
Code:
on *:CLOSE:@window: {
  unset %variable
}
alias testclose {
  window @window
  %variable = $active
  close -@ @window
}

Yes, it's rude to laugh, but that's laughable! Laugh at it, I DEMAND IT. smile

Re: /close doesn't trigger ON CLOSE? [Re: rehinged] #191448 09/12/07 03:21 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
/close never triggered the ON CLOSE event. This is the same behaviour as 6.3. Maybe make a feature suggestion to have this behaviour, but it is by design and not a bug.

Generally speaking, events only trigger for actions that come *into* your script, not actions generated by the script itself. There are a few exceptions (like ON SIGNAL) but this generally holds true.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: /close doesn't trigger ON CLOSE? [Re: rehinged] #191451 09/12/07 05:52 AM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
This is another detail the helpfile is not stating clearly.
Ah, if this should become a feature suggestion: a new switch for /window -c or /close should be added (it would break lots of scripts becoming default behaviour)...
Meanwhile/alternatively add all your on close routines to an alias:
Code:
alias -l close.routine {
  unset %variable
  close -@ $1
  ;(or window -c $1)
}

on *:CLOSE:@window: {
  ; alias triggered by close event
  close.routine $target
}

alias testclose {
  window @window
  set %variable $active
  ; alias triggered by remote script
  close.routine @window
}


Re: /close doesn't trigger ON CLOSE? [Re: rehinged] #191462 09/12/07 12:35 PM
Joined: Jul 2006
Posts: 3,746
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,746
If you /close a window, then you know that the window is closed, so you can do what you want just after the /close...


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: /close doesn't trigger ON CLOSE? [Re: rehinged] #191785 15/12/07 10:19 PM
Joined: Mar 2006
Posts: 22
R
rehinged Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Mar 2006
Posts: 22
Point taken, yet I do believe that an event reaction machine should be more semantically obvious than that.

*shrug*

Feature suggestion it is.