To make the window flash when a query window, you need to observe the QUIT event, to make it flash

if ($query($nick).cid == $cid) { window -g1 $nick | echo $nick Note: $nick has quit $network at $asctime }

This checks if there's a query window open, and if it's open - it checks if it's from the same network too.

You'll need to explain your #1 again. If you have an open query window, it *does* get renamed when someone changes nick. The exceptions:

1. If someone disconnects as nick1, then rejoins as nick2, the existing query window does not rename.
2. If that nick2 opens a query window as nick2 then changes back to the original nick1, the presence of an already-open nick1 query window prevents the nick2 window from renaming to nick1.
3. If nick2 changes back to nick1 before opening the query window, then mIRC uses the existing query window like normal.
4. I haven't tested how the querylogfilename.log is handled in the above 3 situations.

You can use "/queryrn nick2 nick1" to rename a query window with the #2 restriction above, but it's going to be hard to accurately rename query windows when nick1 shows the QUIT event before nick2 re-joins the channel. Where the QUIT event checks if that nick has an open query window, it could also check to see if there's a different nick already rejoined, having matching ident@address