| View previous topic :: View next topic |
| Author |
Message |
RoboCop Voice
Joined: 04 Aug 2013 Posts: 13
|
Posted: Sat Nov 14, 2015 3:56 pm Post subject: Game.tcl may need a quick fix |
|
|
Hello I've been trying game.tcl for search GameServer IPs but it appears to give me a error saying "Tcl error [lookup]: invalid command name "putmsg" Is this command for older Eggdrop Versions below 1.6.21? Cos it doesn't seem to work well on that. Here is the TCL code script:
| Code: | # Script to get some extra information about the IP-Adress of your Counter-Strike Source server
# Script made by Mookie@Efnet Contact me for more information
# Suggestions are always welcome, post them on the forum on egghelp.org
# Settings
# Bind key? Default: !ip
set game(trigger) "!ip"
# 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 game cstrike2]
# Going to url
catch {set tok [http::geturl http://game-monitor.com/search.php?$formdata -timeout $::game(timeout)]} error
if {[string match -nocase "*couldn't open socket*" $error]} {
putlog "Error trying connect to url."
return
}
# Went to url, setting data
set data [http::data $tok]
# Cleaning
http::cleanup $tok
# Regex time
regexp -- {<b>Total Players/Max</b>(.+?)$} $data -> players
if {![regexp -nocase {<a href="/GameServer/(.+?)">(.+?)</a></div></td></tr>} $data -> url title]} { putmsg $chan "Did not found anything for $arg"; return }
regsub -all {<.*?>| } $title {} title
regexp -- {<td><a href="/MapSearch/cstrike2/.*?/">(.*?)</a>} $data -> map
# Shout the result
putmsg $chan "Title: $title Map: $map Players$players"
} |
Another thing, game-monitor.com is not as popular as gametracker.com. Say if I wanted to convert game-monitor.com URL for gametracker.com what will the code have to be for it to work. Can you help please? I suck on TCL. |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sat Nov 14, 2015 8:08 pm Post subject: |
|
|
putmsg is included in alltools.tcl
alltools.tcl is included with all versions of Eggdrop.
Make sure this line is included near the bottom of your conf file... | Code: | | source scripts/alltools.tcl |
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
RoboCop Voice
Joined: 04 Aug 2013 Posts: 13
|
Posted: Sat Nov 14, 2015 8:50 pm Post subject: |
|
|
| Alright I got alltools.tcl fixed thanks, only problem is that game-monitor.com query not giving me any results nor the bot will relay that IP query. I want to know how to resolve it or maybe use IP Gameserver query on gametracker.com |
|
| Back to top |
|
 |
pizzahut Voice
Joined: 15 Nov 2015 Posts: 1
|
Posted: Sun Nov 15, 2015 9:42 am Post subject: |
|
|
I came up with this, but seems it isn't working still:
[14:47:26] <pizzahut> !ip 87.98.237.191:27015
[14:47:27] <^lycosbot^> Did not found anything for 87.98.237.191:27015
Mind I have neither EggDrop nor TCL, so it was a shot in the dark.
I changed the form data to not only query CS:S servers, but all servers.
| Code: | | set formdata [http::formatQuery search $arg] |
This should create an URL like this:
http://www.game-monitor.com/search.php?search=87.98.237.191:27015
I changed the RegEx to match the current website layout.
Layout:
| Code: | | <a href="/dmc_GameServer/87.98.237.191:27015/HLDS.pl_DMC_1.html">HLDS.pl DMC #1</a></div></td><td class="sp"><span>0 /</span><span>14</span> (4)</td><td>dmc_helix</td><td class="sip"> |
RegEx:
| Code: | regexp -- {<td class="sp"><span>(.+?) /</span>} $data -> players
if {![regexp -nocase {<a href="/.+?GameServer/.+?">(.+?)</a></div></td>} $data -> title]} { putmsg $chan "Did not found anything for $arg"; return }
regsub -all {<.*?>| } $title {} title
regexp -- {<td>(.*?)</td><td class="sip">} $data -> map |
Edited script:
| Code: | # Script to get some extra information about the IP-Adress of your Counter-Strike Source server
# Script made by Mookie@Efnet Contact me for more information
# Suggestions are always welcome, post them on the forum on egghelp.org
# Settings
# Bind key? Default: !ip
set game(trigger) "!ip"
# 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]
# Going to url
catch {set tok [http::geturl http://game-monitor.com/search.php?$formdata -timeout $::game(timeout)]} error
if {[string match -nocase "*couldn't open socket*" $error]} {
putlog "Error trying connect to url."
return
}
# Went to url, setting data
set data [http::data $tok]
# Cleaning
http::cleanup $tok
# Regex time
regexp -- {<td class="sp"><span>(.+?) /</span>} $data -> players
if {![regexp -nocase {<a href="/.+?GameServer/.+?">(.+?)</a></div></td>} $data -> title]} { putmsg $chan "Did not found anything for $arg"; return }
regsub -all {<.*?>| } $title {} title
regexp -- {<td>(.*?)</td><td class="sip">} $data -> map
# Shout the result
putmsg $chan "Title: $title Map: $map Players$players"
} |
I noticed that there should be a "www." in front of the domain, perhaps that's why it won't work. The response is a redirect if the "www." is omitted. |
|
| Back to top |
|
 |
|