mIRC Home    About    Download    Register    News    Help

Print Thread
new behavior in hashtable? #223762
01/08/10 12:48 PM
01/08/10 12:48 PM
Joined: Feb 2003
Posts: 3,432
Sweden/Borlänge
S
sparta Offline OP
Hoopy frood
sparta  Offline OP
Hoopy frood
S

Joined: Feb 2003
Posts: 3,432
Sweden/Borlänge
i using this code for one of my scripts
Code:
alias cexcctcp {
  if ($hfind(exclude.ctcp,*,0,w) > 0) {
    var %i = $hfind(exclude.ctcp,*,0,w)
    while (%i) {
      if ($hfind(exclude.ctcp,*,%i,w) iswmcs $nick) { return $true }
      dec %i
    }
  }
}

and then i using $cexcctcp to see if the nick are in the hashtable, it worked in mirc 6.35 now in mirc v.71 it wont work.

Thnx in advance.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: new behavior in hashtable? [Re: sparta] #223768
01/08/10 02:57 PM
01/08/10 02:57 PM
Joined: Feb 2006
Posts: 546
J
jaytea Offline
Fjord artisan
jaytea  Offline
Fjord artisan
J

Joined: Feb 2006
Posts: 546
it's difficult to say without knowing the contents of the hash table, however you can eliminate the loop by using $hfind()'s W option:

Code:
alias cexcctcp return $iif($hfind(exclude.ctcp, $nick, 1, W), $true, $false)


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Re: new behavior in hashtable? [Re: sparta] #223770
01/08/10 03:06 PM
01/08/10 03:06 PM
Joined: Apr 2010
Posts: 910
USA
F
FroggieDaFrog Offline
Hoopy frood
FroggieDaFrog  Offline
Hoopy frood
F

Joined: Apr 2010
Posts: 910
USA
Ignore this. Was code but jaytea's is better smile

Last edited by FroggieDaFrog; 01/08/10 03:07 PM.

I am SReject
My Stuff
Re: new behavior in hashtable? [Re: FroggieDaFrog] #223771
01/08/10 03:09 PM
01/08/10 03:09 PM
Joined: Jul 2007
Posts: 1,129
United States
T
Tomao Offline
Hoopy frood
Tomao  Offline
Hoopy frood
T

Joined: Jul 2007
Posts: 1,129
United States
hfind already has the ability to loop...why use a while loop? smirk

Opps. You already edited it...

Last edited by Tomao; 01/08/10 03:09 PM.
Re: new behavior in hashtable? [Re: Tomao] #223773
01/08/10 03:11 PM
01/08/10 03:11 PM
Joined: Apr 2010
Posts: 910
USA
F
FroggieDaFrog Offline
Hoopy frood
FroggieDaFrog  Offline
Hoopy frood
F

Joined: Apr 2010
Posts: 910
USA
I had forgotten about the W switch


I am SReject
My Stuff