egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

it just doesn't work...

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
sir
Voice


Joined: 28 Aug 2004
Posts: 21

PostPosted: Mon Oct 04, 2004 7:21 pm    Post subject: it just doesn't work... Reply with quote

ok, I'm not sure why, but it doesnt work.
it loads correctly (log is inserted), but other than that, there is absolutely no response from the bot in public channels.

Code:
# Maximum Number of Results
set maxresults 3

# setting up the way our output looks
set start ""
set end ""
set delim ":"

# Binds!
# bind pub - .find gametiger_query


##
# The following function is used to query the gametiger database in order to
# search for online players or servers, also forwards steamid requests to the steamid function
## set game "cstrike" o "all"

proc gametiger_query { nick host hand chan text } {
   global start end delim maxresults
   set buffer ""
   set sname ""
   set result "results"
   set type ""
   set game "all"
   set results 0
   set valid 1
   set first [expr {[string first " " $text]} + 1]
   set query [string range "$text" $first end]

   switch -glob $text {
      "player *" {
         set type "player"
         set stype "player"
         set iname 2
         set ihost 6
         set iip 12
         set imap 18
         set icurrmax 22
      }

      "server *" {
         set type "server"
         set stype "server"
         set ihost 3
         set iip 9
         set imap 15
         set icurrmax 19
      }

      "map *" {
         set type "map"
         set stype "map"
         set ihost 3
         set iip 9
         set imap 15
         set icurrmax 19
      }

      "steamid*" { steam_query $nick $host $hand $chan $query }

      default {
         set valid 0
         puthelp "NOTICE $nick :Usage: .find <server|map|player> <hostname|mapname|playername>"
      }
   }

   if { $valid == 1 && ![string equal $query ""] } {
      regsub -all " " $query "+" query
      set host "www.gametiger.net"
      set url "/search?$type=$query&game=$game"

      set FD [socket $host 80]

      # setup single line buffering
      fconfigure $FD -buffering line -buffersize 1024

      # yay HTTP/1.1 standards!
      puts $FD "GET $url HTTP/1.1"
      puts $FD "Host: $host"
      puts $FD "Connection: close"
      puts $FD ""

      while { ![eof $FD] && ![string equal $buffer "<!-- cstiger results -->"] } { gets $FD buffer }
      gets $FD buffer
      gets $FD buffer
      while { ![eof $FD] && $results < $maxresults && ![string equal "</table>" $buffer] && ![string match "*no such $type online*" $buffer] } {
         regsub -all ">" $buffer "\t" buffer
         regsub -all "</" $buffer "\t" buffer
         regsub -all "&lt;" $buffer "<" buffer
         regsub -all "&gt;" $buffer ">" buffer
         set line [split $buffer "\t"]
         set hostname [lindex $line $ihost]
         set ip [lindex $line $iip]
         set map [lindex $line $imap]
         set currmax [lindex $line $icurrmax]

         if { [string equal $type "player"] } {
            set name [lindex $line $iname]
            set sname "Name$delim $name"
         }

         set shostname "Hostname$delim $hostname"
         set sip "IP$delim $ip"
         set smap "Map$delim $map"
         set scurrmax "Players$delim $currmax"

         set outtxt "$sname  $shostname  $sip  $smap  $scurrmax"
         putserv "NOTICE $nick :$outtxt"
         incr results
         gets $FD buffer
      }

      if { $results == 1 } {
         set result "result"
      }
         putserv "NOTICE $nick :Search Results: (Found $results (of a maximum $maxresults $sytpe $result)
         putserv "NOTICE $nick :Powered by $host."
      close $FD
   }
}
putlog "game-server-query written/modified by brian -blaze947- kelly"
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber