mIRC Home    About    Download    Register    News    Help

Print Thread
Hash Table Help #43575 22/08/03 01:10 PM
Joined: Aug 2003
Posts: 136
MrPeepers Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Aug 2003
Posts: 136
IM writing a script where you can type !suggest suggestion here to the bot and it would save that, I have it done but without hash table, and Id like to use one everyone seems to like them, I looked in help and I sorta get it but I was wondering if someone could just give me a push start. I was planning on storing The suggest who made it when they made it and their userhost. Im not asking fo ryou to write it just a hin or push start


In Virginia, chickens cannot lay eggs before 8:00 a.m., and must be done before 4:00 p.m.
Re: Hash Table Help #43576 22/08/03 01:25 PM
Joined: Mar 2003
Posts: 1,271
L
LocutusofBorg Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
Code:
/hadd tablename nick $address($nick,3) $ctime suggestion


note:
1. always store times in ctime format - makes for easy calculations should you ever want them. added advantage: it's only one word
2. put the suggestion last. everything else is only one word, so you can easily extract all information

For more info: hash table tutorial by Pasmal


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
Re: Hash Table Help #43577 22/08/03 01:30 PM
Joined: Aug 2003
Posts: 136
MrPeepers Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Aug 2003
Posts: 136
I'd first want to create the has table and then set it to load when I start mirc and save when I quit correct?


In Virginia, chickens cannot lay eggs before 8:00 a.m., and must be done before 4:00 p.m.
Re: Hash Table Help #43578 22/08/03 02:12 PM
Joined: Aug 2003
Posts: 136
MrPeepers Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Aug 2003
Posts: 136
OKay first I make the table /hmake -s suggestion 10
Then I have a remote
on 10:text:!suggest*:*:/hadd -s suggestion $nick $address($nick,3) $ctime $2-
//echo -a The first item found in the suggestion is $hget(suggestion,1).item
Will return the nick that did it but it wont store anything after the nick


In Virginia, chickens cannot lay eggs before 8:00 a.m., and must be done before 4:00 p.m.
Re: Hash Table Help #43579 22/08/03 09:49 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Try..
Code:
on 10:text:!suggest*:[color:red]#[/color]:/hadd -s suggestion $nick $address($nick,3) $ctime $2- 

Last edited by Hammer; 23/08/03 11:02 AM.
Re: Hash Table Help #43580 23/08/03 06:34 AM
Joined: Mar 2003
Posts: 1,271
L
LocutusofBorg Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
What he has would work, just everywhere and not only in a channel.

The $hget(table,1).item returns the item that happens to be in slot one. Hash tables are not sorted in any way. To get the info about the user,

var %user = $hget(tablename,1).item
var %info = $hget(tablename,%user)


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius