###############################
#### gamefaq tcl script v1.00 by Amien ####
################################
# !games <console>
#
# will show upcoming games with retail date
# source is
http://www.gamefaqs.com/
#
# If you find any bug, please bug me at
amien@fusemail.com
# respect to all the people from TCL , PHP and SQL channels on efnet
# for answering all my n00b questions so fast
#
# not the finest lines of tcl but it all works
# feel free to modify, but please send me your scripts or updates
bind pub A !upcoming games
proc games {nick host handle chan arg} {
global system
## parameter settings ##
set arg [string toupper $arg]
if {$arg != "PC" && $arg != "GC" && $arg != "PS2" && $arg != "XBOX" && $arg != "GBA"} {
puthelp "notice $nick :Missing argument, type !games SECTION, available sections are: GBA GC PC PS2 XBOX"
return 0
}
puthelp "privmsg $chan :UPCOMING $arg GAMES"
if {$arg == "PC"} { set urlgames "
http://www.gamefaqs.com/computer/doswin/" }
if {$arg == "GC"} { set urlgames "
http://www.gamefaqs.com/console/gamecube/" }
if {$arg == "PS2"} { set urlgames "
http://www.gamefaqs.com/console/ps2/" }
if {$arg == "XBOX"} { set urlgames "
http://www.gamefaqs.com/console/xbox/" }
if {$arg == "GBA"} { set urlgames "
http://www.gamefaqs.com/portable/gbadvance/" }
## read http page ##
package forget http
package require http 2.3
set conn [::http::geturl $urlgames -timeout 9999]
set data [::http::data $conn]
::http::cleanup $conn
## lets strip! ##
set tosave [string range $data [set f [string first "</th></tr><tr><td valign=\"top\" class=\"date\">" $data]] [string first "<th colspan=\"2\" valign=\"top\" class=\"listhead\">" $data $f]]
regsub -all -- {<br>} $tosave "\n" tosave
regsub -all -- {</b>|</font>} $tosave { } tosave
regsub -all -- {<[^>]*>} $tosave {} tosave
regsub -all -- { |[<*>]} $tosave { } tosave
foreach line [split $tosave "\n"] {
if {$line == {} || $line == { }} { continue }
if {[string is digit [string index $line 0]]} {
set dateline [string map {"/" "-"} [string range $line 0 3]]
set gameline [string range $line 4 end]
} else { set gameline $line }
puthelp "privmsg $chan :($dateline) $gameline."
}
}
putlog "Amiens GAMESFAQS Script (heavily modified by Papillon)"