egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Ordered Response
Goto page Previous  1, 2
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Cardinal
Voice


Joined: 24 Jan 2006
Posts: 19

PostPosted: Sun Jan 29, 2006 6:15 am    Post subject: Reply with quote

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

But thats not working...

Thank you anyway for the patience![/code]
Back to top
View user's profile Send private message
Cardinal
Voice


Joined: 24 Jan 2006
Posts: 19

PostPosted: Sun Jan 29, 2006 6:42 am    Post subject: Reply with quote

Done!

Code:

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

Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Jan 29, 2006 9:08 pm    Post subject: Reply with quote

Or you can do this:
Code:
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)]"
}

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber