mIRC Home    About    Download    Register    News    Help

Print Thread
/hadd, mask #220036 04/04/10 03:21 PM
Joined: Jan 2010
Posts: 10
B
bebegood Offline OP
Pikka bird
OP Offline
Pikka bird
B
Joined: Jan 2010
Posts: 10
can u add mask support to hadd also ? (like /hdel -w)

just i use hash for players and their scores

to reset example: /hadd -w player.* 0
will be very good for me.
thx anyway.

p.s Yes i can use $hfind, and while, i know, don't need tell me about it, it's just my question can it be added or no.

Last edited by bebegood; 04/04/10 03:23 PM.
Re: /hadd, mask [Re: bebegood] #220040 04/04/10 04:04 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
If you are resetting scores, you are much better off with an alias that creates the table in the beginning that can be used to re-create it anytime it needs "reset".


Invision Support
#Invision on irc.irchighway.net
Re: /hadd, mask [Re: bebegood] #220049 04/04/10 06:48 PM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
It *could* be added, but it doesn't seem all that useful outside this very specific use-case. It would be asking for something like

/set -w %var.* 0

When you could just do

/unset %var.*

Seems very much like an edge case. Write your loop or just reset the table with { hdel tab | hmake tab 100 } (which, as mentioned, your initializing alias should already do)


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: /hadd, mask [Re: argv0] #220065 04/04/10 10:17 PM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
I think this would be a useful addition to the hash commands. The -w switch could be added to /hinc and /hdec as well.

[htbl]
var.A 1
bob.B 2
var.C 3
var.D 4
bob.E 5
var.F 6
bob.G 7
var.H 8

/hinc -sw htbl var.* 3
- Incremented 5 matching hash items by 3


/hdec -sw htbl var.* 8
- Decremented 5 matching hash items by 8


/hadd -sw htbl var.* 43
- Set 5 matching hash items to 43



Can these be scripted? Yes. But then, so could have /hdel -w htbl var.* or /unset %var.*

-genius_at_work

Re: /hadd, mask [Re: bebegood] #220144 06/04/10 04:53 AM
Joined: Jul 2008
Posts: 236
S
s00p Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Jul 2008
Posts: 236
Ever considered a database? They're actually designed for that sort of functionality, where as a hashtable, well... It's sort of inefficient.