mIRC Home    About    Download    Register    News    Help

Print Thread
hash table for dares #115248 24/03/05 02:43 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I'm looking for a hash table (or other storage method) that will keep track of the following:
  • Dare number
  • Daree (nick/address of person performing the dare)
  • Dare time (the length of the dare)
  • Dare Name or Description
  • Darer (nick/address of person that gave the dare)

Re: hash table for dares #115249 24/03/05 10:03 AM
Joined: Dec 2002
Posts: 14
N
namnori Offline
Pikka bird
Offline
Pikka bird
N
Joined: Dec 2002
Posts: 14
usually, for stuff like that, i use a simple hash table, and for each you want to keep a track of, i use a token to split it up, so storing an entry is like

Code:
;item is the dare number
alias dare.add {
  hadd daretable %darenumber %daree @ %dare_time @ %dare_name @ %darer
}

and to retrieve data, I write a series of layers of alias

alias r.dare.daree {
  return $gettok($hget(daretable,$1),64,1)
}

alias r.dare.dare_time {
  return $gettok($hget(daretable,$1),64,2)
}
; etc...


You have to do a lot of checking to make sure each field is there, and have to pick the right token. sometimes i use $chr(160) (non breaking space) or $chr(44) (comma) for readability. just pick something that would rarely be used in the description, and make sure to filter it out incase it is.

Last edited by namnori; 24/03/05 10:04 AM.
Re: hash table for dares #115250 25/03/05 03:06 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Thanks for the assistance.