mIRC Homepage
Posted By: rehinged /close doesn't trigger ON CLOSE? - 09/12/07 01:52 AM
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
Posted By: argv0 Re: /close doesn't trigger ON CLOSE? - 09/12/07 03:21 AM
/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.
Posted By: Horstl Re: /close doesn't trigger ON CLOSE? - 09/12/07 05:52 AM
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
}

Posted By: Wims Re: /close doesn't trigger ON CLOSE? - 09/12/07 12:35 PM
If you /close a window, then you know that the window is closed, so you can do what you want just after the /close...
Posted By: rehinged Re: /close doesn't trigger ON CLOSE? - 15/12/07 10:19 PM
Point taken, yet I do believe that an event reaction machine should be more semantically obvious than that.

*shrug*

Feature suggestion it is.
© mIRC Discussion Forums