This is a code that I was asked to make by Radien on GeekShed.. I've not really done TCL that much but gave it a go.
Copy and paste the code into something like "xbl.tcl", Then go to your eggdrop bot's config file and add near the bottom: source scripts/xbl.tcl
After you have done that.. Rehash your bot..
After the rehash, You need to log into your bot via Telnet and do .chanset #yourchannelname +xblinfo
Your channel would then be setup to work with the script.
General output.
[01:38] Xbox Live status for StealthyPeer: Last seen 1 hour ago playing Xbox Dashboard
I would like to thank FordLawnmower in help with some of the tcl problems that I was having.. He has been a great help.
[b]UPDATE:[\b] I have now added another command where you can now get the desired Gamerscore for the user.. The command is .xblgs GamerTag
NOTE: When posting this script into SSH, Please make sure you have your PuTTY or SSH window Maximized, Otherwise the client will wordwrap the script, Thus not making it work correctly.. Either that or use an FTP client to load the script.
UPDATE: I have updated the code slightly to add an error message into it if the desired gamertag wasn't found on xbox live.. Thank you to Ford for helping me figure it out.. :) He's a great help!! :D
#####################################################
## Xbox Live GamerTag Status' by Danneh/GrimReaper ##
#####################################################
## Initial Setup ##
#####################################################
set xblchar "."
#####################################################
## End Setup ##
#####################################################
proc xblinfo {nick host hand chan search} {
if {[lsearch -exact [channel info $chan] +xblinfo] != -1} {
set xbllogo "\0039X\00314box Live\003"
set xblsite "Live.xbox.com"
set xblstatusfound "0"
if {$search == ""} {
putserv "PRIVMSG $chan :$xbllogo, Please enter a GamerTag to search for.."
} else {
set xblsrcurl1 [urlencode [regsub -all { } $search +]]
set xblsrcurl2 [encurl $search]
set xblsrcurl3 "/en-GB/Profile?gamertag=${xblsrcurl2}"
if {[catch {set xblsrcsock [socket -async $xblsite 80]} sockerr]} {
return 0
} else {
puts $xblsrcsock "GET $xblsrcurl3 HTTP/1.0"
puts $xblsrcsock "Host: $xblsite"
puts $xblsrcsock "User-Agent: Opera 9.6"
puts $xblsrcsock ""
flush $xblsrcsock
while {![eof $xblsrcsock]} {
set xblstatus "[gets $xblsrcsock]"
if {$xblstatusfound == "on"} {
putserv "PRIVMSG $chan :$xbllogo status for \0037$search\003: [xblstrip [string trimleft [recode "${xblstatus}"]]]"
close $xblsrcsock
return 0
}
if {[regexp -all {<div class="custom">} $xblstatus]} {
set xblstatusfound "on"
}
}
putserv "PRIVMSG $chan :Sorry, I couldn't find \0037$search\003 on $xbllogo"
close $xblsrcsock
return 0
}
}
}
}
proc xblgsinfo {nick host hand chan search} {
if {[lsearch -exact [channel info $chan] +xblinfo] != -1} {
set xbllogo "\0039X\00314box Live\003"
set xblsite "Live.xbox.com"
if {$search == ""} {
putserv "PRIVMSG $chan :$xbllogo, Please enter a GamerTag to search GamerScore for.."
} else {
set xblsrcurl1 [urlencode [regsub -all { } $search +]]
set xblsrcurl2 [encurl $search]
set xblsrcurl3 "/en-GB/Profile?gamertag=${xblsrcurl2}"
if {[catch {set xblsrcsock [socket -async $xblsite 80]} sockerr]} {
return 0
} else {
puts $xblsrcsock "GET $xblsrcurl3 HTTP/1.0"
puts $xblsrcsock "Host: $xblsite"
puts $xblsrcsock "User-Agent: Opera 9.6"
puts $xblsrcsock ""
flush $xblsrcsock
while {![eof $xblsrcsock]} {
set xblstatus "[gets $xblsrcsock]"
if {[regexp -all {<div class="gamerscore">(.*?)</div>} $xblstatus match xblgamerscore]} {
putserv "PRIVMSG $chan :$xbllogo GamerScore for \0037$search\003: $xblgamerscore"
close $xblsrcsock
return 0
}
}
putserv "PRIVMSG $chan :Sorry, I couldn't find \0037$search\003 on $xbllogo"
close $xblsrcsock
return 0
}
}
}
}
proc encurl {string} {
return [string map {" " %20} "$string"]
}
proc xblstrip {string} {
return [regsub -all {<[^<>]+>} $string ""]
}
proc urlencode {string} {
return [subst [regsub -nocase -all {([^a-z0-9+])} $string {%[format %x [scan "\\&" %c]]}]]
}
proc recode { textin } {
return [string map {" \" · · & &} [subst [regsub -nocase -all {&#([0-9]{1,5});} $textin {\u\1}]]]
}
bind pub - ${xblchar}xbl xblinfo
bind pub - ${xblchar}xblgs xblgsinfo
setudef flag xblinfo
putlog "Xbox Live Gamertag status' by Danneh/GrimReaper"
http://www.xboxgamertag.com/ seems to be a non-SSL solution...just my TCL is non-existent so unsure how to edit the script...
@iDLE When you loaded the script into your eggdrop how did you do it? Because if you pasted it in PuTTY without it being maximized then it would word wrap the code meaning there will be misplaced information. I would suggest using some sort of FTP program and pasting the code that way, Or maximizing PuTTY before pasting it.
@xbox_gamer1, Where you see this:
#####################################################
Initial Setup
#####################################################
set xblchar "."
#####################################################
#####################################################
Change the character in the quotes to a ! from a . Then it should work as !xbl.