mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2006
Posts: 22
R
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

Joined: Oct 2003
Posts: 3,918
A
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"
Joined: Nov 2006
Posts: 1,559
H
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
}


Joined: Jul 2006
Posts: 4,144
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,144
If you /close a window, then you know that the window is closed, so you can do what you want just after the /close...


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Mar 2006
Posts: 22
R
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.


Link Copied to Clipboard