Alright, here's a concept for you..

Code:
var %count = $ignore(0)
while (%count > 0) {
  if ($address($$2, 2) iswm $ignore(%count)) {
    do something
  }
  dec %count
}

You may want to check the $ignore(%count).type to see if a specific type of ignore is set (channel, private, ctcp, etc.).