I want when I request all items from a hash table with this script

Code:
alias hdump {
  if ($1 == $null) {
    var %cnt = $hget(0)
  }
  else {
    var %cnt = $hget($1,0).item
  }

  var %i = 1

  linesep

  while (%i <= %cnt) {
    if ($1 != $null) {
      var %item = $hget($1, %i).item
      var %data = $hget($1, %i).data
    }
    else {
      var %item = $hget(%i)
    }

    if (!%data) {
      echo -a %item
    }
    else {
      echo -a %item -> %data
    }
    inc %i
  }

  if (%cnt == 0) { echo -a no entries }
}


When I do hdump 'myhashtable' all Items + data gets shown like this:

Road_kill -> 53 500000
pian -> 55 112322300000
Tjirp -> 53 12300000

Then I want my script to check ALL items and data, if the 2nd data (12300000 at tjirp etc. etc.) is lower then another data inserted (eg. /hdump myhash 22300000) or could i just use an if-then-else eg. /hdump myhash 22300000, if (data2 <= $3) {

So that something like this comes out:

Tjirp is level 53 and has 12300000 defense, Road_kil is level 53 and has 500000 defense.

(note that pian isnt mentioned since he has 112322300000 defense which is higher then 22300000)

I hope you can help. thanks in forward



---
signatures own