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]
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)]"
}
}
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)]"
}