mIRC Home    About    Download    Register    News    Help

Print Thread
#191953 18/12/07 09:55 PM
Joined: Dec 2007
Posts: 4
S
snadrik Offline OP
Self-satisified door
OP Offline
Self-satisified door
S
Joined: Dec 2007
Posts: 4
Anyone has a tip/direction for me, when I want to sort results from idle-info from a channel?
Do I have to store the results in a text-file, then sort the file, then load it back to mIRC?

or is it possible to have newline and such in a variable, and sort it within that variable?

-thanks

Joined: Feb 2006
Posts: 181
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2006
Posts: 181
Help file [/help $sorttok ]:

Code:
$sorttok(text,C,ncra)

Sorts the tokens in text.

$sorttok(e.d.c.b.a,46)        returns a.b.c.d.e

$sorttok(1.3.5.2.4,46,nr)        returns 5.4.3.2.1

The default is an alphabetic sort, 
however you can specify n = numeric sort, 
c = channel nick prefix sort, r = reverse sort, 
a = alphanumeric sort.


n = numeric sort


Note: $sorttokcs() is the case-sensitive version.

Edit:
r = reverse sort
Code:
//echo -a $sorttok(55 80 69 1 43 21 10,32,nr)   returns 80 69 55 43 21 10 1


Code:
//echo -a $sorttok(55 80 69 1 43 21 10,32,n)   returns 1 10 21 43 55 69 80



Last edited by Crinul; 18/12/07 10:11 PM.
Crinul #191957 18/12/07 10:37 PM
Joined: Dec 2007
Posts: 4
S
snadrik Offline OP
Self-satisified door
OP Offline
Self-satisified door
S
Joined: Dec 2007
Posts: 4
I'm aware of $sorttok, I was just wondering if there was an exception, like if I was able to sort a file with a simple command.

I've made something that "kind of works" now, but I hoped there was an easier way.

idle {
.remove moo.txt
var %total = $nick(#,0)
var %lylz = 0
while (%total) {
inc %lylz
.write moo.txt $nick(#,%lylz).idle $nick(#,%lylz)
dec %total
}
set %idle.lines $lines(moo.txt)
unset %yawn
unset %idle.results
while (%idle.lines) {
inc %yawn
dec %idle.lines
set %idle.results %idle.results $+ . $+ $gettok($read(moo.txt,%yawn),1,32)
}
set %idle.results $sorttok(%idle.results,46,a)
set %neee $numtok(%idle.results,46)
unset %yawn
while (%neee) {
inc %yawn
echo -a %yawn . $+ $read(moo.txt,s,$gettok(%idle.results,1,46)) - $duration($gettok(%idle.results,1,46))
set %idle.results $remove(%idle.results,$gettok(%idle.results,1,46) $+ .)
dec %neee
}
}

Joined: Dec 2002
Posts: 503
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
The cheats way is to use a hidden sorted list-box window.

Code:
window -hls @window

'aline' entries to the window, then read them back in order..

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
/help /filter


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard