Quote:
I suppose what I need is a way to resort teh hash table once the first item is always deleted but I read on here on several posts that sorting hash tables is impossible.


You can not sort a hashtable at all, its not designed to be sorted be it on itemname or data or entery insertion date.
You can create what is essentially a sorted list of the hashtable, but this requieres hsaving to files and filtering that info using a sort then back refrencing it to the orgina hashtable, and this lasts for only as long as you do not alter the hashtable.

However what you want is alot simplier, you just need to keep a record of the start and end of the queue.

Example:
Code:
alias quetest {
  var %text
  if ($window(@quetest)) { 
    ;write quetest.txt $1-
    var %queEND = $calc(1 + $hget(quetest,queEND))
    hadd -sm quetest que $+ %queEND $1-     
    hadd -sm quetest queEND %queEND
    ;^ Pull in the END of queue pos and add 1 to it, then save the data into this location and save the new END pos of the queue
    ;
    return
  }
  if (!$window(@quetest)) { 
    if ($calc($hget(quetest,queDONE)) < $calc($hget(quetest,queEND))) {
      ;^ if the last DONE queue pos is less than the END of queue pos there must be something in the queue, so deal to it
      ;
      ;%text = $read(quetest.txt,1) | write -dl1 quetest.txt
      var %queDONE = $calc(1 + $hget(quetest,queDONE))
      var %text = $hget(quetest,que $+ %queDONE)
      hdel -s quetest que $+ %queDONE
      ;*2
      hadd -sm quetest queDONE %queDONE
      ;^ Pull in the last DONE queue pos and add 1 to it, then pull that data out, and delete it from the queue and save the new last DONE pos in the queue
      ;
    }
    else { %text = $1- }
    ;^ *1
  }
  if (%text) {
    window -k0 @quetest 2 2 200 200
    aline @quetest test %text
    timerwincloseqt 1 4 window -c @quetest
    timerchkquetest 1 5 quetest
  }
}


*1 Im not so sure if your logic is correct with the *1 point of your script, i would have thought if some text is passed as $1 it would have been needed to be added to the end of the querue and the first queue entery be removed and used?, this is outside the scope of making your queue work of course, so yuou well know better if that is the case or not. I just thought id mention it as something that looked a bit odd.

*2 the script never bothers to reset the queue DONE and END counters, when the queue expires (no entries), i always thought that extra code was worth little to nothing, since mirc can use huge number in there so why reset it. However if your one of them ones that always like the queue to restart from 1 when it has expired then add the following line at *2
if ($calc($hget(quetest,queDONE)) >= $calc($hget(quetest,queEND))) { var %queDONE = 0 | hadd -sm quetest queEND %queDONE }

On a sidde note....
You might notice i use $calc() around some things, i have done this becuase of the why mirc deals with $null (which might be if queDONE or queEND dont exist) this is just to create a value of zero rather than null
ie:
//if ($null > 1) echo $true : $v1 : $v2 | else echo $false : $v1 : $v2
$false : : 1
//if ($null = 1) echo $true | else echo $false
$false : : 1
//if ($null > 1) echo $true | else echo $false
$false : : 1

verses

//if($calc($null) < 1) echo $true : $v1 : $v2 | else echo $false : $v1 : $v2
$true : 0 : 1