mIRC Home    About    Download    Register    News    Help

Print Thread
#204329 16/09/08 12:58 AM
Joined: Oct 2007
Posts: 214
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Oct 2007
Posts: 214
Hello,

I am wanting to make an alias to check a hash table to see if an item is listed in the hash table.

how would that work?

Code:
if ($hget(TABLENAME,ITEM)) { return $true }
else { return $false }
 


This just isint working for me, any ideas?

Thanks a bunch.

Cheers,

J

Last edited by Buggs2008; 16/09/08 01:18 AM.
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
Try something like :
Code:
alias ishitem return $iif($hget($$1,$$2),$true,$false)
And try this exemple (/ex_hitem) :
Code:
alias ex_hitem {
hadd -m Ga isGa 1
echo -a $ishitem(Ga,isGa)
echo -a $ishitem(Ga,isnotGa)
hfree Ga
}




#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
You could also use $hfind

Code:
return $iif($hfind(tablename,item,0),$true,$false)


That is a simple example. The $hfind identifier can handle much more complex searches, including, but not limited to, wildcard, regex, and data.

See /help $hfind for more information.

Joined: Oct 2007
Posts: 214
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Oct 2007
Posts: 214
Thanks Wims and Russel for helping me out so much.

I think in my case I found the hfind method pretty useful and porbably more versatile for the information that I want to find.

Thanks so much for helping me out. I couldnt have figured this out without a little advice.

Cheers,

Jay


Link Copied to Clipboard