This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Qstat + qstat map change notify

Support & discussion of released scripts, and announcements of new releases.
n
nox
Voice
Posts: 8
Joined: Sun Dec 04, 2005 5:48 am

Qstat + qstat map change notify

Post by nox »

Hiegghelp.org community

I use qstat + qstat map change notify to show stats from our q3 server in a irc channel.
qstat is running great, it shows the actual map and the players.
but my problem is the script qstat map change notify.
i leeched it from your page, it's called "qstat-mapchangenotify_v0.1.2"

now to my problem.. a executable called "qstatrun" is missing:
Tcl error [qstatrun]: couldn't execute "/home/nox/eggdrop/scripts": permission denied. .. I have only executables like qstat.



Eggdrop : /home/nox/eggdrop


qstat executables for "qstat4eggdrop" : /home/nox/eggdrop/scripts -> this script is running - it shows the mapname, players etc at a irc channel


mapchangenotify.serverlist : (/home/nox/eggdrop/scripts)
-q3s
192.168.1.69:27666
now running on UT2004 onslaught server 1
#q3a


mapchangenotify.tcl (/home/nox/eggdrop/scripts)
# set your qstatpath
set qstatpath "/home/nox/eggdrop/scripts"

# number of servers to check
set server_number 1

in this tcl the executable "qstatrun" is used : "bind time - * qstatrun ;# runs every minute"


qstat.tcl (/home/nox/eggdrop/scripts)
# Configuration settings:

# Flags needed to use the commands
set qstat_flag "-|-"
set ip "127.0.0.1:27666"


# Path to qstat folder containing qstat stuff/scripts and the qstat program
set pathqstat "/home/nox/eggdrop/scripts"

# Channels you _dont_ want the bot to reply to public triggers on
# (seperate with spaces):
set nopub ""

# End configuration settings




Now - please help me, it's very important for me to get this qstat map change notify running.


if somebody has an idea, you would make me very happy :)
i have no ideo where's the problem, because all ways are right, only this executable is missing



mfg
nox
d
deadite66
Halfop
Posts: 74
Joined: Mon May 30, 2005 2:49 am
Location: Great Yarmouth, UK

Re: Qstat + qstat map change notify

Post by deadite66 »

nox wrote:
mapchangenotify.tcl (/home/nox/eggdrop/scripts)
# set your qstatpath
set qstatpath "/home/nox/eggdrop/scripts"
add the qstat executable name in the path

ie.
set qstatpath "/home/nox/eggdrop/scripts/qstat"
n
nox
Voice
Posts: 8
Joined: Sun Dec 04, 2005 5:48 am

Post by nox »

Hi.
Thanks for answer, that was it.
But now I have a new problem:

Tcl error [qstatrun]: unknown option "-q3"



mapchangenotify.serverlist

-q3s
127.0.0.1:27666
now running on UT2004 onslaught server 1
#q3a


mapchangenotify.tcl

# set your qstatpath
set qstatpath "/home/nox/eggdrop/scripts/qstat"

# number of servers to check
set server_number 1



I dont't understand why der is a problem with "-q3" .. in mapchangenotify.serverlist is only "-q3s".


I think thats the last question i have to ask you ;).

nox
d
deadite66
Halfop
Posts: 74
Joined: Mon May 30, 2005 2:49 am
Location: Great Yarmouth, UK

Re: Qstat + qstat map change notify

Post by deadite66 »

nox wrote: mapchangenotify.serverlist : (/home/nox/eggdrop/scripts)
the mapchangenotify.serverlist should be in /home/nox/eggdrop/

i just tried it with a quake3 server and it worked ok with the -q3s option.

(21:07:01) (moontesting) q3dm6 now running on quake3 server (napalm)
n
nox
Voice
Posts: 8
Joined: Sun Dec 04, 2005 5:48 am

Post by nox »

thanks, it's running now :)
A
AciD
Voice
Posts: 20
Joined: Wed Nov 28, 2007 8:44 pm

Post by AciD »

Hi, i have a problem with, qstat map change notify, qstat4eggdrop. I am using windrop, i have checked the directory, on qstat when i type !cs ip:port everything is ok, but neither qstat map change notify, neither qstat4eggdrop dont work. i get error:

Code: Select all

[02:44] Tcl error [q]: couldn't execute "c:\egg\qstat": no such file or directory
That was qstat4eggdrop

Code: Select all

[02:36] Tcl error [qstatrun]: couldn't execute "C:\OCSL\scripts\qstat": no such file or directory
Thats qstat map change notify. Help me pls :)

My Directory is C:\OCSL\scripts\qstat, ive putted C:\OCSL\scripts\qstat\qstat and get error

Code: Select all

[02:50] Tcl error [q]: couldn't duplicate input handle: bad file number
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

it may not work on windoze because tcl/eggdrop are essentially unix based, which uses / for path names, and \ is to escape chars. Obviously you're finding that C:\whatever\pathname does not work.

You could try setting the path as:

/OCSL/scripts/qstat/qstat

If that does not work, your other option is to run EGGDROP (not windrop) under Cygwin (a unix-like environment that runs under windows)
A
AciD
Voice
Posts: 20
Joined: Wed Nov 28, 2007 8:44 pm

Post by AciD »

Tried that...

Code: Select all

[07:45] Tcl error [pub:qstat]: couldn't execute "c:\OCSL\scripts\qstat": no such file or directory
A
AciD
Voice
Posts: 20
Joined: Wed Nov 28, 2007 8:44 pm

Post by AciD »

It worked, ive restarted the windrop, and got that error..
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

If you are using the windows port of qstat, the command would be qstat.exe, rather than qstat. This basically means you'll have to edit the script, locating the lines that executes the external application to use qstat.exe as commandname rather than qstat.

It would probably look something like this:

Code: Select all

  if {$players == 1} {
    catch { exec $qstat(path)/qstat -timeout 5 $gametype $arg -Ts $qstat(path)/server.qstat -Tp $qstat(path)/players.qstat -P } lines
  } else {
    catch { exec $qstat(path)/qstat -timeout 5 $gametype $arg -Ts $qstat(path)/server.qstat } lines
  }
where the "exec $qstat(path)/qstat" should be changed into "exec $qstat(path)/qstat.exe"
NML_375
A
AciD
Voice
Posts: 20
Joined: Wed Nov 28, 2007 8:44 pm

Post by AciD »

Here is My Code:

Code: Select all

set qstat_flag "-|-"
set pathqstat "c:/egg/qstat"
set nopub ""

bind pub $qstat_flag "!cs"  pub:qstat
bind pub $qstat_flag "!csp"  pub:qstat
bind pub $qstat_flag "!css"  pub:qstat
bind pub $qstat_flag "!cssp"  pub:qstat
bind pub $qstat_flag "!q4"  pub:qstat
bind pub $qstat_flag "!q4p"  pub:qstat

proc pub:qstat {nick host hand chan arg} {
  global lastbind pathqstat nopub
  if {[lsearch -exact $nopub [string tolower $chan]] >= 0} {return 0}
  set arg [lindex $arg 0]
  if {[string length [string trim $arg]] == 0} {
    putquick "NOTICE $nick :1,0Syntax: $lastbind <IP/Host>"
    return 0
  }

  switch [string tolower $lastbind] {
    "!cs"     { set gametype "-a2s";  set players 0 }
    "!csp"     { set gametype "-a2s";  set players 1 }
    default {
      putquick "NOTICE $nick :1,0Unknown Command"
      return 0
    }
  }
  # run the qstat program. 
  if {$players} { 
    set stat [open "|$pathqstat/qstat.exe $gametype $arg -Ts $pathqstat/server.qstat -Tp $pathqstat/players.qstat -P" r] 
  } else { 
    set stat [open "|$pathqstat/qstat.exe $gametype $arg -Ts $pathqstat/server.qstat" r] 
  }

  qstat:results $chan $nick $stat
  close $stat
  return 0
}

proc qstat:results {chan nick pf} { 
   while {[gets $pf line] >= 0} { 
      if {[string match "DOWN*" $line]} { 
         putquick "NOTICE $nick :Connection refused while querying server." 
         break 
      } elseif {[string match "HOSTNOTFOUND*" $line]} { 
         putquick "NOTICE $nick :Host not found." 
         break 
      } elseif {[string match "TIMEOUT*" $line]} { 
         putquick "NOTICE $nick :Timeout while querying server." 
         break 
      } 
      set msg [split $line] 
      set string "" 
      foreach query $msg { 
         if {[string length $string] + [string length $query] < 458} { 
            append string "$query " 
         } else { 
            putquick "NOTICE $nick :$string" 
            set string "" 
         } 
      } 
      if {$string != ""} { 
         putquick "NOTICE $nick :$string" 
      } 
   } 
}
i have edit what you said, and get error:

Code: Select all

[22:56] Tcl error [pub:qstat]: couldn't duplicate input handle: bad file number
Help pls :?
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

A quick Google resulted in this hit:
http://windrop.sourceforge.net/faq.html
NML_375
A
AciD
Voice
Posts: 20
Joined: Wed Nov 28, 2007 8:44 pm

Post by AciD »

Thanks, i needed to update my cygwin, and everything works! :)
A
AciD
Voice
Posts: 20
Joined: Wed Nov 28, 2007 8:44 pm

Post by AciD »

Hi again :D , oki i have a REQ maybe someone can edit my mapchangenotify. I need it to how hostname, ip, map, players. Ive edited and it shows hostname, ip, map. But dont know how to edit to show players. Help pls.

Code: Select all

# set your qstatpath
set qstatpath "C:/egg/qstat/qstat.exe"

# number of servers to check
set server_number 6

set mcn_version "v0.1.1"

###############################################################
# 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 qstatxmlfile [split [read $fp] \n]
close $fp

#-------------------------------------------------------------------------
# using regex to find the right lines, yeah i know 50 lines is over kill.
set qstatxmlgameline 20
set qstatxmlmapline 20
set findrightlines 0
set findrightlinesmax 20
while { $findrightlines != $findrightlinesmax } {
set poon [lindex $qstatxmlfile $findrightlines]
if { [regexp "<map>(.*)</map>" $poon] == 1} {
set qstatxmlmapline $findrightlines
} 
incr findrightlines
}
#-------------------------------------------------------------------------

set mapline [lindex $qstatxmlfile $qstatxmlmapline]

# 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 qstatxmlfile [split [read $fp] \n]
close $fp

#-------------------------------------------------------------------------
# using regex to find the right lines, yeah i know 50 lines is over kill.
set qstatxmlgameline 20
set qstatxmlmapline 20
set findrightlines 0
set findrightlinesmax 20
while { $findrightlines != $findrightlinesmax } {
set poon [lindex $qstatxmlfile $findrightlines]
if { [regexp "<map>(.*)</map>" $poon] == 1} {
set qstatxmlmapline $findrightlines
} 
if { [regexp "<gametype>(.*)</gametype>" $poon] == 1} {
set qstatxmlgameline $findrightlines
} 
incr findrightlines
}
#-------------------------------------------------------------------------

set gametypeline [lindex $qstatxmlfile $qstatxmlgameline]
set mapline [lindex $qstatxmlfile $qstatxmlmapline]

# 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]]


#--------------------------------------------------------------------------
# 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 $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 qstatxmlfile [split [read $fp] \n]
close $fp

#------------------------------------------------------------------------
# using regex to find the right lines, yeah i know 50 lines is over kill.
set qstatxmlgameline 20
set qstatxmlmapline 20
set findrightlines 0
set findrightlinesmax 20
while { $findrightlines != $findrightlinesmax } {
set poon [lindex $qstatxmlfile $findrightlines]
if { [regexp "<map>(.*)</map>" $poon] == 1} {
set qstatxmlmapline $findrightlines
} 
if { [regexp "<gametype>(.*)</gametype>" $poon] == 1} {
set qstatxmlgameline $findrightlines
} 
incr findrightlines
}
#------------------------------------------------------------------------

set gametypeline [lindex $qstatxmlfile $qstatxmlgameline]
set mapline [lindex $qstatxmlfile $qstatxmlmapline]

# 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 == 2} { set mlbroken 1 ; break }
}
#-----------------------------------------------------------------------------------------------------------------------------------------

incr server_count

if {$newmap != $oldmap && $mlbroken == 0 }  {
     puthelp "PRIVMSG $qstatircchan :$qstataddedtext $newmap "
   }
}
}
A
AciD
Voice
Posts: 20
Joined: Wed Nov 28, 2007 8:44 pm

Post by AciD »

WTF? ive updated, everything worked.

Code: Select all

<pSy> .stat
<SpawN> [01:59] #pSy# status
<SpawN> I am SpawN, running eggdrop v1.6.17: 2 users (mem: 81k).
<SpawN> Online for 01:09 (background) - CPU: 00:01 - Cache hit: 41.8%
<SpawN> Config file: eggdrop.conf
<SpawN> OS: CYGWIN_NT-5.1 1.5.24(0.156/4/2)
<SpawN> Tcl library: C:/egg/lib/tcl8.4
<SpawN> Tcl version: 8.4.7 (header version 8.4.7)
<SpawN> Loaded module information:
<SpawN>     Channels: #grigai, #mercenaries
<SpawN>     Online as: SpawN!~eggdrop@aitvaras-F831351B.vln.skynet.lt (SpawN)
<SpawN>     Server irc.ktu.lt:6667 (connected for 00:59)
<SpawN>     #grigai             :  14 members, enforcing "+tn-klips" (greet)
<SpawN>     #mercenaries        :   4 members, enforcing "+tn" (greet)
<SpawN> [02:00] @#grigai (+mRtrn) : [m/14 o/4 h/1 v/7 n/2 b/0 e/0 I/0]
<SpawN> [02:00] Writing user file...
<SpawN> [02:00] Writing channel file...
<SpawN> [02:05] @#grigai (+mRtrn) : [m/14 o/4 h/1 v/7 n/2 b/0 e/0 I/0]
<SpawN> [02:09] #Grigai: mode change '+e sda!*@*' by AciD`oFF!~AciD@9A68A77C.1A839F6.F7CCB473.IP
<SpawN> [02:10] @#grigai (+mRtrn) : [m/14 o/4 h/1 v/7 n/2 b/0 e/1 I/0]
<pSy> .rehash
<SpawN> [02:14] #pSy# rehash
<SpawN> Rehashing.
<SpawN> [02:14] Writing user file...
<SpawN> [02:14] Writing channel file...
<SpawN> [02:14] Rehashing ...
<SpawN> [02:14] Listening at telnet port 3333 (all).
<SpawN> [02:14] Userinfo TCL v1.07 loaded (URL BF GF IRL EMAIL DOB PHONE ICQ).
<SpawN> [02:14] use '.help userinfo' for commands.
<SpawN> [02:14] Auto Identify
<SpawN> [02:14] MSG TCL 0.5 Loaded
<SpawN> [02:14] tv scripts form http://www.shellai.lt loaded
<SpawN> [02:14] AMXBans By AciD successfully loaded!
<SpawN> [02:14] egglib_pub.tcl v1.53 by Shrike <shrike@eggdrop.org.ru>, mrBuG <mrbug@eggdrop.org.ru> loaded
<SpawN> [02:14]  - incith:google-1.8.6a loaded.
<SpawN> [02:14] mapchangenotify v0.1.1 loaded
<SpawN> [02:14] ERROR reading stats file
<SpawN> [02:14] Stats.mod v1.4.0 dev20 loaded.
<SpawN> [02:14] Module loaded: stats           
<SpawN> [02:14] Tcl error in file 'eggdrop.conf':
<SpawN> [02:14] invalid command name "loadslang"
<SpawN>     while executing
<SpawN> "loadslang language/stats.lang"
<SpawN>     (file "stats.conf" line 65)
<SpawN>     invoked from within
<SpawN> "source stats.conf"
<SpawN>     (file "eggdrop.conf" line 70)
<SpawN> [02:14] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
-
DCC session closed
-
Then ive loaded source stats.conf my windrop crashed. Ive loaded him again and:

Code: Select all

Chat with SpawN
Waiting for acknowledgement...
DCC Chat connection established
-
<SpawN> Enter your password.
<pSy> blacklist
<SpawN> Connected to SpawN, running eggdrop v1.6.17
<SpawN>      ____                __
<SpawN>     / __/___ _ ___ _ ___/ /____ ___   ___
<SpawN>    / _/ / _ `// _ `// _  // __// _ \ / _ \
<SpawN>   /___/ \_, / \_, / \_,_//_/   \___// .__/
<SpawN>        /___/ /___/                 /_/
<SpawN>  
<SpawN> Hey pSy!  My name is SpawN and I am running eggdrop v1.6.17, on CYGWIN_NT-5.1 1.5.24(0.156/4/2).
<SpawN>  
<SpawN> Local time is now 02:15
<SpawN> You are an owner of this bot. Only +n users can see this! For more info,
<SpawN> see .help set motd. Please edit the motd file in your bot's 'text'
<SpawN> directory.
<SpawN> Use .help for basic help.
<SpawN> Use .help <command> for help on a specific command.
<SpawN> Use .help all to get a full command list.
<SpawN> Use .help *somestring* to list any help texts containing "somestring".
<SpawN>  
<SpawN> Have fun.
<SpawN>  
<SpawN> Commands start with '.' (like '.quit' or '.help')
<SpawN> Everything else goes out to the party line.
<SpawN> You have no messages.
<SpawN> *** pSy joined the party line.
<SpawN> [02:15] New user peak in #mercenaries: 1.
<SpawN> [02:16] Tcl error [qstatrun]: couldn't duplicate input handle: bad file number
<SpawN> [02:16] <<pSy>> !pSy! top 
<SpawN> [02:16] WARNING! No language selected! (getslang())
<SpawN> [02:16] Tcl error [pub:qstat]: couldn't duplicate input handle: bad file number
And Everyting I Load him now i get:

Code: Select all

Chat with SpawN
Waiting for acknowledgement...
DCC Chat connection established
-
<SpawN> Enter your password.
<pSy> blacklist
<SpawN> Connected to SpawN, running eggdrop v1.6.17
<SpawN>      ____                __
<SpawN>     / __/___ _ ___ _ ___/ /____ ___   ___
<SpawN>    / _/ / _ `// _ `// _  // __// _ \ / _ \
<SpawN>   /___/ \_, / \_, / \_,_//_/   \___// .__/
<SpawN>        /___/ /___/                 /_/
<SpawN>  
<SpawN> Hey pSy!  My name is SpawN and I am running eggdrop v1.6.17, on CYGWIN_NT-5.1 1.5.18(0.132/4/2).
<SpawN>  
<SpawN> Local time is now 02:39
<SpawN> You are an owner of this bot. Only +n users can see this! For more info,
<SpawN> see .help set motd. Please edit the motd file in your bot's 'text'
<SpawN> directory.
<SpawN> Use .help for basic help.
<SpawN> Use .help <command> for help on a specific command.
<SpawN> Use .help all to get a full command list.
<SpawN> Use .help *somestring* to list any help texts containing "somestring".
<SpawN>  
<SpawN> Have fun.
<SpawN>  
<SpawN> Commands start with '.' (like '.quit' or '.help')
<SpawN> Everything else goes out to the party line.
<SpawN> You have no messages.
<SpawN> *** pSy joined the party line.
<SpawN> [02:39] #Grigai: mode change '+o SpawN' by pSy!~pSy@aitvaras-F831351B.vln.skynet.lt
<SpawN> [02:39] #Grigai: mode change '-o SpawN' by savas!ubaldas@aitvaras.eu
<SpawN> [02:39] #Grigai: mode change '+o SpawN' by pSy!~pSy@aitvaras-F831351B.vln.skynet.lt
<SpawN> [02:40] #Grigai: mode change '-o SpawN' by savas!ubaldas@aitvaras.eu
<SpawN> [02:40] Tcl error [qstatrun]: couldn't create error file for command: no such file or directory
<SpawN> [02:40] #grigai (+mRtrn) : [m/14 o/2 h/1 v/7 n/4 b/0 e/1 I/0]
<SpawN> [02:40] #Grigai: mode change '+o SpawN' by pSy!~pSy@aitvaras-F831351B.vln.skynet.lt
<SpawN> [02:40] Tcl error [pub:qstat]: couldn't create error file for command: no such file or directory
<SpawN> [02:41] Tcl error [qstatrun]: couldn't create error file for command: no such file or directory
i get or:

Code: Select all

Tcl error [qstatrun]: couldn't create error file for command: no such file or directory
or:

Code: Select all

Tcl error [qstatrun]: couldn't duplicate input handle: bad file number
WTF?
Post Reply