mIRC Homepage
Posted By: Stealth Levels sorting - 31/12/05 10:24 PM
It would be nice to have a sort button on the Users tab in the scrips editor. A lot of my levels are named levels, and sometimes it would be the greatest thing in the world to have them sorted smile



However, I am beginning to doubt if there ever will be a new mIRC version...
Posted By: HobophobE Re: Levels sorting - 01/01/06 12:52 AM
You could do this via a script. It was a fairly simple thing to write the following. Anyway, I hope it helps.

In the mIRC help file, it advises not to use writeini on an active .ini file, so you may be better off with a modified version that outputs to a separate .ini, or copying the [users] section of the remote.ini (default location) to another file and then using it.

If you are interested, you could modify the script to allow specifying the type of sort (level, nick, user, host) by name rather than character. If anyone else happens to see this and has any changes/suggestions, please offer them.

I don't actually use mIRC's levels for anything. I used to use it for shitlisting (believe my script may still employ it for that purpose) but it's been a long time since I've needed to add anyone to that list.

usage is: /levelsort file.ini [character] where file is the file with the users section in it. The [character] components are as follows: ":" makes the sort by nick, "!" by user, and "@" by host. [level:nick!user@host]

levelsort {
if (!$1) { echo -a You must use: /levelsort [filename].ini | halt }
hmake levels
hload -i levels $$1 users
var %lvl.tot = $hget(levels,0).item
if (%lvl.tot == 0) { hfree levels | echo -a No data in $$1 | halt }
var %tmpfile = $+($r(a,z),$r(a,z),$r(a,z),$r(a,z),.txt)
var %tmpfile2 = $+(2,%tmpfile)
while (%lvl.tot > 0) {
write %tmpfile $hget(levels,$hget(levels,%lvl.tot).item)
dec %lvl.tot
}
if ($2) {
filter -ct 2 $asc($2) %tmpfile %tmpfile2
}
else {
filter -ct 1 32 %tmpfile %tmpfile2
}
hfree levels
remove %tmpfile
var %tmp.lines = $lines(%tmpfile2)
var %tmp.lin = 1
var %tmp.zero = 0
while (%tmp.lines > 0) {
writeini $$1 users $+(n,%tmp.zero) $read(%tmpfile2,%tmp.lines,%tmp.lin)
inc %tmp.lin
dec %tmp.lines
inc %tmp.zero
}
remove %tmpfile2
}
Posted By: landonsandor Re: Levels sorting - 01/01/06 11:30 AM
I suggested this very idea HERE and I agree with it today
© mIRC Discussion Forums