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 

game-monitor.com Player Search

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
ICE
Voice


Joined: 09 Mar 2008
Posts: 2

PostPosted: Sun Mar 09, 2008 1:24 am    Post subject: game-monitor.com Player Search Reply with quote

Hey guys!

Love the site it helped me a huge amount!

I have found a script that searches servers on game-monitor.com. I was wondering if someone could help me modify it to do a player search, as I'n not so good with this side of things.

For example "!player Bob" and it returns the server and names for all those players with the name bob.

The script is below Smile

Code:


# Settings

# Bind key? Default: !ip
set game(trigger) "!player"

# Get-url timeout. Recommed to keep this as default
set game(timeout) "60000"
   

#########################################################
## Don't edit below unless you know what you're doing. ##
#########################################################

bind pub - $::game(trigger) lookup


proc lookup {nick uhost hand chan arg} {
   global game
   # Check if $arg exists
   if {![regexp -- {^(.+?):(.+?)$} $arg]} { putmsg $chan "Right format is: $::game(trigger) IP"; return }
   # Set formdata
   set formdata [::http::formatQuery search $arg type server]
   # Going to url
   ::http::config -useragent "Mozilla/4.0"
   if {[catch {set tok [::http::geturl http://www.game-monitor.com/search.php?$formdata -timeout $::game(timeout)]} error]} {
      putlog "Error trying connect to url: $error"
      return 1
   }
   if {[::http::ncode $tok] != 200} {
      putlog "Error connecting to url: [::http::code $tok]"
      ::http::cleanup $tok
      return 1
   }
   # Went to url, setting data
   set data [::http::data $tok]
   # Cleaning
   ::http::cleanup $tok
   # Regex time
   foreach "- title players map gamename" [regexp -all -inline -expanded -- {
      <tr\sclass="search_result.+?      # find the part where the info is
      /GameServer/.+?/GameServer/.+?>(.+?)<.+?   # server name
      <tr\sclass="search_result.+?      # jump to the next part
      color=.+?(\d+?/\d+?)[^0-9].+?         # players
      <a\shref="/MapSearch/.+?>(.+?)<.+?   # map name
      title="(.+?)"            # game name
      } $data] {
      lappend matches [list $title $players $map $gamename]
   }
   # Shout the result
   if {![info exists matches]} {
      putmsg $chan "Did not find anything for $arg"
      return 1
   } else {
      foreach match [lrange $matches 0 2] {
         foreach  "title players map gamename" $match {
            putmsg $chan "\002Title\002: [join $title] \002Map\002: [join $map] \002Players\002: [join $players]"
         }
      }
      if {[llength $matches] > 3} {
         putmsg $chan "Found [expr "[llength $matches] - 3"] more match(es) but I'm not gonna show them to you :P"
      }
   }
}

_________________

Australian Strike Soldiers (A$$) clan-ass.com
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Fri Mar 14, 2008 4:37 am    Post subject: Reply with quote

simply change this part of the script
Code:
set formdata [::http::formatQuery search $arg type server]

to look like this
Code:
set formdata [::http::formatQuery search $arg type player]

and remove this line completely or comment it out with #
Code:
   if {![regexp -- {^(.+?):(.+?)$} $arg]} { putmsg $chan "Right format is: $::game(trigger) IP"; return }


that big ol long inline regexp and the foreach giving the output need to be adjusted as well.. this is just some help to get you going in the right direction.
Back to top
View user's profile Send private message
ICE
Voice


Joined: 09 Mar 2008
Posts: 2

PostPosted: Sun Mar 16, 2008 6:47 am    Post subject: Reply with quote

Ah thanks ! Smile
_________________

Australian Strike Soldiers (A$$) clan-ass.com
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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