Code: Select all
lindex [split $res] 8
Code: Select all
set mapname [string range $mapline 7 $maplineend]
Code: Select all
if {$mapname != $oldmap} {
puthelp "PRIVMSG #channel :New map: $mapname"
}
set oldmap $mapname
Code: Select all
bind time - * qstat ;# runs every minute
proc qstat {m h d mo y} {
# read old map name
set fname "/home/lee/documents/tclmapchange.output"
set fp [open $fname "r"]
set blank [gets $fp]
set blank [gets $fp]
set blank [gets $fp]
set blank [gets $fp]
set blank [gets $fp]
set blank [gets $fp]
set mapline [gets $fp]
close $fp
# strip out <map> and <\map>
set maplinelength [string length $mapline]
set maplineend [expr $maplinelength - 7]
set oldmap [string range $mapline 7 $maplineend]
# run qstat
set blank [exec /usr/local/bin/qstat -ut2s 217.77.176.198:7777 -xml -of /home/lee/documents/tclmapchange.output]
# read new map name
set fname "/home/lee/documents/tclmapchange.output"
set fp [open $fname "r"]
set blank [gets $fp]
set blank [gets $fp]
set blank [gets $fp]
set blank [gets $fp]
set blank [gets $fp]
set blank [gets $fp]
set mapline [gets $fp]
close $fp
# strip out <map> and <\map>
set maplinelength [string length $mapline]
set maplineend [expr $maplinelength - 7]
set mapname [string range $mapline 7 $maplineend]
# if old map different from new map name then print change message.
if {$mapname != $oldmap} {
puthelp "PRIVMSG #titanonslaught :$mapname now running on Titan 32Player Onslaught"
}
}
Code: Select all
#########################################################################
# qstat UT2004 map change notify script #
# this is a TCL script for eggdrop #
# written by Lee Donaghy lee295012@yahoo.com #
# Titan Internet 32 Player Onslaught server #
# ut2004://217.77.176.198:7777 http://ut2004.titaninternet.co.uk/vbb/ #
#########################################################################
# set your qstatpath
set qstatpath "/usr/local/bin/qstat"
# number of servers to check
set server_number 3
# edit the mapchangenotify.serverlist file
# ie.
# -ut2s
# 123.123.123.123:7777
# now running on myonslaught server
# #myirchannel
# -ut2s
# etc...
set mcn_version "v0.1.0"
###############################################################
# TCL code begins, don't edit unless you know what your doing #
###############################################################
putlog "mapchangenotify $mcn_version loaded"
set scan_delay 30000
bind time - * qstatrun ;# runs every minute
proc qstatrun {m h d mo y} {
global qstatpath
global server_number
global scan_delay
set server_count 0
set slcount 0
while {$server_count != $server_number} {
# if the files don't exist then create them
if {![file exists mapchangenotify$server_count.output]} {
# read the serverlist
set slname "mapchangenotify.serverlist"
set sl [open $slname "r"]
set sdlist [split [read $sl] \n]
set qstatgametype [lindex $sdlist $slcount] ; incr slcount
set qstatserverip [lindex $sdlist $slcount] ; incr slcount
set qstataddedtext [lindex $sdlist $slcount] ; incr slcount
set qstatircchan [lindex $sdlist $slcount] ; incr slcount
exec $qstatpath $qstatgametype $qstatserverip -xml -of mapchangenotify$server_count.output
}
incr server_count
}
set server_count 0
set slcount 0
while {$server_count != $server_number} {
# read old map name
set fname "mapchangenotify$server_count.output"
set fp [open $fname "r"]
set blank [gets $fp] ;set blank [gets $fp] ;set blank [gets $fp];set blank [gets $fp];set blank [gets $fp]
set gametypeline [gets $fp]
set mapline [gets $fp]
close $fp
# strip out <map> and <\map>
set oldmap [string range $mapline 7 [expr [string length $mapline] - 7]]
#-------------------------------------------------------------------------------------------------------------------------------------------
# read the serverlist
set slname "mapchangenotify.serverlist"
set sl [open $slname "r"]
set sdlist [split [read $sl] \n]
set qstatgametype [lindex $sdlist $slcount] ; incr slcount
set qstatserverip [lindex $sdlist $slcount] ; incr slcount
set qstataddedtext [lindex $sdlist $slcount] ; incr slcount
set qstatircchan [lindex $sdlist $slcount] ; incr slcount
#-------------------------------------------------------------------------------------------------------------------------------------------
#puts "$qstatircchan $qstatgametype $qstatserverip $qstataddedtext"
exec $qstatpath $qstatgametype $qstatserverip -xml -of mapchangenotify$server_count.output
# read new map name
set fname "mapchangenotify$server_count.output"
set fp [open $fname "r"]
set blank [gets $fp] ;set blank [gets $fp] ;set blank [gets $fp];set blank [gets $fp];set blank [gets $fp]
set gametypeline [gets $fp]
set mapline [gets $fp]
close $fp
# strip out <map> and <\map>
set newmap [string range $mapline 7 [expr [string length $mapline] - 7]]
set gametype [string range $gametypeline 12 [expr [string length $gametypeline] - 12]]
#------------------------------------------------------------------------------------------------------------------------------------------
# if qstat hit the server at the wrong time nothing is returned so having another crack at it
while {[string length $mapline] < 1} {
#after $scan_delay
exec /usr/local/bin/qstat $qstatgametype $qstatserverip -xml -of mapchangenotify$server_count.output
# read new map name
set fname "mapchangenotify$server_count.output"
set fp [open $fname "r"]
set blank [gets $fp] ;set blank [gets $fp] ;set blank [gets $fp];set blank [gets $fp];set blank [gets $fp]
set gametypeline [gets $fp]
set mapline [gets $fp]
close $fp
# strip out <map> and <\map>
set newmap [string range $mapline 7 [expr [string length $mapline] - 7]]
# strip out <gametype> and <\gametype>
set gametype [string range $gametypeline 12 [expr [string length $gametypeline] - 12]]
}
#-----------------------------------------------------------------------------------------------------------------------------------------
incr server_count
if {$newmap != $oldmap} {
puthelp "PRIVMSG $qstatircchan :$newmap $qstataddedtext ($gametype)"
}
}
close $sl
}
Code: Select all
#########################################################################
# qstat UT2004 map change notify script #
# this is a TCL script for eggdrop #
# written by Lee Donaghy lee295012@yahoo.com #
# Titan Internet 32 Player Onslaught server #
# ut2004://217.77.176.198:7777 http://ut2004.titaninternet.co.uk/vbb/ #
#########################################################################
# set your qstatpath
set qstatpath "/usr/local/bin/qstat"
# number of servers to check
set server_number 3
# edit the mapchangenotify.serverlist file
# ie.
# -ut2s
# 123.123.123.123:7777
# now running on myonslaught server
# #myirchannel
# -ut2s
# etc...
set mcn_version "v0.1.0"
###############################################################
# TCL code begins, don't edit unless you know what your doing #
###############################################################
putlog "mapchangenotify $mcn_version loaded"
# read server list
set slname "mapchangenotify.serverlist"
set slct [open $slname "r"]
set sdlist [split [read $slct] \n]
close $slct
# create server files if they don't exist
set cfc 0
while { $cfc != $server_number } {
if {![file exists mapchange]} {
set fname "mapchangenotify$cfc.output"
set fp [open $fname "w"]
close $fp
incr cfc
}
}
#---------------------------------------------------------------------
bind time - * qstatrun ;# runs every minute
proc qstatrun {m h d mo y} {
global qstatpath
global server_number
global slct
global sl
global sdlist
set server_count 0
set slcount 0
while {$server_count != $server_number} {
# read old map name
set fname "mapchangenotify$server_count.output"
set fp [open $fname "r"]
set blank [gets $fp] ;set blank [gets $fp] ;set blank [gets $fp];set blank [gets $fp];set blank [gets $fp]
set gametypeline [gets $fp]
set mapline [gets $fp]
close $fp
# strip out <map> and <\map>
set oldmap [string range $mapline 7 [expr [string length $mapline] - 7]]
#-------------------------------------------------------------------------------------------------------------------------------------------
# set server list
set qstatgametype [lindex $sdlist $slcount] ; incr slcount
set qstatserverip [lindex $sdlist $slcount] ; incr slcount
set qstataddedtext [lindex $sdlist $slcount] ; incr slcount
set qstatircchan [lindex $sdlist $slcount] ; incr slcount
#-------------------------------------------------------------------------------------------------------------------------------------------
exec $qstatpath $qstatgametype $qstatserverip -xml -of mapchangenotify$server_count.output
# read new map name
set fname "mapchangenotify$server_count.output"
set fp [open $fname "r"]
set blank [gets $fp] ;set blank [gets $fp] ;set blank [gets $fp];set blank [gets $fp];set blank [gets $fp]
set gametypeline [gets $fp]
set mapline [gets $fp]
close $fp
# strip out <map> and <\map>
set newmap [string range $mapline 7 [expr [string length $mapline] - 7]]
set gametype [string range $gametypeline 12 [expr [string length $gametypeline] - 12]]
#------------------------------------------------------------------------------------------------------------------------------------------
# if qstat hit the server at the wrong time nothing is returned so having another crack at it
set recheckbreak 0
set mlbroken 0
while {[string length $mapline] < 1} {
exec /usr/local/bin/qstat $qstatgametype $qstatserverip -xml -of mapchangenotify$server_count.output
# read new map name
set fname "mapchangenotify$server_count.output"
set fp [open $fname "r"]
set blank [gets $fp] ;set blank [gets $fp] ;set blank [gets $fp];set blank [gets $fp];set blank [gets $fp]
set gametypeline [gets $fp]
set mapline [gets $fp]
close $fp
# strip out <map> and <\map>
set newmap [string range $mapline 7 [expr [string length $mapline] - 7]]
# strip out <gametype> and <\gametype>
set gametype [string range $gametypeline 12 [expr [string length $gametypeline] - 12]]
incr recheckbreak
if {$recheckbreak == 10} { set mlbroken 1 ; break }
}
#-----------------------------------------------------------------------------------------------------------------------------------------
incr server_count
if {$newmap != $oldmap && $mlbroken == 0 } {
puthelp "PRIVMSG $qstatircchan :$newmap $qstataddedtext ($gametype)"
}
}
}