I downloaded this script a while ago, and only just tried to run it,
but when I do I get an error back saying:
Tcl error [dq]: can't read "file": no such variable
It'd be great if anyone could help, im fairly new to tcl and can't
really see the problem, thanks.
I tried adding "set file $serverfile" into the dq proc, but it makes another
error now:
Tcl error [dq]: can not find channel named "./qstat/hlserver.dat"
Also, I've been trying to figure out how to get it to
scan though all the servers in one group (company)
and tell me how many people there are on all the servers
it would need to add up the taken slots, and then the total
available slots, should look something like this on the channel:
"me: players jolt"
"bot: Jolt dod 71 players in 100 slots (6 servers)"
ive been trying to to this but cant work it out :/
The script comes with a .dat file, i'll list its contents after the main script.
main script:
Code: Select all
# Requires QStat 2.4e for Unix - Available from www.qstat.org
# Configuration Options:
# Public command trigger
set tr "!"
# Path to qstat folder containing qstat program
set pathqstat "./qstat/"
# Channels you _dont_ want the bot to reply to public triggers on (seperate with spaces):
set nopub ""
# Path to server data file
set serverfile "./qstat/hlserver.dat"
############################################################################
# This is where the BOFH's leave their code. Mess with it at your own risk #
############################################################################
# Public Binds
bind pub -|- ${tr}queryip hls
bind pub -|- ${tr}query dq
bind pub -|- ${tr}queryhelp help
bind pub -|- ${tr}bygames
bind pub -|- ${tr}wireplay old
bind pub -|- ${tr}jolt old
proc help {nick host hand chan arg} {
global url pathqstat tr nopub
if {[lsearch -exact $nopub [string tolower $chan]] >= 0} {return 0}
if {$arg == ""} {
putserv "notice $nick :usage: !query company mod"
putserv "notice $nick :or: !query company mod server-number"
putserv "notice $nick :or: !queryip server-ip"
putserv "notice $nick :Valid values for <company>: bygames jolt wireplay"
putserv "notice $nick :Valid values for <mod>:
putserv "notice $nick :dod (day of defeat)"
return 0
}
}
proc old {nick host hand chan arg} {
global url pathqstat tr nopub
if {[lsearch -exact $nopub [string tolower $chan]] >= 0} {return 0}
if {$arg == ""} {
putserv "notice $nick :Sorry, that command is not available in this version of hlserver.tcl"
putserv "notice $nick :For help with using this script type: !queryhelp"
return 0
}
}
proc hls {nick host hand chan arg} {
global url pathqstat tr nopub
if {[lsearch -exact $nopub [string tolower $chan]] >= 0} {return 0}
if {$arg == ""} {
putserv "notice $nick :Usage: ${tr}queryip <IP Address>"
return 0
}
set stat [exec $pathqstat/qstat -hls $arg -old]
putserv "PRIVMSG $chan :$stat"
return 0
}
proc dq {nick host hand chan arg} {
global url pathqstat tr nopub serverfile
if {[lsearch -exact $nopub [string tolower $chan]] >= 0} {return 0}
set host [lindex $arg 0]
set servertype [lindex $arg 1]
set servernumber [lindex $arg 2]
if {$servernumber == ""} {
set servernumber "all"
}
if { [file exists $serverfile] } { set file [open $serverfile r]
} else {
putserv "privmsg $chan Server data file ($serverfile) not found"
}
set server ""
while { ![eof $file] } {
set server [gets $file]
set xserverhost [lindex $server 0]
set xservertype [lindex $server 2]
set xservernumb [lindex $server 1]
set xserveripad [lindex $server 3]
if {$host == $xserverhost} {
if {$servertype == $xservertype} {
if {$servernumber == $xservernumb} {
set stat [exec $pathqstat/qstat -hls $xserveripad -old]
putserv "privmsg $chan :$stat"
}
if {$servernumber == "all"} {
set stat [exec $pathqstat/qstat -hls $xserveripad -old]
putserv "notice $nick :$stat"
}
}
}
}
}
return 0
}
The server .dat file: (example ip's)
Code: Select all
Jolt 1 dod 56.172.18.21:27015
Jolt 2 dod 56.172.18.28:27016
Jolt 3 dod 57.172.18.18:27017
Jolt 4 dod 57.172.18.14:27015
Jolt 5 dod 58.172.18.20:27015
Jolt 6 dod 58.172.18.10:27016