mIRC Home    About    Download    Register    News    Help

Print Thread
#96781 05/09/04 03:44 PM
Joined: Jun 2004
Posts: 291
W
Fjord artisan
OP Offline
Fjord artisan
W
Joined: Jun 2004
Posts: 291
i have a hash table,
and i wanted to add an item which is more than 1 word
eg
/hadd tablename the item here value of the item here
but when i type
//echo $hget(tablename,item here)
it does nothing
and when i type
//echo $hget(tablename,item)
it would echo here value here

pls help me thanks alot
smile

#96782 05/09/04 04:31 PM
Joined: Aug 2004
Posts: 101
D
Vogon poet
Offline
Vogon poet
D
Joined: Aug 2004
Posts: 101
You can't have spaces in hash table entry name. What you can do to overcome the problem really depends on what you're doing and why you want it like this.
Why don't you $replace $chr(32) with another character or even $remove it from the name?


Maybe I wake up one day to notice that all my life was just a dream!
#96783 05/09/04 07:23 PM
Joined: Jun 2004
Posts: 291
W
Fjord artisan
OP Offline
Fjord artisan
W
Joined: Jun 2004
Posts: 291
so if i added different charecters for the spaces
would i be able to change the back easy enough
i need a ctcp script at the end of it
so when someone types
/ctcp me the command here
it will look in the hash table
for
the*command*here*
and ctcp reply the nick with the value
of
the*command*here

thanks for the help
smile

edit:
the code i just tried but it didnt work:
ctcp *:*:?: {
var %triggerz = $replace($1-,$chr(32),$chr(1))
if ($hget(tablename,%triggerz) {
ctcpreply $nick yourctcp $hget(tablename,%triggerz)
}
}


pls help
:P
thanks

Last edited by whatsthedillio; 05/09/04 08:24 PM.
#96784 06/09/04 03:26 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
That should work.

This is the same...
Code:
ctcp *:*:?: { 
  if $hget([color:maroon]tablename[/color],$replace($1-,$chr(32),$chr(1))) { ctcpreply $nick yourctcp $v1 }  
}
Don't forget to change tablename to the actual tablename wink

#96785 06/09/04 08:38 AM
Joined: Feb 2004
Posts: 50
D
Babel fish
Offline
Babel fish
D
Joined: Feb 2004
Posts: 50
I get around this by doing this sort of thing:

Code:
hadd -m hashtable $+($1,.,$2) $3-


adding a . between $1 and $2, effectively giving $1 as section and $2 as entry, $3- as entry data.

#96786 06/09/04 10:39 AM
Joined: Aug 2004
Posts: 101
D
Vogon poet
Offline
Vogon poet
D
Joined: Aug 2004
Posts: 101
Perhaps he wants more than $1-2 in the name...

whatsthedillio>
You don't really have to change it back! All you want is to get the corresponing value in the hash table! You just want something to match he sentence!

If your and Iori's solutions don't work, use $hash identifier like this:
if $hget( tablename , $hash($1-,16) ) { ... }

$hash is usually used for longer lines but it'll do in your case too! Just make sure the other solution doesn't really work (though it should) because it is better!


Maybe I wake up one day to notice that all my life was just a dream!
#96787 06/09/04 04:40 PM
Joined: Jun 2004
Posts: 291
W
Fjord artisan
OP Offline
Fjord artisan
W
Joined: Jun 2004
Posts: 291
cool thanks alot everyone
for all the replies
ill see if i can get it to work
:P
thanks again

#96788 06/09/04 04:58 PM
Joined: Jun 2004
Posts: 291
W
Fjord artisan
OP Offline
Fjord artisan
W
Joined: Jun 2004
Posts: 291
cool it works great
but it also says invalid ctcp command
any way to stop it from this
and thanks for making it work
smile


Link Copied to Clipboard