https://forums.mirc.com/ubbthreads.php/topics/242007/Re_Find_Highest_Value_in_Hash_

I found this via google..It might answer my question. I'll give it a go.

On second thought, maybe I don't understand whats being said in that thread. frown

Code:
var %i = 1, %n = $hget(table,0).data, %high.item, %high.data
while (%i <= %n) {
  if ($hget(table,%i).data > %high.item) {
    %high.item = $hget(table,%i).item
    %high.data = $v1
  }
  inc %i
}

Ok this is what loki posted..sooo I feel like its the right way to do things. I'm just gotta copy it here so its here.


Ok So I've been looking at this and I get what it does..it goes through the hash table and constantly compares the current value %i with the last known high and replaces it when its higher. Ugh this is frustrating, it seems like keeping numbers in order would be a thing a computer should do so naturally and sadly I can't figure out a proper way to do this. Do I need to basically do what is above but just loop through it ten times to get a top 10 list and what if I want 1,000 things sorted?

Oh god, its this filter command. This came up the other day and when I saw the helpfile for it I scurried away.

Code:
  // Sort table in descending order into a temp file (this can also be done in a custom window)
  hsave -n table file.tmp
  filter -ffcuten 2 32 file.tmp file.tmp

  // Get the Nth top value
  echo -a $hget(table,$gettok($read(file.tmp,N),1,32)).item


Ok, I guess I'll look into this.

/filter [-asgdfwxnpriocteubglL] [n-n2] [c s] <INFILE dialog |> <OUTFILE dialog |> [alias] <MATCHTEXT>

Is this real life?

Ok I was able to play with this until it worked for me. I do not understand it at all though. frown

Last edited by Belhifet; 06/12/14 04:42 PM.