mIRC Homepage
When On Active is triggered by switching away from a DCC Send or Get window (or if window closes because get is finished), then $lactive, $lactivewid are not set.
Can you give more details how to re-create this bug? I went into mirc-options and unchecked the box to close-on-completion for sends and gets, then i sent versions.txt to myself, leaving both the dcc-send and dcc-get windows open. I then created a snippet to trap the ON ACTIVE event:

Code:
on *:ACTIVE:*:{
  echo -s ON ACTIVE lactive $lactive lactivewid $lactivewid
}


When I click to the get window, then click to status window, it displays "Get mynick versions.txt" as the $lactive value and shows a number for the $lactivewid

If I click to a different network than the get/send, it still shows the $lactive window's name, even though that window doesn't exist as far as that network is concerned. There is a difference regarding which network I do:

//echo -a $window(Send $me versions.txt)
or
//echo -a $window(Get $me versions.txt)

This returns the $null string at any network except the network where the send-to-self was made.
Set close on completion and switch to the window when it is downloading and see what you get when the window auto-closes.

(I didn't test this myself with a manual close, but I was also getting the error when switching windows whilst the download was in progress.)
Posted By: Protopia Re: On Active after window close - 21/07/17 09:43 AM
Actually I get this if I close a channel or custom window too.

It seems to be an issue when you close a window rather than when you switch away from a DCC window.
Posted By: maroon Re: On Active after window close - 21/07/17 07:43 PM
I'm now seeing what you're talking about, which isn't exactly as you first described. The behavior is happening only when the last-active window no longer exists, either because of close-on-complete or by manually closing the window. It's not happening when you're clicking back-and-forth to/from a dcc window that remains open.

If the last active window no longer exists, $lactive returns $null rather than the name of a window that no longer exists, and $lactivewid returns 0 rather than the WID of a non-existent window.
Posted By: Protopia Re: On Active after window close - 21/07/17 07:54 PM
Originally Posted By: maroon
I'm now seeing what you're talking about, which isn't exactly as you first described. The behavior is happening only when the last-active window no longer exists, either because of close-on-complete or by manually closing the window. It's not happening when you're clicking back-and-forth to/from a dcc window that remains open.

If the last active window no longer exists, $lactive returns $null rather than the name of a window that no longer exists, and $lactivewid returns 0 rather than the WID of a non-existent window.


Yes - apologies for not having described it correctly first time. I can probably code around this bug by using the ON CLOSE event.
Posted By: maroon Re: On Active after window close - 21/07/17 08:09 PM

Code:
on *:CLOSE:*:{ echo -s $scriptline ONCLOSE active $active lactive $lactive lactivewid $lactivewid }


I'm not finding ON CLOSE being triggered by closing a DCC window either manually or close-on-complete. A better check would be if $lactivewid is zero.
Posted By: Protopia Re: On Active after window close - 07/08/17 08:17 PM
No - ON CLOSE is not called on close of DCC GET window.

Also, I seem to be getting variable experiences on whether ON CLOSE is called on close of the single message window.

I am entirely unsure how to code around this in a manner which will work consistently - except by maintaining my own record of $lactive / $lactivewid in variables.
© mIRC Discussion Forums