using your code, add this.

It simply catches the text being sent by $nick, and if %q.a is still set halts the event, and delays the text for 1 second, which should be enough for the raw 311 to have completed.

You may want to add the whois responce masking that XDaeMon shows in his script but since you wernt doing it already I didnt want to change it.

While xDaeMon script is very good i felt it failing is that it halts the opening of the window thus causing multiple ON OPEN events to trigger if more than one line is being sent, each one replacing the previous line into $%q.a.$nick, and doing a whois each time. The first raw 318 well of course shut down the possable problem of multiple 311's tripping q.open but only the last ON OPEN text well have been displayed.

Code:
on ^*:text:*:?:{
  if (%q.a) {
    haltdef
    var %temptext = $+(%,temptext.,$ticks,.,$mid($rand(10000,19999),2))
    set -u60 $(%temptext,1) $+(<,$nick,>) $1-
    .timer 1 1 if $!window( $!( $+ $nick $+ ,) ) $({,) echo -itlbfmr $!( $+ $nick $+ ,) %temptext $(},)
  }
}