mIRC Home    About    Download    Register    News    Help

Print Thread
#135508 12/11/05 02:55 PM
Joined: Jul 2005
Posts: 13
C
Pikka bird
OP Offline
Pikka bird
C
Joined: Jul 2005
Posts: 13
Code:
 
on *:text:*:#:{  
  if (!lines == $1) && (!%lines) {
    msg # $hget(lines,$+(#,.,$iif($2,$2,$nick)))
    set -u10 %lines on 
  }
  elseif (!top == $1) { 
    .window -a @top 
    .window -a @topl    
    .aline @top $hget(lines,$hfind(lines,$+($chan,.*),1,w).item).data - $hfind(lines,$+($chan,.*),1,w).item  
    .aline @top $hget(lines,$hfind(lines,$+($chan,.*),2,w).item).data - $hfind(lines,$+($chan,.*),2,w).item  
    .aline @top $hget(lines,$hfind(lines,$+($chan,.*),3,w).item).data - $hfind(lines,$+($chan,.*),3,w).item                                                  
    .filter -wwteu 3 32 @top @topl    
    msg # $line(@topl,1)
    msg # $line(@topl,2)
  } msg # $line(@top,3)
  else hinc -m lines $+($chan,.,$nick) $calc($0 + 1)
}
}

 

the prob is with the window thing,
the stats aren't correct, when the first user types for example - 30 lines,
and then someone else is typing 2, the window shows that
they both have the same amount of lines :\
hope someone can help smile

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Not sure if this is what's causing the problem or not, but your $hfinds are using a .item property, which, according to the mIRC help file, does not exist. The only property for $hfind is .data

I don't understand how custom windows work, as I've not used them very much, but that's the only problem with your script that I was able to see.

Joined: Jul 2005
Posts: 13
C
Pikka bird
OP Offline
Pikka bird
C
Joined: Jul 2005
Posts: 13
Code:
   
-
2 - #test.pow
2 - #test.clyde

that's what I get on the window...
althought, clyde has no lines on the channel.

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
the prob is with the window thing,
the stats aren't correct, when the first user types for example - 30 lines,
and then someone else is typing 2, the window shows that
they both have the same amount of lines :\
hope someone can help smile


But the code isnt designed to keep track of how many lines someone has typed, so why would it.?!?!?!?!

hinc -m lines $+($chan,.,$nick) $calc($0 + 1)
^ that keeps adding the number of words plus 1 some one says tot there total

As for the rest of it, it doesnt in anyway pull the top 3

try the code below
BUT before you do type in /HFREE -sw lines
Code:
on *:text:*:#:{
  tokenize 32 $strip($1-)
  ;
  var %lines = $calc( 1 + $gettok($hget(lines,$+($chan,.,$nick)),2,32))
  var %words = $calc($0 + $gettok($hget(lines,$+($chan,.,$nick)),3,32))
  hadd -m lines $+($chan,.,$nick) $chan %lines %words
  ; Hashtable "lines" holds itemnames "<chan>.<nick>" the data for each is formated as "<chan> <lines> <words>"
  ;
  if ($1 == !lines) && (!%on.text.event.!lines.blocker) {
    set -u10 %on.text.event.!lines.blocker = $true 
    var %nick = $iif($2,$2,$nick)
    if ($hget(lines,$+($chan,.,%nick))) {
      msg $chan %nick has entered $gettok($v1,2,32) lines and $gettok($v1,3,32) words.
    }
  }
  ;
  elseif (!top == $1) {
    hsave -n lines lines.tempfile.txt
    filter -ffctuen 2 32 lines.tempfile.txt lines.tempfile.txt $chan *
    if ($read(lines.tempfile.txt,nt,1) && $hget(lines,$gettok($v1,1,32)).item) { msg $nick No1 in $chan is user $remove($v1,$+($chan,.)) with $gettok($hget(lines,$v1),2,32) lines and $gettok($hget(lines,$v1),3,32) words. }
    if ($read(lines.tempfile.txt,nt,2) && $hget(lines,$gettok($v1,1,32)).item) { msg $nick No2 in $chan is user $remove($v1,$+($chan,.)) with $gettok($hget(lines,$v1),2,32) lines and $gettok($hget(lines,$v1),3,32) words. }
    if ($read(lines.tempfile.txt,nt,3) && $hget(lines,$gettok($v1,1,32)).item) { msg $nick No3 in $chan is user $remove($v1,$+($chan,.)) with $gettok($hget(lines,$v1),2,32) lines and $gettok($hget(lines,$v1),3,32) words. }
  }
}


The lines hashtable items are still defined as <chan>.<nick> but now hold 3 things <chan> the channel name <lines> the number of lines entered and <words> number of words entered
I left <words> on the end as i wasnt sure if you ment to record them or not.
<chan> had to be included for the /filter command to be able to filter out all other channels values.

requirments mirc 6.16


Link Copied to Clipboard