mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2007
Posts: 66
B
beer Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Jul 2007
Posts: 66
Hi. Is it possible to $hfind table items containing a wildcard and matching the data, or do you have to $hfind match the data, then loop through the list to check if the table item is correct?

For example, say I have the following table:
Code
some.item.HASH1.startedby adam
some.item.HASH1.finishedby brian

some.item.HASH2.startedby charlie
some.item.HASH2.finishedby adam

some.item.HASH3.startedby adam
some.item.HASH3.finishedby adam


And I want to find all the hashes where *.startedby = adam. Logically something like `if some.item.*.startedby = adam, then add item to list`. The resulting like would be:
Code
some.item.HASH1.startedby
some.item.HASH3.startedby


As far as I can tell, it's only possible to search *all* table items for a data match but not search wildcard-matched items for a data match.

Thanks for the help guys!

Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
You can only search for item, or for data, not both at once, the easiest would be to match on item for "some.item.*.startedby" and check if that item's value is adam:

Code
noop $hfind(table,some.item.*.startedby,w,0,if ($hget(table,$1) == adam) var %list %list $1)
echo -s item matching: %list


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jul 2007
Posts: 66
B
beer Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Jul 2007
Posts: 66
That's what I figured, thanks for clarifying Wims!

note: Just noticed the $hfind has "w,0" which is the reverse order. Should be "0,w".

Last edited by beer; 16/04/20 01:45 AM.
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
There is no universe where I don't make this mistake eek


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard