mIRC Homepage
Posted By: whatsthedillio how could i do this?? ;) - 05/09/04 03:44 PM
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
Posted By: dr_Eamer Re: how could i do this?? ;) - 05/09/04 04:31 PM
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?
Posted By: whatsthedillio Re: how could i do this?? ;) - 05/09/04 07:23 PM
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
Posted By: Iori Re: how could i do this?? ;) - 06/09/04 03:26 AM
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
Posted By: Ddan Re: how could i do this?? ;) - 06/09/04 08:38 AM
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.
Posted By: dr_Eamer Re: how could i do this?? ;) - 06/09/04 10:39 AM
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!
Posted By: whatsthedillio Re: how could i do this?? ;) - 06/09/04 04:40 PM
cool thanks alot everyone
for all the replies
ill see if i can get it to work
:P
thanks again
Posted By: whatsthedillio Re: how could i do this?? ;) - 06/09/04 04:58 PM
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
© mIRC Discussion Forums