mIRC Home    About    Download    Register    News    Help

Print Thread
question on limiting results found in a txt file #162581 20/10/06 11:37 AM
Joined: Aug 2004
Posts: 423
C
clutz1572 Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Aug 2004
Posts: 423
i have this code:
Code:
alias  m.imdb {
  .fopen imdb imdb.txt
  if $ferr { echo -a read error | fclose imdb | return }
  .fseek -w imdb *Titles (Partial Matches)*
  if !$feof && !$ferr {
    while $fread(imdb) != </ol> {
      var %a = $v1
      if *Titles (Partial Matches)* iswm %a { blah blah stuff }
      else  blah blah or else stuff   }
  }
  .fclose imdb
}
  


with this code it returns all the results found under the match. but if theres like over 200 results that come up, it gets kinda overloaded. so is there anyway to have it limit the results to somewhere aound 50 results..???

any info on this will be appreciated ...
thanks

Re: question on limiting results found in a txt fi #162582 20/10/06 03:27 PM
Joined: Oct 2006
Posts: 166
B
b1ink Offline
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2006
Posts: 166
this could be done with two ways..
1st: use filter and check for $filtered
2nd: set a variable on 1 and keep it increasing til it reaches 50

Code:
alias  m.imdb {
   [color:red]var %limit[/color]
  .fopen imdb imdb.txt
  if $ferr { echo -a read error | fclose imdb | return }
  .fseek -w imdb *Titles (Partial Matches)*
  if !$feof && !$ferr {
    while $fread(imdb) != </ol> {
      var %a = $v1
      [color:red]if (%limit = 50) break[/color] 
      [color:red]inc %limit[/color] 
      if *Titles (Partial Matches)* iswm %a { blah blah stuff }
      else  blah blah or else stuff   }
  }
  .fclose imdb
}


Kind Regards, blink
Re: question on limiting results found in a txt fi #162583 22/10/06 04:02 PM
Joined: Aug 2004
Posts: 423
C
clutz1572 Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Aug 2004
Posts: 423
thanks b1ink, that worked perfectly... cool