Problem:
If i run this script my eggdrop won`t save changes on the channelfile which are made by
- .tcl channel set #channel ?changes?
- .chanset #channel +/-?
I have no idea what can cause this, but perhaps it has to do with setudf str name...
Code: Select all
putlog "*** now loading stat.tcl by sKy\\ ***"
#############################################################################################################################
# count users file #
#############################################################################################################################
# bind time - "00 * * * *" skystat
proc skystat { min hour day moth year } {
set datum [strftime "%d.%m.%y, %H:%M"]
set info1 "$datum"
append info $info1
foreach channel [channels] {
if { [channel get $channel inactive] } { continue }
if { ! [validchan $channel] } { continue }
set y [llength [chanlist $channel]]
set info2 "$channel $y"
append info "\n$info2"
}
append info "\n"
set file [open "stats.txt" "a"]
puts $file $info
close $file
}
#############################################################################################################################
# userscount #
#############################################################################################################################
setudef str userscount
bind time - "00 * * * *" skystat:userscount
proc skystat:userscount { min hour day moth year } {
global botnick
foreach channel [channels] {
if { ! [onchan $botnick $channel] } { continue }
if { ! [validchan $channel] } { continue }
set userscount [channel get $channel userscount]
if { $userscount == "" } { set userscount 0 }
set chanlist [llength [chanlist $channel] ]
set userscount [expr { $userscount + $chanlist } ]
set userscount [expr { $userscount / 2 } ]
channel set $channel userscount $userscount
}
}
#############################################################################################################################
# skystat init #
#############################################################################################################################
proc skystat:init { varname } {
if { ! [info exists $varname] } {
set $varname 0
}
}
#############################################################################################################################
# skystat save #
#############################################################################################################################
proc skystat:save { } {
foreach channel [channels] {
if { [channel get $channel inactive] } { continue }
if { ! [validchan $channel] } { continue }
skystat:vars $channel
set skystat_quit [channel get $channel skystat_quit]
set skystat_killed [channel get $channel skystat_killed]
set skystat_glined [channel get $channel skystat_glined]
set skystat_part [channel get $channel skystat_part]
set skystat_join [channel get $channel skystat_join]
set skystat_pubm [channel get $channel skystat_pubm]
set skystat_kick [channel get $channel skystat_kick]
set skystat_nicks [channel get $channel skystat_nick]
if { $skystat_quit == "" } { set skystat_quit 0 }
if { $skystat_killed == "" } { set skystat_killed 0 }
if { $skystat_glined == "" } { set skystat_glined 0 }
if { $skystat_part == "" } { set skystat_part 0 }
if { $skystat_join == "" } { set skystat_join 0 }
if { $skystat_pubm == "" } { set skystat_pubm 0 }
if { $skystat_kick == "" } { set skystat_kick 0 }
if { $skystat_nicks == "" } { set skystat_nicks 0 }
channel set $channel skystat_quit [expr { $::skystat_quit($channel) + $skystat_quit } ]
channel set $channel skystat_killed [expr { $::skystat_killed($channel) + $skystat_killed } ]
channel set $channel skystat_glined [expr { $::skystat_glined($channel) + $skystat_glined } ]
channel set $channel skystat_part [expr { $::skystat_part($channel) + $skystat_part } ]
channel set $channel skystat_join [expr { $::skystat_join($channel) + $skystat_join } ]
channel set $channel skystat_pubm [expr { $::skystat_pubm($channel) + $skystat_pubm } ]
channel set $channel skystat_kick [expr { $::skystat_kick($channel) + $skystat_kick } ]
channel set $channel skystat_nick [expr { $::skystat_nick($channel) + $skystat_nicks } ]
}
}
#############################################################################################################################
# skystat vars #
#############################################################################################################################
proc skystat:vars { channel } {
skystat:init ::skystat_quit($channel)
skystat:init ::skystat_killed($channel)
skystat:init ::skystat_glined($channel)
skystat:init ::skystat_part($channel)
skystat:init ::skystat_join($channel)
skystat:init ::skystat_pubm($channel)
skystat:init ::skystat_kick($channel)
skystat:init ::skystat_nick($channel)
}
#############################################################################################################################
# skystat sign #
#############################################################################################################################
setudef str skystat_quit
setudef str skystat_killed
setudef str skystat_glined
bind sign - * skystat:sign
proc skystat:sign { nickname hostname handle channel reason } {
if { ! [validchan $channel] } { return }
if { [string match -nocase "*killed*" $reason] } {
skystat:init ::skystat_killed($channel)
set ::skystat_killed($channel) [expr { $::skystat_killed($channel) +1 } ]
return
}
if { [string match -nocase "*g-lined*" $reason] } {
skystat:init ::skystat_glined($channel)
set ::skystat_glined($channel) [expr { $::skystat_glined($channel) +1 } ]
return
}
skystat:init ::skystat_quit($channel)
set ::skystat_quit($channel) [expr { $::skystat_quit($channel) +1 } ]
return
}
#############################################################################################################################
# skystat part #
#############################################################################################################################
setudef str skystat_part
bind part - * skystat:part
proc skystat:part { nickname hostname handle channel reason } {
if { ! [validchan $channel] } { return }
skystat:init ::skystat_part($channel)
set ::skystat_part($channel) [expr { $::skystat_part($channel) +1 } ]
}
#############################################################################################################################
# skystat join #
#############################################################################################################################
setudef str skystat_join
bind join - * skystat:join
proc skystat:join { nickname hostname handle channel } {
if { ! [validchan $channel] } { return }
skystat:init ::skystat_join($channel)
set ::skystat_join($channel) [expr { $::skystat_join($channel) +1 } ]
}
##################################################################################################################################
# skystat pubm #
##################################################################################################################################
setudef str skystat_pubm
bind pubm - * skystat_pubm
proc skystat_pubm { nickname hostname handle channel text } {
if { ! [validchan $channel] } { return }
skystat:init ::skystat_pubm($channel)
set ::skystat_pubm($channel) [expr { $::skystat_pubm($channel) +1 } ]
}
##################################################################################################################################
# skystat kick #
##################################################################################################################################
setudef str skystat_kick
bind kick - * skystat_kick
proc skystat_kick { nickname hostname handle channel target reason } {
if { ! [validchan $channel] } { return }
skystat:init ::skystat_kick($channel)
set ::skystat_kick($channel) [expr { $::skystat_kick($channel) + 1 } ]
}
##################################################################################################################################
# skystat nick #
##################################################################################################################################
setudef str skystat_nick
bind nick - * skystat_nick
proc skystat_nick { nickname hostname handle channel newnick } {
if { ! [validchan $channel] } { return }
skystat:init ::skystat_nick($channel)
set ::skystat_nick($channel) [expr { $::skystat_nick($channel) +1 } ]
}
##################################################################################################################################
# skystat trigger #
##################################################################################################################################
bind dcc mno stat skystat:dcc
proc skystat:dcc { handle idx text } {
set nickname [hand2nick $handle]
set hostname [getchanhost $nickname]
set channel $text
set text "dcc"
skystats:pub $nickname $hostname $handle $channel $text
}
bind pub mno|mno \$stat skystats:pub
proc skystats:pub { nickname hostname handle channel text } {
if { ! [validchan $channel] } { return }
set skystat_quit [channel get $channel skystat_quit]
set skystat_killed [channel get $channel skystat_killed]
set skystat_glined [channel get $channel skystat_glined]
set skystat_part [channel get $channel skystat_part]
set skystat_join [channel get $channel skystat_join]
set skystat_pubm [channel get $channel skystat_pubm]
set skystat_kick [channel get $channel skystat_kick]
set skystat_nicks [channel get $channel skystat_nick]
set userscount [channel get $channel userscount]
set info "TOTAL: joins: $skystat_join ‹ text: $skystat_pubm ‹ parts: $skystat_part ‹ kicks: $skystat_kick ‹ quits: $skystat_quit ‹ nicks: $skystat_nicks ‹killed: $skystat_killed ‹ glined: $skystat_glined ‹ USERSCOUNT: $userscount"
if { $text == "dcc" } {
putlog $info
return
} else {
puthelp "PRIVMSG $channel :$info"
}
}
putlog "0,4*** skystat.tcl by sKy\\ loaded. ***"