mIRC Home    About    Download    Register    News    Help

Print Thread
#6636 15/01/03 07:35 AM
Joined: Dec 2002
Posts: 417
O
Othello Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
The problem I have is when this script searches all the list It has collected. It will still send a responce on files found even if it has found no files I feel my problem lies in the :END section. Where the script will DCC Send a list that is basicly empty except for the lines telling what it has found. Any help would be appreciated.

Code:
  [color:red]  

alias lsb_chk_lst {
  set %lsb=list %lsb_list 
  set %lsb_list 0
  var %lsb.time $ticks
  set %lsb.file * $+ $replace($replace($replace($replace(%lsb.temp,$chr(32),*),_,*),-,*),?,*) $+ *
  if !%lsb.file { msg $nick 12 No search string was entered $+ $chr(160) | halt }
  if %lsb.file == * { msg $nick 12 No search string was entered $+ $chr(160) | msg $nick 12Try again | halt }
  if %lsb.file == $null { halt } 
  else {
    var %lsb.sflnm %lsb_rslt_dir $+ Result_ $+ $replace(%lsb.file,$chr(42),$chr(95)) $+ .txt
    var %lsb.cnt 1
    :loop
    inc %lsb_list 1
    var %lsb.flnm = $findfile(%lsb_lst_dir,*.txt,%lsb.cnt) 
     if $left($nopath(%lsb.flnm),7) == Result_ { inc %lsb.cnt 1 | goto loop }
    else {
      filter -ff %lsb.flnm %lsb.sflnm * $+ %lsb.file $+ * 
      if %lsb.sflnm == $null { inc %lsb.cnt 1 | goto loop }
      else { write %lsb.sflnm $chr(10) | inc %lsb.cnt 1 | goto loop }
    }
  }
  :end
  var %lsb.fcnt $lines(%lsb.sflnm)
  set %lsb.flnm %lsb.sflnm
 [color:blue]if %lsb.fcnt <= 12 { [/color] [color:red]  
    msg $nick 2 L12ist 2S12earch 2B12ot Found4 NO12 matches for4 %lsb.temp $+ 2....
    msg $nick 12 Try a different spelling of4 %lsb.temp $+ 2....
    remove %lsb.send.flnm
    set %lsb.send.flnm
    halt
  }
  else {
    var %lsb.time $calc(($ticks - %lsb.time) / 1000 )
    %lsb.fcnts = %lsb.fcnt - 12
    msg $nick 2 L12ist 2S12earch 2B12ot Found 2[4 %lsb.fcnts 2] $&
      12matches for4 %lsb.file 12in 2[4 $duration(%lsb.time) 2] 
    msg $nick 2 L12ist 2S12earch 2B12ot will now Dcc you a list of its findings2....
    set %lsb.send.flnm %lsb.sflnm
    $lsb.send
  }
}

[/color]
[/color]

[EDIT: added a line continuation $& to shorten the long line for display in the forum. -Hammer]

Last edited by Hammer; 15/01/03 05:47 PM.



Intelligence: It's better to ask a stupid question, then to prove it by not asking....
#6637 15/01/03 11:00 AM
Joined: Dec 2002
Posts: 20
C
Ameglian cow
Offline
Ameglian cow
C
Joined: Dec 2002
Posts: 20
your problem is that $null is not less than or equal to 12.

try changing

Code:
 if %lsb.fcnt <= 12 {    


to

Code:
 if (%lsb.fcnt && %lsb.fcnt <= 12) {  


If that's not it, I dunno. I'm up REAL late, or real early, depending on how you look at it. :-/ Hope I helped.


"Illegitimati non Carborundum" -> "Don't let the bastards grind you down."
#6638 15/01/03 06:00 PM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Code:

alias lsb_chk_lst {
  var %lsb.time = $ticks
  set %lsb=list %lsb_list 
  set %lsb_list 0
  set %lsb.file $+(*,$replace(%lsb.temp,$chr(32),*,_,*,-,*,?,*),*)
  if ((%lsb.file == ***) || (!$len(%lsb.temp))) {
    msg $nick 12 No search string was entered
    if ($ifmatch == ***) msg $nick 12Try again 
    [color:#840017]HALT[/color]
  }
  var %lsb.sflnm = $+(%,lsb_rslt_dir,Result_,$replace(%lsb.file,*,_),.txt)
  var %lsb.cnt = 1
  while ($findfile(%lsb_lst_dir,*.txt,%lsb.cnt)) {
    var %lsb.flnm = $ifmatch
    if ($left($nopath(%lsb.flnm),7) != Result_) {
      filter -ff %lsb.flnm %lsb.sflnm * $+ %lsb.file $+ * 
      if (%lsb.sflnm) write %lsb.sflnm $chr(10)
    }
    inc %lsb_list 1
  }
  var %lsb.fcnt = $lines(%lsb.sflnm)
  if ((!%lsb.fcnt) || (%lsb.fcnt < 13)) {
    msg $nick 2 L12ist 2S12earch 2B12ot Found4 NO12 matches for4 %lsb.temp $+ 2....
    msg $nick 12 Try a different spelling of4 %lsb.temp $+ 2....
    .remove %lsb.send.flnm
    unset %lsb.send.flnm
    [color:#840017]HALT[/color]
  }
  set %lsb.flnm %lsb.sflnm
  %lsb.fcnts = %lsb.fcnt - 12
  set %lsb.send.flnm %lsb.sflnm
  %lsb.time = $calc($timezone + (($ticks - %lsb.time) / 1000 ))
  msg $nick 2 L12ist 2S12earch 2B12ot Found 2[4 %lsb.fcnts 2] $&
    12matches for4 %lsb.temp 12in 2[04 $+($asctime($int(%lsb.time),n:ss),$gettok(%lsb.time,2,46)) 2] 
  msg $nick 2 L12ist 2S12earch 2B12ot will now Dcc you a list of its findings2....
  $lsb.send
}
[/color]

This code seems to be setting a great number of variables that are never used, at least not used in this alias. Make sure these are being set properly when you call the alias. A simple echo at the top of the alias will tell you whether or not they are set properly.

echo -a * Temp: %lsb.temp «» List: %lsb.list

Just be sure you're aware of it, %lsb=list is a valid variable name in and of itself (though I'm sure you realize this).

When you halt the script inside an if statement and there is only an else, the else itself is not needed since you've already halted the script.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C

Link Copied to Clipboard