I've tried many things and the things I tried ending up making it say 'no matches' when there ARE results and when there AREN'T results. But doing what you said...

Code:
while (%i < %ii) {
          inc %i
          %x = $ini(%file,%sect,%i)
          if ($readini(%file,%sect,%x) == $2) { .notice $nick $cl %x }
        }
        if (%x == $null) { .notice $nick $cl No matches }


...doesn't work. If there ARE matches, it shows all matches and doesn't say "no matches". If there AREN'T matches, it doesn't show anything.