mIRC Home    About    Download    Register    News    Help

Print Thread
#61398 22/11/03 07:59 AM
Joined: Jan 2003
Posts: 154
B
BoredNL Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Jan 2003
Posts: 154
an option to have an extended level of values for a hash table would be nice.

The usage would be: /hmake -s <name> <N> [levels]
(the default being what it currently is, which is 1 for the hash table).

This is the current structure (in idea) of a hash contents:
ITEM
VALUE

This is the current structure (in idea) of an ini file created by mIRC, which is 2 deep:

SECTION
ITEM
VALUE

/writeini -n <inifile> <section> <item> <value>

Now, if a hash table could have a specifiable amount of levels, it could look like this:
SECTION
SUB-SECTION
SUB-SECTION
VALUE
SUB-SECTION
VALUE
SUB-SECTION
VALUE
SUB-SECTION
VALUE
SUB-SECTION
VALUE
SUB-SECTION
VALUE

This example has 3 levels, and to add something to it, you would type in the following: /hadd -l3 <name> <section> <section> <item> <value>
to add to the second level.. /had -l2 <name> <section> <item> <value>

This would prove to be very very very worthful to myself and many others I imagine. wink

Could you imagine trying to organize your computer if all you could make was directories 1 level deep off of your hard drive? Now imagine trying to sort large databases through a hash file in the same manner.. it's not easy..


- Wherever you go there you are.[color:lightgreen]
#61399 22/11/03 02:58 PM
Joined: Apr 2003
Posts: 414
Fjord artisan
Offline
Fjord artisan
Joined: Apr 2003
Posts: 414
You can use a script till Khaled integrate new switch.. wink

Code:
 
;By Adrenalin ;)
Alias Hadd {
  if ((-* iswm $1) &amp;&amp; (l isin $1)) {
    var %level = $calc($mid($1,$calc($pos($1,l,1)+1),1))
    if (%level !isnum) {
      echo 4 -s the -l parameter is wrong !
      return
    }
    var %first = $remove($1,-l $+ %level)
  }
  else {
    !hadd $1-
  }
  var %sections = $gettok($1-,3- $+ $calc(%level + 2),32)
  var %sections = $replace(%sections,$chr(32),.)

  var %value = $gettok($1-,$calc(%level + 3) $+ - ,32)

  !hadd %first $2 %sections %value
}


Alias Hgett {
  var %level = $gettok($2-,0,32)
  if ($prop != $null) var %prop = $+(.,$prop)
  if (%level == 1) {
    return $hget($1,$2) $+ %prop
  }
  var %sections = $replace($2-,$chr(32),.)
  return $hget($1,%sections) $+ $+ %prop
}

example of use:
/hadd -ml3 Univers MilkyWay Earth Moldova Adrenalin
//echo $hgett(Univers,MilkyWay,Earth,Moldova)


mIRC Chm Help 6.16.0.3 Full Anchored!

Link Copied to Clipboard