mIRC Homepage
Posted By: lonesome Notices - 18/12/02 08:42 AM
Code:
ON *:NOTICE:*:*: {
  halt
}


Apparently the above does not halt notices, it still shows up in every channel that the nick is in if he is not in the active channel...

Any ideas what's wrong?
Posted By: Hammer Re: Notices - 18/12/02 08:55 AM
You have to be very careful with that particular script. It would halt all notices, like this:
Code:

on ^*:NOTICE:*:*: haltdef

That is not really what you mean to do, I don't think. For instance, the above would also block any notices from services on networks which have them, in addition to halting the notice from showing up in the first common channel with them.

One way around that is to send the notice to the first common channel, if there is one, or to the active window if there isn't one.
Code:

on ^*:NOTICE:*:?:{
  if ($comchan($nick,1)) echo $color(notice) -ti2 $+(-,$nick,-) $1-
  else echo $color(notice) -ati2 $+(-,$nick,-) $1-
  haltdef
}

The main drawback here is that notices with leading spaces (frequently seen in services notices) will lose their formatting spaces. Therefore, you might really mean this:
Code:

on ^*:NOTICE:*:?:{
  if ($comchan($nick,1)) {
    echo $color(notice) -ti2 $+(-,$nick,-) $1-
    haltdef
  }
}
Posted By: Frog Re: Notices - 18/12/02 11:24 AM
This works for me:

on ^*:notice:*:?:{
haltdef
beep
var %i 1,%n $comchan($nick,0)
while (%i <= $comchan($nick,0)) {
if ($nick !ison $comchan($nick,%i)) {
dec %n
}
if ($nick ison $comchan($nick,%i)) {
echo -mi2 $comchan($nick,%i) $+(14:15:,16,$nick,15:,14:,$chr(32),16,$1-)
}
inc %i
}
if (%n == 0) {
echo -mi2s $+(14:15:,14,$nick,15:,14:,$chr(32),15,$1-)
}
}
© mIRC Discussion Forums