mIRC Home    About    Download    Register    News    Help

Print Thread
#132632 13/10/05 01:59 AM
Joined: Jun 2005
Posts: 127
H
HAMM3R Offline OP
Vogon poet
OP Offline
Vogon poet
H
Joined: Jun 2005
Posts: 127
Hey
Code:
on *:text:*:#: {
  writeini stats.ini words $nick $calc($ini(stats.ini,words,$nick) + $numtok($1-,32))
  writeini stats.ini lines $nick $calc($ini(stats.ini,lines,$nick) + 1)
  if ($1 == !stats) && (!$2) {
    msg $chan $nick $+ 's Stats: $ini(stats.ini,words,$nick) words ( $+ $round($calc($ini(stats.ini,words,$nick) / $ini(stats.ini,lines,$nick)),2) words per line $+ )
  }
}
It records the first words said by each nick, but it wont continue to add on like it should. What's the problem?


-- HAMM3R (aka: alhammer)
http://www.HAMM3R.net
#132633 13/10/05 02:34 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
In order to do the calculation, you have to read the current value from the ini file.
Code:
on *:text:*:#:{
var %words = $readini(stats.ini,n,words,$nick)
var %lines = $readini(stats.ini,n,lines,$nick)
if !%words { var %words = $numtok($1-,32), %lines = 1 }
else { 
inc %words $numtok($1-,32)
inc %lines 1
}
.writeini stats.ini words $nick %words
.writeini stats.ini lines $nick %lines
if ($1 == !stats) && (!$2) {
.msg $chan $nick $+ 's Stats: %words words ( $+ $round($calc(%words / %lines),2) words per line $+ )
}
}
 


I put in the variables, rather than leaving the direct access coding, which you were using, due to the fact that using the variables means the information comes from ram, rather than having to be read from the hard drive each time. This is a faster method, and also means that your hard drive isn't accessed as often, extending the life of your drive.

#132634 13/10/05 10:04 AM
Joined: Jun 2005
Posts: 127
H
HAMM3R Offline OP
Vogon poet
OP Offline
Vogon poet
H
Joined: Jun 2005
Posts: 127
Great work, thanks. I have 1 more question though. How might I count the number of characters (excluding spaces if possible) in a string of text?


-- HAMM3R (aka: alhammer)
http://www.HAMM3R.net
#132635 13/10/05 10:26 AM
Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
$len($remove(string of text,$chr(32)))
smile


$maybe
#132636 13/10/05 07:07 PM
Joined: Jun 2005
Posts: 127
H
HAMM3R Offline OP
Vogon poet
OP Offline
Vogon poet
H
Joined: Jun 2005
Posts: 127
Great! Thanks very much to both of you.

HAMM3R


-- HAMM3R (aka: alhammer)
http://www.HAMM3R.net

Link Copied to Clipboard