mIRC Home    About    Download    Register    News    Help

Print Thread
#12361 22/02/03 12:41 AM
Joined: Feb 2003
Posts: 2
X
x11 Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
X
Joined: Feb 2003
Posts: 2
For example, in my triviascore.ini i have a list of users
[wins]
user1=100
user2=300
user3=467
user4=355
My question is... How do we calculate the rank of these users (1, 2,3,4)? When they type !rank it will tell them their rank ... many thanks!!

#12362 22/02/03 01:01 AM
Joined: Dec 2002
Posts: 332
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
well i am not exactly sure but i think i can put you in the right direction something like this
Code:
 
on 1:TEXT:!rank:*: {
  set %nick $nick
  if ( $nick isin $readini(triviascore.ini,wins,%nick) ) { msg $chan your rank is ----- $nick }
 

not sure exactly how you would pull the rank from the file hope that helps some

#12363 22/02/03 01:19 AM
Joined: Dec 2002
Posts: 77
B
Babel fish
Offline
Babel fish
B
Joined: Dec 2002
Posts: 77
Try this...

Code:
on *:TEXT:!rank:#: {
  msg $chan Your current rank is $rank($nick)
} 


alias rank {
  var %user = $1
  var %count = 1
  while $ini(triviascore.ini, wins, %count) {
    var %scores = $addtok(%scores, $readini(triviascore.ini, wins, $ifmatch) $ifmatch, 44)
    inc %count
  }
  var %scores = $sorttok(%scores, 44, nr)
  return $ord($findtok(%scores, $wildtok(%scores, * $+ %user, 1, 44), 44))
}
 

#12364 22/02/03 01:31 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
qwerty's excellent algorithm for just this exercise. I used the Search feature and put in the words "filter numeric" in All forums | All dates.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C

Link Copied to Clipboard