From the look of your code it doesn't seem like you have grasped any concept of scripting at all, your if statements and while loops are incorrect for the most part, both of these functions are going to be very important in the part of the script that will actually spider/check the server. You even used $nick($chan,v,0) when i had already shown you $nick($chan,0,v).

I would strongly suggest reading through /help, try out the examples and play around until you understand how they work. Then maybe you are ready to try a few more simple scripts/snippets before attempting such a task.

As an alternative, these is infact a bot written for the purpose of spidering file servers, which has a dcc chat interface for you to get info and perform searches. Perhaps if you are able to find it, i misplaced my copy during a format some time ago, it would save you a lot of time. It was simply called File Scanner aka Synopse last i heard, written by a NonReal on DALnet originally, i forget who took over and rewrote the new version.

Code:
 
#ServerChecker off 
[color:red]; Your syntax for $nick() was incorrect, and your while loop had no
; comparison (%a was always going to exist)[/color]
on *:text:!collect:#: {
  var %x = 1, %y = $nick($chan,0,v)
  while (%x <= %y) {
    write -s $+ $nick($chan,%x,v) tocheck.txt $nick($chan,%x,v)
    inc %x
  }
}
[color:red]; no need for the else, just use a return in the initial if, again your while
; syntax is broken.  used var instead of set, no need for a global variable.
; No need to send line number to check.voice, just send the nickname as
; read from the file.[/color]
on *:text:!begin &:*:{ 
  if ($2 !isnum) { .msg $nick Format: !begin <number> | return } 
  var %a = $iif($2 > $lines(tocheck.txt),$lines(tocheck.txt), $2)
  while (%a > 0) {
    check.voice $read(tocheck.txt)
    dec %a
  }
} 
[color:red]; this is about where your code go off on its own, not sure why your
; enabling the second group here at all, since its never disabled... rather
; than use a group that will not be enabled/disabled at the correct times
; store the nicks in a global variable for later checking[/color]
alias check.voice { 
  if (!$findtok(%check_voice_nicks,$1,1,32)) {  set %check_voice_nicks %check_voice_nicks $1 }
  ctcp $1 !list 
} 
#ServerChecker end 
[color:red]; i've no idear the point of this, looks like you were trying to get the
; trigger from the ad, but iirc server ads are sent via notice not private
; message when requested with !list ?[/color]
on *:text:*:?:{ 
  var %text = $pos($1-,/,1) 
  while %text <= $len($1-) && %text isnum { 
    if $mid($1-,%text,1) !isalnum { 
      set %text $mid($1-,$pos($1-,/,1),%text) 
    } 
    if %text isnum { 
      inc %text 
    } 
  } 
  /ctcp $(%text,2) 
} 
[color:red]; this makes no sense at all to me, again your while loop is completely
; broken, if %text gets set to a non alnum in the first if, %text will never
; increase and you will enter an endless loop.[/color]
on *:notice:*:?:{ 
  var %text = 1 
  while %text <= $len($1-) && %text isnum { 
    if $mid($1-,%text,1) !isalnum { 
      set %text $mid($1-,1,%text) 
    } 
    if %text isnum { 
      inc %text 
    } 
  } 
} 
[color:red]; i think i would simply abandon these last two events[/color]