I am very new in programming with Tcl and Eggdrop. I wanted to write a script, that writes the current number of users of a channel in a textfile.
Everytime a user joins the channel, the script opens the file "users.txt" and adds 1 to the existing number. And when a user leaves the channel, it substracts 1. But the script doesn't work, there's only a linefeed in the textfile. Where's my fault?
The first script I think will do the job for you in this result.
All scripts normally store channel peak users such as I have
a channel kick counter for my bot in .txt files myself.
·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee) PS: Guys, I don't accept script helps or requests personally anymore.
==================================
because the script doesn't write the 0 into the file although this has nothing to do with the binds. Is there an other possibility to put a number into a file?
I shrinked the script a little bit, but there's still the problem with the filecreation in line7, I always get a file with just a cryptic sign in it. If I replace line 15-17 with the comment-line, the script works fine but of course then it doesn't export the number into the file
# Create the storage file for users.
if {![file exists "users.txt"]} {
set none [open "users.txt" w]
close $none
unset none
if {![file exists "users.txt"]} {
putlog "*** (notes) ERROR: Unable to write to \"users.txt\" ***"
return 0
}
}
Add [SOLVED] to the thread title if your issue has been. Search | FAQ | RTM
yeah, thx, the filecreation is working now. But there's still the problem with the cryptic sign that is exported into the file instead of the visitor-number.
proc nc_join { nick host hand chan } {
set visitors [llength [chanlist $chan]]
# puthelp "PRIVMSG $chan : $visitors"
set saveme [open "users.txt" w]
puts $saveme $visitors << Mistake must be here, I think.
close $saveme
}
The Logfile doesn't report any error, so where's my mistake?