hello all,

this code is working good.. it's not my own but, works for my purposes... but instead of the goto loops, is there a way to make this code less bulkie? perhaps by using while loop(s)?

if so how would that work for this instance???

here's the code i'm inquiring on:
Code:
if (%found != $null) { 
        %i = 0
        :loop1
        inc %i | inc %all
        if (%all == 6) { .msg $nick $C(1) $+ ( $+ $C(2) $+ overflow $+ $C(1) $+ ) $+ $C(1)  too many search results to display. | halt }
        if ($findfile($r.srv(Fserve.1,Root.Dir),%search,%i) != $null) { inc %current | .msg $nick $C(1) $+ ( $+ $C(2) $+  $+ %current $+  $+ $C(1) $+ ) file:( $+ $C(2) $+ $right($findfile($r.srv(Fserve.1,Root.Dir),%search,%i),$calc($len($findfile($r.srv(Fserve.1,Root.Dir),%search,%i)) - $len($r.srv(Fserve.1,Root.Dir)))) $+ $C(1) $+ )  size:( $+ $C(2) $+  $+ $big($findfile($r.srv(Fserve.1,Root.Dir),%search,%i)) $+  $+ $C(1) $+ ) trigger:( $+ $C(2) $+  $+ /ctcp $+ $chr(32) $+ $r.srv(Fserve.1,Trigger) $+  $+ $C(1) $+ )   }
        if (%i < %found) { goto loop1 }
        goto next
      }
      :next
      if (%found.2 != $null) { 
        %i = 0
        :loop2 
        inc %i | inc %all
        if (%all == 6) { .msg $nick $C(1) $+ ( $+ $C(2) $+ overflow $+ $C(1) $+ ) $+ $C(1)  too many search results to display. | halt }
        if ($findfile($r.srv(Fserve.2,Root.Dir),%search,%i) != $null) { inc %current | .msg $nick $C(1) $+ ( $+ $C(2) $+  $+ %current $+  $+ $C(1) $+ ) file:( $+ $C(2) $+ $right($findfile($r.srv(Fserve.2,Root.Dir),%search,%i),$calc($len($findfile($r.srv(Fserve.2,Root.Dir),%search,%i)) - $len($r.srv(Fserve.2,Root.Dir)))) $+ $C(1) $+ )  size:( $+ $C(2) $+  $+ $big($findfile($r.srv(Fserve.2,Root.Dir),%search,%i)) $+  4+ $C(1) $+ )  trigger:( $+ $C(2) $+  $+ /ctcp $+ $chr(32) $+ $r.srv(Fserve.2,Trigger) $+  $+ $C(1) $+ ) }
        if (%i < %found.2) { goto loop2 }

        goto next2
      }
      :next2
      if (%found.3 != $null) { 
        %i = 0
        :loop3 
        inc %i | inc %all
        if (%all == 6) { .msg $nick $C(1) $+ ( $+ $C(2) $+ overflow $+ $C(1) $+ ) $+ $C(1)  too many search results to display. | halt }
        if ($findfile($r.srv(Fserve.3,Root.Dir),%search,%i) != $null) { inc %current | .msg $nick $C(1) $+ ( $+ $C(2) $+  $+ %current $+  $+ $C(1) $+ ) file:( $+ $C(2) $+ $right($findfile($r.srv(Fserve.3,Root.Dir),%search,%i),$calc($len($findfile($r.srv(Fserve.3,Root.Dir),%search,%i)) - $len($r.srv(Fserve.3,Root.Dir)))) $+ $C(1) $+ )  size:( $+ $C(2) $+  $+ $big($findfile($r.srv(Fserve.3,Root.Dir),%search,%i)) $+  $+ $C(1) $+ )  trigger:( $+ $C(2) $+  $+ /ctcp $+ $chr(32) $+ $r.srv(Fserve.3,Trigger) $+  $+ $C(1) $+ ) }
        if (%i < %found.3) { goto loop3 }
        goto next3
      }
      :next3
      if (%found.4 != $null) { 
        %i = 0
        :loop4 
        inc %i | inc %all
        if (%all == 6) { .msg $nick $C(1) $+ ( $+ $C(2) $+ overflow $+ $C(1) $+ ) $+ $C(1) too many search results to display. | halt }
        if ($findfile($r.srv(Fserve.4,Root.Dir),%search,%i) != $null) { inc %current | .msg $nick $C(1) $+ ( $+ $C(2) $+  $+ %current $+  $+ $C(1) $+ ) file:( $+ $C(2) $+ $right($findfile($r.srv(Fserve.4,Root.Dir),%search,%i),$calc($len($findfile($r.srv(Fserve.4,Root.Dir),search,%i)) - $len($r.srv(Fserve.4,Root.Dir)))) $+ $C(1) $+ )  size:( $+ $C(2) $+  $+ $big($findfile($r.srv(Fserve.4,Root.Dir),%search,%i)) $+  $+ $C(1) $+ )  trigger:( $+ $C(2) $+  $+ /ctcp $+ $chr(32) $+ $r.srv(Fserve.4,Trigger) $+  $+ $C(1) $+ ) }
        if (%i < %found.4) { goto loop4 }
        goto next4
      }
      :next4
      if (%found.5 != $null) { 
        %i = 0
        :loop5 
        inc %i | inc %all
        if (%all == 6) { .msg $nick $C(1) $+ ( $+ $C(2) $+ overflow $+ $C(1) $+ ) $+ $C(1)  too many search results to display. | halt }
        if ($findfile($r.srv(Fserve.5,Root.Dir),%search,%i) != $null) { inc %current | .msg $nick $C(1) $+ ( $+ $C(2) $+  $+ %current $+  $+ $C(1) $+ ) file:( $+ $C(2) $+ $right($findfile($r.srv(Fserve.5,Root.Dir),%search,%i),$calc($len($findfile($r.srv(Fserve.5,Root.Dir),%search,%i)) - $len($r.srv(Fserve.5,Root.Dir)))) $+ $C(1) $+ )  size:( $+ $C(2) $+  $+ $big($findfile($r.srv(Fserve.5,Root.Dir),%search,%i)) $+  $+ $C(1) $+ )  trigger:(  $+ $C(2) $+  $+ /ctcp $+ $chr(32) $+ $r.srv(Fserve.5,Trigger) $+  $+ $C(1) $+ ) }
        if (%i < %found.5) { goto loop5 }
        goto end
      }
    }
    :end
  }

  


this is only part of the script but for what i'm asking i think this should do..

thanks to you all in advance.. grin