mIRC Home    About    Download    Register    News    Help

Print Thread
help me on this one please #100245 11/10/04 09:05 AM
Joined: Apr 2003
Posts: 42
E
eendje Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Apr 2003
Posts: 42
its an alias designed to check a file and put the orders from high to low.

eg.
if in sometext is
1 1
3 3
2 2
4 4
hello 6
you 2

it should be after the alias

hello 6
4 4
3 3
you 2
2 2
1 1

the script I made to do it:

Code:
alias readi {
  %a = 2
  %b = $lines(D:/Themirc/sometext.txt)
  %g = 1
  While (%a <= %b) {
    %c = $read(sometext.txt, %a)
    %d = $gettok(%c,2,32)
    %e = $read(sometext.txt, %g)
    %f = $gettok(%e,2,32)
    if (%d >= %f) {
      write -l $+ %g Sometext.txt %c
      write -l $+ %a Sometext.txt %e
      inc %a
      inc %g
    }
    elseif (%d <= %f) {
      inc %a
      inc %g
    }
  }
}



what it does is get line #1 and #2, the second value (so a number), checks up if #2 is higher then #1, if so place #1 on line2, and #2 on line 1. then checks #2 and #3. etc. etc.

unfortunatly I get an error in the while loop, ( I dont know why )

please can anyone help?


---
signatures own
Re: help me on this one please #100246 11/10/04 01:46 PM
Joined: Aug 2003
Posts: 314
S
Sigh Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2003
Posts: 314
You can do this with a single command: /filter -ctffeu 2 32 sometext.txt sometext.txt

Re: help me on this one please #100247 11/10/04 04:47 PM
Joined: Apr 2003
Posts: 42
E
eendje Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Apr 2003
Posts: 42
so I have been eating my fingers for nothing lol:) hmm filters. Tried to read trough the help file but a little to much switches lol;D thanks a lot anyway


---
signatures own