This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Ordered Response

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
C
Cardinal
Voice
Posts: 19
Joined: Tue Jan 24, 2006 6:33 pm

Post by Cardinal »

I replaced the * on bind pubm with "Junge" because the script should just count the word "junge", not every word ;)

But thats not working...

Thank you anyway for the patience![/code]
C
Cardinal
Voice
Posts: 19
Joined: Tue Jan 24, 2006 6:33 pm

Post by Cardinal »

Done!

Code: Select all

if {[file exists scripts/wordcount.txt]} {  
 foreach {word count} [split [read [set infile [open scripts/wordcount.txt]]][close $infile] \n] {  
  if {$word != ""} {  
   set wordcount($word) $count  
  }  
 }  
}  

bind time ?0* save:wc  
bind pubm - * state:wc  

proc save:wc args {  
 global wordcount  
 set f [open scripts/wordcount.txt w]  
 foreach {w c} [array get wordcount] {  
  puts $f "$w $c"  
 }  
 close $f  
}  

proc state:wc {nick uhost hand chan arg} {  
if {[string match -nocase *junge* $arg]} { 
 global wordcount  
 set word [string tolower [lindex [split $arg] 0]]  
 if {![info exists wordcount($word)]} { set wordcount($word) 0 }  
 puthelp "privmsg $chan :$word Nr. [incr wordcount($word)]"  
} 
}

User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Or you can do this:

Code: Select all

bind pub - junge state:wc

proc state:wc {nick uhost hand chan arg} {
 global wordcount
 if {![info exists wordcount(junge)]} { set wordcount(junge) 0 }
 puthelp "privmsg $chan :junge Nr. [incr wordcount(junge)]"
}
Post Reply