I have a huge protection tcl, and i want to add a kick counter on it. Which is it will read the kick counts from a file so that it would be an orderly counts. I tried Sir_Fz suggestion here but its not orderly counts. Different procs then it counts the new one.
Hope you can get what i mean. Thank you very much.
Last edited by gasak on Fri Jun 29, 2012 12:31 am, edited 1 time in total.
# 28/06/2012
# kickcount function v1.0 for eggdrop
# by doggoo #omgwtfnzbs@EFNET
# http://forum.egghelp.org/viewtopic.php?t=19012
#
# usage:
# just make all your bots KICK msgs look something like this...
# putserv "KICK $chan $who $reason - kick#: [count:kicks]"
#
# returns:
# -kick [slink] test
# * spunky has kicked [slink] from #omgwtfnzbs (test - kick#: 1)
# * [slink] (~bob@omgwtfnzbs.com) has joined #omgwtfnzbs
# -kick [slink] test
# * spunky has kicked [slink] from #omgwtfnzbs (test - kick#: 2)
#
# and so on ect...
proc count:kicks {} {
set increment_count "/path/to/kickcount.db"
if { ![file exists $increment_count] } { putlog "kickcount.db does not exist.";return }
set open_text [open $increment_count "r"]
set KICKCOUNT [read -nonewline $open_text]
close $open_text
incr KICKCOUNT
set re_open_text [open $increment_count "w"]
puts $re_open_text $KICKCOUNT
close $re_open_text
return $KICKCOUNT
}
putlog "kickcount function v1.0 loaded"
Last edited by doggo on Thu Jun 28, 2012 12:26 pm, edited 5 times in total.
It works perfectly But got some question on the kick database "kickcount.db" Why the way it store the kick count is different?
Its like this
1340884296
1340884305
So its gonna be a huge file when it reach for example more than 100 kicks. I used to have one that works that it would replace the number on the database as the kick done on particular times. So when the kicks done already 100 so inside the data is the number 100, when 105 and it shown 105, and so on. So its always only 1 line inside since it replace the number equal the kicks done.
Why do you have to write the kicks count in to a file anyway? You can easily create another kick bind that will monitor and increment the kicks count on a channel made by the bot, like this:
Sorry to bump it again, but i got some minor bugs on the kick count. The counting made is not an order list counted. I put 0 for the first time, but suddenly when the bot kick at the first time its already 13. I try again to make it kick then its correct counting to 14. And after that it jumps again to 21 for the next kick. Please advice about this minor bugs.