mIRC Home    About    Download    Register    News    Help

Print Thread
#200712 10/06/08 11:44 AM
Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
Thanks qwerty. As you said, I replaced the hash name iptracker to %hash and it works once again. Originally I wrote the alias specifically for iptracker, but I modified it to be able to use it on other hashes.


I registered; you should too.
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
You seem to be lacking error checking: you are assuming that %b is always set, that is, every match in the iptracker table will have a corresponding match in the %hash table. Apparently that's not the case, so you should check whether %b is $null before you use it further.

Apart from that, there's something that doesn't look quite right:

set %c $hget(%hash,%a).data

What this does is retrieve the value of the %a-th item in %hash. Since hash tables are not ordered in any meaningful way, and that order changes as you add items, you most probaby do NOT want to access a hash table in that way. What you seem to need is the value of the item in %b. That's just

set %c $hget(%hash,%b)

I'd suggest you experiment with hash tables before trying to use them in "production": start out with simple example tables and test what each hash table-related identifier returns for various parameters you pass it, in order to get a good grasp on their function.



/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Link Copied to Clipboard