Code: Select all
Tcl error [dcc:antilag]: can't set "::lag": variable is array
Code: Select all
# --- #
# fb.lagcheck.tcl 1.03 by FrostByte
# http://www.KeyIRC.net
# -
# This script will automatically check the lag between the bot and server.
# If the lag is greater than the set number of seconds, it will jump servers.
# -
# Updates:
# -
# 1.01 - Added a public command for bot masters: !lagcheck
# This will make the bot check it's lag.
# -
# 1.02 - Added configuration for a lagcheck notification.
# - Added configuration for userflag command.
# - Added DCC command.
# -
# 1.03 - Added multi-channel support for notification.
#
# Commands are:
#
# (pub) !lagcheck - This makes the bot check it's lag.
# (dcc) .lagcheck - This does the same as above.
#
# --- #
# Set here the user flag for using the commands.
set lagflag "mno|mno"
# Set here the channels that the bot will notify that the lag is too high. Set to "" to disable.
set lagchans "#romania_nationalista #sarutuldulce #militienii"
# This is the lag limit, if the lag exceeds this time (in seconds), the bot will jump servers.
set antilagtime 5
# This is the script timer, this is the number of minutes the bot will check the lag.
set lagtimer 20
# Set this to 1 if you want the bot to notify the partyline when checking the lag. Set to 0 to disable.
set lagnotify 1
### Do not edit below this line! ###
### ---------------------------- ###
set antilagv 1.03
bind raw - 391 raw:check:lag
bind pub ${lagflag} !lagcheck pub:antilag
bind dcc ${lagflag} lagcheck dcc:antilag
if {![info exists antilagloaded]} {
timer $lagtimer proc:antilag
set antilagloaded 1
}
proc proc:antilag {} {
global lagtimer lagnotify
set ::lag "[clock clicks]"
set ::type 0
if {$lagnotify == 1} { putlog "\002-Anti-Lag-\002 Now checking server lag." }
putquick "TIME"
timer $lagtimer proc:antilag
}
proc pub:antilag {nick uhost hand chan text} {
global lagchans
if {([lsearch -exact [split [string tolower $lagchans]] [string tolower $chan]] != -1)} {
set ::lag "[clock clicks]"
set ::type 1
set ::chan $chan
putquick "PRIVMSG $::chan :\002 Si acu sa vad ce lag am \002"
putquick "TIME"
}
}
proc dcc:antilag {hand idx text} {
set ::lag "[clock clicks]"
putlog "\002-Anti-Lag-\002 Now checking server lag."
set ::type 2
putquick "TIME"
}
proc raw:check:lag {from key text} {
global antilagtime lagchans lagnotify
set lag [expr ((([clock clicks] - $::lag)/2)/60)/1000.]
if {$lagnotify == 1} { putlog "\002-Anti-Lag-\002 Lagu e de \002$lag\002 seconde." }
if {$::type == 1} { putquick "PRIVMSG $::chan :\002-Anti-Lag-\002 Lagu curent e de \002$lag\002 seconds." }
if {($lagnotify == 0) && ($::type == 2)} { putlog "\002-Anti-Lag-\002 Current lag is \002$lag\002 seconds." }
if {$lag > $antilagtime} {
if {($lagchans != "") && ($::type != 2)} {
foreach msgchan [split [string tolower $lagchans]] {
putquick "PRIVMSG $msgchan :\002Attention\002: Domle am mai mult de $antilagtime seconde (currently at $lag seconds). Ies putin schimb servaru si mantorc."
}
}
putlog "\002-Anti-Lag-\002 Lag exceeded $antilagtime seconds. Trying another server..."
jump
}
unset ::lag
if {[info exists ::chan]} { unset ::chan }
if {[info exists ::type]} { unset ::type }
}
putlog "\002-Anti-Lag-\002 $antilagv by FrostByte: Loaded