Well, it's certainly possible, but to be honest, the code is far from pretty :tongue:

So I suppose the choice you have to make is: either find a dll that triggers on the closing of a channel window, and gives a signal so you can handle it. Though then you have one more dll in your script.

Or you could try out this script, it worked for me, but perhaps you're not too fond of using timers. Note that the interval right now for checking the windows is at 50 ms. Adjust it at will.

When a channel is closed, a signal will be sent to CHANCLOSE with two parameters: 1 = cid, 2 = window name.

Code:
on *:SIGNAL:chanclose:{
  ; your code here 
  ; example: echo -sa Closed channel $2 from server window with cid $1 
}
[color:red]  [/color] 
on *:DISCONNECT: owin.start
on *:CONNECT: owin.stop 
 [color:red]  [/color] 
alias owin.start {
  var %a = 1, %b = net $+ $cid
  while $window(#*,%a) { hadd -m %b $v1 1 | inc %a } 
  if $hget(%b) { .timerowin.chk -m 0 50 owin.chk $cid %b }
}
 [color:red]  [/color] 
alias owin.stop {
  if $hget(net $+ $cid) { .timerowin.chk off | hfree $v1 }
}
[color:red]  [/color] 
alias owin.chk {
  scid $1
  if $hget($2,0).item > $window(#*,0) { 
    var %a = $v1, %b = %a - $v2, %c
    while %b && $hget($2,%a).item {
      %c = $v1
      if !$window(%c) {
        hdel $2 %c
        signal chanclose $1 %c
        if !$hget($2,1).item { owin.stop | return }
        dec %b
      }
      dec %a 
    }
  }
}


Greets

Last edited by FiberOPtics; 07/01/05 12:04 AM.