mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
I keep some numbers in a ini file (num.ini), the formt is:

[numbers]
blap=3000
bleep=4000
neep=6000
veep=1000

And now i trying to filter out the highest number and counting down to the last number, but i cant get it to work as i want it to. I dont know the amount of the total entries of the file in advanced, can be 2 or it can be 2000. Any ideas?
Same if two got the same numbers, dont know how i can make the match in a simple way.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Feb 2006
Posts: 181
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2006
Posts: 181
Originally Posted By: Help file
/help $ini


Or use this:
Code:
alias numbers {
  var %w = @Numbers, %i = 1, %n
  window -h %w
  loadbuf -rtnumbers %w num.ini
  filter -wwteuc 2 61 %w %w
  var %t = $line(%w,0)
  while (%i <= %t) {
    var %l = $line(%w,%i), %n = $addtok(%n,$+(%i,.) $gettok(%l,1,61) $+($chr(91),$gettok(%l,2,61),$chr(93)),32) 
    inc %i
  }
  window -c %w
  echo -sec info Numbers: %n
}

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
If you want to search for values like this you should probably be using an index or tree structure instead of simple key value pairs. And depending on your usage, maybe working on the data in a hash table and using the ini for storage only would be more appropriate.

Code:
[index]
1=veep
2=blap
3=bleep
4=neep

[numbers]
blap=3000
bleep=4000
neep=6000
veep=1000


Link Copied to Clipboard