mIRC Home    About    Download    Register    News    Help

Print Thread
#120639 19/05/05 10:13 PM
Joined: Apr 2005
Posts: 72
B
Babel fish
OP Offline
Babel fish
B
Joined: Apr 2005
Posts: 72
hello
i have followig code:
Code:
on *:text:!points:#blaaa:{ 
  if ($hget(tmp,$nick)) { 
    .notice $nick » points: $calc($hget(tmpj,$nick) + $hget(tmp,$nick))
  }
}

format of hashtables:
nick
points
nick
points
.
.
how can i get the Top 10 nick+points from the hashtables ( use tmpj+tmp)

thx bodo

#120640 20/05/05 12:14 AM
Joined: Mar 2004
Posts: 175
Vogon poet
Offline
Vogon poet
Joined: Mar 2004
Posts: 175
This should work:

Code:
on *:TEXT:!top10:#blaaa: {
  window -h @top10
  clear @top10
  var %x = 1
  while ($hget(tmp,%x).item) {
    echo @top10 $v1 - $hget(tmp,%x).data
    inc %x
  }
  var %x = 1
  while ($hget(tmpj,%x).item) {
    var %y = $v1
    if ($fline(@top10,%y *)) {
      rline @top10 $v1 %y - $calc($token($line(@top10,$v1),2,32) + $hget(tmpj,%x).data)
    }
    else {
      echo @top10 %y - $hget(tmpj,%x).data
    }
    inc %x
  }
  filter -cteu 3 32 @top10 @top10
  set -u1 %top10nick $nick
  set -u1 %top10timer 1
  .notice $nick Top 10 Points List:
  filter -kn @top10 top10
  window -c @top10
}
alias -l top10 {
  tokenize 32 $1-
  .timer 1 %top10timer .notice %top10nick $1 $+ . $2-
  inc %top10timer
}


- Relinsquish
#120641 20/05/05 03:42 AM
Joined: Apr 2005
Posts: 72
B
Babel fish
OP Offline
Babel fish
B
Joined: Apr 2005
Posts: 72
it doesn´t seems to wotk :-(

#120642 20/05/05 10:32 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Since you only display results if "$hget(tmp,$nick)" exists, ill assume this contains a superset of the nicks in tmpj

Code:
on *:TEXT:!top10:#blaaa: {
  window -c @top10.hiddenwindow
  window -hn @top10.hiddenwindow
  var %i = 1 | while ($hget(tmp,%i).item) { aline @top10.hiddenwindow $v1 $calc($hget(tmp,$v1) + $hget(tmpj,$v1)) | inc %i }
  filter -wwcteu 2 32 @top10.hiddenwindow @top10.hiddenwindow
  dline @top10.hiddenwindow 11-
  iline @top10.hiddenwindow 1 Top 10 Points List:
  savebuf @top10.hiddenwindow playqN.txt
  .play -n $nick playqN.txt
  .remove playqN.txt
  window -c @top10.hiddenwindow
}

#120643 20/05/05 01:51 PM
Joined: Apr 2005
Posts: 72
B
Babel fish
OP Offline
Babel fish
B
Joined: Apr 2005
Posts: 72
it worx many thanks :-)


Link Copied to Clipboard