mIRC Home    About    Download    Register    News    Help

Print Thread
#10717 12/02/03 01:05 AM
Joined: Dec 2002
Posts: 204
K
keeker Offline OP
Fjord artisan
OP Offline
Fjord artisan
K
Joined: Dec 2002
Posts: 204
hi yall,

i am having a little problem with $findfile and /hadd. The code below has two sections, the first part, in green , works and has no problems other than being a little slow, but the second part, in red, totally freezes up mirc, and makes it stop responding, no matter how long i wait. the first part, writes the files to a custom window and then adds the files to a hash table, and the second part is SUPPOSED to add the files straight into a hash table with hadd and $findfile in a while loop.

Code:
  [color:green]Menu channel,status {
  Update Hash List:{
    window -esn @files
    echo -a 11,2Processing File List, Please Wait...................
    echo -a 11,2Adding $findfile($mp3dir,*.mp3,0,aline @files $1- ) files, I am doing further processing now.
    savebuf @files neorawfiles.txt
    window -c @files
    var %songno $lines(neorawfiles.txt)
    while %songno > 0 {
      hadd -m filelist file $+ %songno $read(neorawfiles.txt,%songno)
      dec %songno
    }
    echo -a 11,2Finished adding4,2 $lines(neorawfiles.txt) 11,2files to the filelist hash table
  }
 [color:red] Test update hash list - WARNING:{
    if ($hget(filelist) != filelist) {
      hmake filelist 1000      
      var %thmp = $findfile($mp3dir,*.mp3,0)
      while %thmp > 0 {
        .hadd filelist file $+ %thmp $findfile($mp3dir,*.mp3,%thmp)
        dec %thmp
      }
    }
    elseif  ($hget(filelist) == filelist) {
      hfree filelist
      hmake filelist 1000      
      var %thmp = $findfile($mp3dir,*.mp3,0)
      while %thmp > 0 {
        .hadd filelist file $+ %thmp $findfile($mp3dir,*.mp3,%thmp)
        dec %thmp      
      }
    }
  } 
}
[/color][/color]

Like I said, it keeps locking mirc up so that it doesnt respond. can y all look over the code, and see what i am doing wrong, or tell me IF hadd and findfile can be used in a while loop like this?


keek: Scots - intr.v. keeked, keekĀ·ing, keeks
To peek; peep.
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
Code:
Menu channel,status {
  Update Hash List:{
    window -esn @files
    echo -a 11,2Processing File List, Please Wait...................
    echo -a 11,2Adding $findfile($mp3dir,*.mp3,0,aline @files $1- ) files, I am doing further processing now.
    savebuf @files neorawfiles.txt
    window -c @files
    var %songno $lines(neorawfiles.txt)
    while %songno > 0 {
      hadd -m filelist file $+ %songno $read(neorawfiles.txt,%songno)
      dec %songno
    }
    echo -a 11,2Finished adding4,2 $lines(neorawfiles.txt) 11,2files to the filelist hash table
  }
  [color:red]Test update hash list:{
    if $hget(filelist) { hfree filelist }
    hmake filelist 1000
    .!echo -q $findfile($mp3dir,*.mp3,0,hadd filelist $+(file,$calc($hget(filelist,0).item +1)) $1-)
  }
}[/color]

Joined: Dec 2002
Posts: 204
K
keeker Offline OP
Fjord artisan
OP Offline
Fjord artisan
K
Joined: Dec 2002
Posts: 204
thanks nimue, that makes my list go a heck of a lot faster smile


keek: Scots - intr.v. keeked, keekĀ·ing, keeks
To peek; peep.
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
Yep, adding commands into $findfile() is far quicker than looping through results manually. smile

Joined: Dec 2002
Posts: 332
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
if i may ask ? what is the purpose of the Hash Table ? i'm not criticizing the script by any means smile just not quite sure what the purpose is

Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
Perhaps you might ask keeker that smile

Joined: Dec 2002
Posts: 332
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
if i may ask ? what is the purpose of the Hash Table ? i'm not criticizing the script by any means just not quite sure what the purpose is specifically of the Hash Table thx

Joined: Dec 2002
Posts: 332
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
ic sorry i didnt think which reply you clicked on was specific ? i thought it just replied to the post in general smile


Link Copied to Clipboard