@Tomao: I usually recommend saving regularly for any hash table that gets updated on a regular basis. mIRC or the computer itself can crash for a variety of reasons. When this happens, you don't trigger the QUIT or EXIT events and you'll lose everything since the last save. If the data is very important and updates often, saving on each update is a good option. If the data isn't as important and it's okay if you were to lose and hour or a couple of hours or even a day or more, you can use a timer either exclusively or in addition to a QUIT or EXIT event. Just set the timer to whatever level is acceptable for a worst-case loss scenario. For something like scores or points, saving often is usually a good idea. Also, if the bot isn't rebooted often, you can risk losing days, weeks, or even months worth of data if you only use a QUIT or EXIT event.

@DarkCastle: Here's one option. This just loops through the entire table. If the table isn't large, this should be fine.

Code:
var %count = $hget(tablename,0).item
while (%count) {
  if ($hget(tablename,%count) >= 4) { do something }
  dec %count
}


If the table gets really big, you may want to consider other options to filter the results. One common option is to save the table to a temp file and use /filter on it to sort the results from high to low. Then you can loop through until the value is < 4 and stop the loop at that point. That may be a little more work, but it cuts down on the number of loops you have to go through. For larger data sets, that's going to be a lot faster. For small data sets like I think yours will be, it really isn't going to matter.


Invision Support
#Invision on irc.irchighway.net