mIRC Home    About    Download    Register    News    Help

Print Thread
#182723 13/08/07 08:28 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Hello all,

I have a list with words and numbers that I want to sort on the number.

Basicly in this format:
word <tab> number

Now I try to sort this list on the number, but the filter command doesn't evaluate the number. It's being stupid... frown
/filter -etucff 2 9 file1.tmp file2.tmp

=22:16:36= <+Bot> Word1 77
=22:16:38= <+Bot> NoWord 71
=22:16:40= <+Bot> Wording 70
=22:16:42= <+Bot> AlsoWord 70
=22:16:44= <+Bot> OtherWord 7
=22:16:46= <+Bot> SomeWord 67

Obviously that 7 should be at the end of the list, not between 70 and 67. Does anyone know how to solve this? Or how to get round it?

Thanks a lot!

Joined: Jun 2003
Posts: 994
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Jun 2003
Posts: 994
use 07


I refuse to engage in a battle of wits with an unarmed person. wink
Joined: Apr 2006
Posts: 464
O
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Hmm, well the number is being generated using a /hinc command.
How could I write 07 instead of 7?
Is there a command to convert it to 07 ?

Thx smile

Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
I suggest using $base(NR,10,10,2,0).
You might want to increase the third param, "zeropad" for further compatibility with higher numbers. For example $base(55,10,10,4,0) will return 0055

Last edited by Horstl; 13/08/07 08:49 PM.
Joined: Apr 2006
Posts: 464
O
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
\o/ laugh

Thx Horstl, that works like a charm.

Joined: Jul 2006
Posts: 4,180
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,180
$base(NR,10,10,2,0)

The last parameter (0) is not necessary in this case but can you give me help about it ? at least an exemple smile

Edit : after some test it seems to works like $round .

Last edited by Wims; 14/08/07 01:18 AM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #182735 14/08/07 01:17 AM
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
It's called "precision"

$base(15.3175,10,10,3,0) == 015
$base(15.3175,10,10,3,1) == 015.3
$base(15.3175,10,10,3,2) == 015.31
$base(15.3175,10,10,3,3) == 015.317 etc

Note that it's "cutting", not rounding.
Compare the last two lines with:

$round(15.3175,2) == 15.32
$round(15.3175,3) == 15.318

Joined: Jul 2006
Posts: 4,180
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,180
Yes, i understand how it's working, i just said "seems to work like" because i don't know how to say it exactly in english smile


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard