mIRC Home    About    Download    Register    News    Help

Print Thread
#117285 14/04/05 03:59 AM
Joined: Jul 2003
Posts: 77
B
Babel fish
OP Offline
Babel fish
B
Joined: Jul 2003
Posts: 77
id like ot see a /hlist alias built in ive scripted one several times, its farily useful for debuging purposes and genreally looking at a hash table though i doubt anyone else will agree with me... note it kidna works like find file

/hlist somealias $$1
or
echo -a $hlist(somealias $$1)

woudl sendhash table name to somealias

/hlist hTable somealias $$1 - $$2

in the first example would send every item - data to somealias that is in the hash table hTable...

i just find it useful on occasion tis all...

so lets imagine we have hash tables
_bama1
_bama2
_somehash

and i do /hlist echo -a $$1

it would output
_bama1
_bama2
_bama3

and if i did /hlist _bama1 echo -a $$1

it woudl output
item1 - data1
item2 - data2
... etc


hmmm signed by me
#117286 14/04/05 04:47 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I would think that the disorder factor of hashtables would make this data hard to read at the best of times.

#117287 14/04/05 08:59 PM
Joined: Jul 2003
Posts: 77
B
Babel fish
OP Offline
Babel fish
B
Joined: Jul 2003
Posts: 77
ya i know it wouldnt be in any particular order but still... i just think its a neat feature though i posted knowing that i didnt think others would agree


hmmm signed by me
#117288 15/04/05 05:05 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
oh dont get me wrong I dont have any negitive feelings about it, as in a snap, its a good command for displaying the contents, especially if the tables just a small one or something, and now I think about it, even the disorder problem is quickly fixable, you output to a @win, which is either pre sorted or you just issue a filter command onto it, and of course as you said, it is an alias thats been called so a /hlist command could take on a aspect far beyond just a "hash table lister", it could be used to process's a list of nicks, update a set of score tables etc etc

A Nice simple but effective command for multiple purposes.

I liked it enough that i wrote one of my own, for general purposes.

I would advise anyone to NOT use the * option to list all hashtables, If there real big ones, its gonna lag out.

Code:
;Usage /HLIST HASHTABLENAME CMD
;* HASHTABLENAME is any hashtable name wildcards allowed
;* CMD is any mirc command or alias, The CMD well be envoked once with only $1=hashtableNAME
;*     then well be envoked repeatedly with $1=hashtableNAME $2=hashtableITEM $3-=hashtableVALUE
;*     should a second hashtable also meet any wildcard matching the next table well then be processed as above through CMD
;*NB : It is important to remember that $1 $2 $3 when passed as part of CMD well be should not be evaluated prior to passing ie: you use $!1 $!2 $!3-
;
;Example usage can be found in /HTLW (hashtable list window)
;
alias hlist {
  if ($2) {
    var %i = $hget(0)
    while (%i) {
      if ($1 iswm $hget(%i)) {
        var %tempfile = $+(Delete_Me_Im_A_Temp_File.,$ticks,$mid($rand(1000000,1999999),2),.txt)
        write -c %tempfile | hsave -iou $hget(%i) %tempfile
        filter -cffxctu 1 61 %tempfile %tempfile [hashtable]
        set -l %temp1 $iif($var(%hlist.hashtable,0),%hlist.hashtable) | set %hlist.hashtable $hget(%i)
        set -l %temp2 $iif($var(%hlist.command  ,0),%hlist.command)   | set %hlist.command   $2-
        hlistitem | ; *** This line produces the CMD with only $1=hashtableNAME defined, so if you dont want that remark this out ***
        filter -fk %tempfile hlistitem
        $iif(!%temp1,unset,set) %hlist.hashtable %temp1
        $iif(!%temp2,unset,set) %hlist.command %temp2
        .remove %tempfile
      }
      dec %i
    }
  }
}
;
alias -l hlistitem {
  if ($pos($1,=,1)) tokenize 32 $left($1-,$calc($v1 - 1)) $mid($1-,$calc($v1 + 1))
  tokenize 32 %hlist.hashtable $1-
  ;echo -st table is $1 : item is $2 : value is $3-
  $(%hlist.command,2)
}
;
alias htlw {
  window -t30,60 @htw
  aline @htw Name $chr(9) Item $chr(9) Value
  hlist $iif($1,$1,*) aline @htw $!1 $chr(9) $!2 $chr(9) $!3-
}

#117289 15/04/05 11:50 AM
Joined: Feb 2003
Posts: 307
T
Fjord artisan
Offline
Fjord artisan
T
Joined: Feb 2003
Posts: 307
I made this one for me 2 years ago to simply list the hashtables

alias hlist {
var %i = 1
while (%i <= $hget(0)) {
echo List $hget(%i) with size $hget(%i,0).item
inc %i
}
}

it alwais worked fine


Link Copied to Clipboard