This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

tsnstats.tcl help

Support & discussion of released scripts, and announcements of new releases.
Post Reply
b
bts
Voice
Posts: 3
Joined: Mon Apr 21, 2008 2:02 pm

tsnstats.tcl help

Post by bts »

I have this script that i downloaded, but tsn.ca changed their website so the script no longer responds to the commands. Can someone edit or maybe post a working version of the script. thanks

#############################################
# tsnstats.tcl v0.6 by AkiraX #
# <#AnimeFiends@EFNet> #
#############################################

####### DESCRIPTION #########################
# looks up player stats and info for
# professional sports leagues from tsn.ca
#############################################

####### LICENSE #############################
# Copyright (C) 2006 Jeremy Glazman
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#############################################

####### USAGE ###############################
#
# [league] can be: !nhl !nfl !mlb !nba !pga
#
# ![league] <name> ................... personal player info
# ![league]stats [year] <name> ....... player stats and injury/roster status
# ![league]playoffs [year] <name> .... playoff stats
# ![league]history [year] <name> ..... player transactions and awards
# ![league]history <name> "search" ... transactions and awards matching "search"
# ![league]scout <name> .............. scouting report
# ![league]photo <name> .............. player profile photo
#
# <name> can be "firstname lastname" or "lastname, firstname"
#
# [year] is optional, and can be "20XX" or "XX" or "XX-YY"
#
#############################################

####### NOTES ###############################
# Limited results for playoffs in all sports
# (NHL and NBA seem to be the only good ones)
#############################################

package require http

bind pub -|- !nhl tsn:nhl
proc tsn:nhl { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nhl core
}

bind pub -|- !nhlstats tsn:nhlstats
proc tsn:nhlstats { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nhl stats
}

bind pub -|- !nhlplayoffs tsn:nhlplayoffs
proc tsn:nhlplayoffs { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nhl playoffs
}

bind pub -|- !nhlhistory tsn:nhlhistory
proc tsn:nhlhistory { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nhl history
}

bind pub -|- !nhlscout tsn:nhlscout
proc tsn:nhlscout { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nhl scout
}

bind pub -|- !nhlphoto tsn:nhlphoto
proc tsn:nhlphoto { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nhl photo
}

bind pub -|- !nfl tsn:nfl
proc tsn:nfl { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nfl core
}

bind pub -|- !nflstats tsn:nflstats
proc tsn:nflstats { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nfl stats
}

bind pub -|- !nflplayoffs tsn:nflplayoffs
proc tsn:nflplayoffs { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nfl playoffs
}

bind pub -|- !nflhistory tsn:nflhistory
proc tsn:nflhistory { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nfl history
}

bind pub -|- !nflscout tsn:nflscout
proc tsn:nflscout { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nfl scout
}

bind pub -|- !nflphoto tsn:nflphoto
proc tsn:nflphoto { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nfl photo
}

bind pub -|- !mlb tsn:mlb
proc tsn:mlb { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name mlb core
}

bind pub -|- !mlbstats tsn:mlbstats
proc tsn:mlbstats { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name mlb stats
}

bind pub -|- !mlbplayoffs tsn:mlbplayoffs
proc tsn:mlbplayoffs { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name mlb playoffs
}

bind pub -|- !mlbhistory tsn:mlbhistory
proc tsn:mlbhistory { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name mlb history
}

bind pub -|- !mlbscout tsn:mlbscout
proc tsn:mlbscout { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name mlb scout
}

bind pub -|- !mlbphoto tsn:mlbphoto
proc tsn:mlbphoto { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name mlb photo
}

bind pub -|- !nba tsn:nba
proc tsn:nba { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nba core
}

bind pub -|- !nbastats tsn:nbastats
proc tsn:nbastats { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nba stats
}

bind pub -|- !nbaplayoffs tsn:nbaplayoffs
proc tsn:nbaplayoffs { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nba playoffs
}

bind pub -|- !nbahistory tsn:nbahistory
proc tsn:nbahistory { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nba history
}

bind pub -|- !nbascout tsn:nbascout
proc tsn:nbascout { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nba scout
}

bind pub -|- !nbaphoto tsn:nbaphoto
proc tsn:nbaphoto { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name nba photo
}

bind pub -|- !pga tsn:pga
proc tsn:pga { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name pga core
}

bind pub -|- !pgastats tsn:pgastats
proc tsn:pgastats { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name pga stats
}

bind pub -|- !pgaplayoffs tsn:pgaplayoffs
proc tsn:pgaplayoffs { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name pga playoffs
}

bind pub -|- !pgahistory tsn:pgahistory
proc tsn:pgahistory { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name pga history
}

bind pub -|- !pgascout tsn:pgascout
proc tsn:pgascout { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name pga scout
}

bind pub -|- !pgaphoto tsn:pgaphoto
proc tsn:pgaphoto { nick host handle chan text } {
set name [join [lrange [split $text] 0 end]]
tsn:run $chan $name pga photo
}

proc tsn:run { chan name sport type } {
# format the input
set year 0
set namecount 0
set namecheck ""
foreach entry [split $name] {
set entry [string map { {-} {} } $entry]
if { [string is integer -strict $entry] } {
set year [join [lindex [split $name] $namecount]]
} {
set namecheck "$namecheck [join [lindex [split $name] $namecount]]"
}
incr namecount
}
if { $namecheck != "" } {
set name $namecheck
}

if { $name == "" } {
if { ($type == "stats") || ($type == "playoffs") || ($type == "history") } {
if { $year == 0 } {
puthelp "PRIVMSG $chan :You must provide a last name: !$sport$type \[year\] lastname, firstname"
} {
puthelp "PRIVMSG $chan :You must provide a last name: !$sport$type $year lastname, firstname"
}
} {
puthelp "PRIVMSG $chan :You must provide a last name: !$sport$type lastname, firstname"
}
return
}

# format the year
set input(year) $year
set input(yearalt) "$year-"
if { $year == 0 } {
if { ($type == "playoffs") || ($type == "history") } {
set input(year) "2006"
set input(yearalt) "05-06"
}
} {
if { [string first "-" $year] < 0 } {
if { [string length $year] == 4 } {
set input(yearalt) "[string range $year 2 3]"
}
}
}

# format the name
set name [string trim $name]
if { ([regexp {\,} $name]) || ([regexp { } $name]) } {
if { [regexp {\,} $name] } {
set input(lastname) [join [lindex [split $name {,}] 0]]
set input(firstname) [join [lindex [split $name {,}] 1]]
} {
if { [regexp { } $name] } {
set input(firstname) [string totitle [join [lindex [split $name] 0]]]
set input(lastname) [string totitle [join [lrange [split $name] 1 end]]]
}
}
set input(name) "[string totitle [string trim $input(lastname)]], [string totitle [string trim $input(firstname)]]"
} {
set input(name) [string totitle $name]
}

# find the player page
set token [http::config -useragent "Mozilla"]
set input(lookupurl) "http://www.tsn.ca/$sport/teams/players/?letter=[string index $input(name) 0]"
if { $sport == "nfl" } { set input(lookupurl) "http://www.tsn.ca/nfl/player_list.asp?letter=[string index $input(name) 0]" }
if { $sport == "pga" } { set input(lookupurl) "http://www.tsn.ca/golf/player_list.asp?letter=[string index $input(name) 0]" }
set token [http::geturl $input(lookupurl) -timeout 15000]
upvar #0 $token state
if { $state(status) == "timeout" } {
puthelp "PRIVMSG $chan :Sorry, your request timed out."
return
}
set input(html) [split [http::data $token] "\n"]
http::cleanup $token

# find the player url
set input(url) ""
set input(namelist) ""
foreach line $input(html) {
if { [regexp {/players?.bio} $line] } {
if { [string match -nocase *$input(name)* "$line"]} {
# perfect match
if { [regexp {\,} $input(name)] } {
regexp {<a href\=\"(.*?)\"} $line match input(url)
break
}

# collect $name* matches
set first ""
set last ""
if { ($sport == "nfl") || ($sport == "pga") } {
regexp {>(.*?)\,} [string range $line [string last "\"" $line] end] match lastname
} {
regexp {hubname=.*?\">(.*?)\,} $line match lastname
}
regexp {\,(.*?)<} $line match firstname

if { ([string match -nocase $input(name)* "$lastname"]) ||
([string compare -nocase "$input(name)" "$lastname"] == 0) } {
regexp {<a href\=\"(.*?)\"} $line match input(url)
lappend input(namelist) "[string trim $firstname] [string trim $lastname]"
continue
}
}
}
}

if { $input(url) == "" } {
puthelp "PRIVMSG $chan :Couldn't find \002$input(name)\002 in the database."
return
}

if { [llength $input(namelist)] > 1 } {
set output "Found [llength $input(namelist)] matches: [lindex $input(namelist) 0]"
foreach name [lrange $input(namelist) 1 end] {
set output "$output, $name"
}
puthelp "PRIVMSG $chan :$output"
return
}

# grab the player page
set token [http::geturl "http://www.tsn.ca$input(url)" -timeout 15000]
upvar #0 $token state
if { $state(status) == "timeout" } {
puthelp "PRIVMSG $chan :Sorry, your request timed out."
return
}
set input(html) [split [http::data $token] "\n"]
http::cleanup $token

## get player stats
set player(name) ""
set player(team) ""
set player(city) ""
set player(number) ""
set player(position) ""
set player(photo) ""
set player(age) ""
set player(birthday) ""
set player(birthplace) ""
set player(hometown) ""
set player(college) ""
set player(height) ""
set player(weight) ""
set player(hand) ""
set player(handbat) ""
set player(exp) ""
set player(draft) ""
set player(signed) ""
set scout(grab) 0
set scout(assets) ""
set scout(flaws) ""
set scout(potential) ""
set stats(grab) 0
set stats(status) ""
set stats(columns) ""
set stats(data) ""
set stats(next) ""
set history(grab) 0
set history(data) ""
set playoffs(grab) 0
set playoffs(columns) ""
set playoffs(data) ""
set playoffs(next) ""
foreach line $input(html) {
# team
if { [regexp {szone} $line] } {
regexp {szone\=\"...\-(.*?)\"} $line match player(team)
set player(team) [string trim [string totitle $player(team)]]
set player(team) [string map { {_} {} } $player(team)]
continue
}

# city
if { ($player(city) == "") && ([regexp {<td class\=\'pad10\'>} $line]) } {
if { $sport == "mlb" } { regexp {<b>(.*?) } $line match player(city) }
if { $player(city) == "" } { regexp {<b>(.*?)</b>} $line match player(city) }
if { $player(city) == "" } { set player(city) " " }
if { $type == "photo" } { break }
continue
}

# name, number and position
if { [regexp {class\=\'playername\'} $line] } {
regexp {\'playername\'>(.*?)<} $line match player(name)
set player(name) [string trim [string map { { } {} } $player(name)]]

regexp {\'playerposition\'>(.*?)<} $line match numpos
set numpos [string trim [string map { { } {} } $numpos]]
set player(number) [join [lindex [split $numpos] 0]]
set player(position) [join [lindex [split $numpos] 1]]
continue
}

# image
if { $type == "photo" } {
if { [regexp {pics.forecaster.ca} $line] } {
set player(photo) ""
regexp {<img src=\'(.*?)\'} $line match player(photo)
continue
}
}

# player core info
if { $type == "core" } {
if { [regexp {Current Status} $line] } { break }

if { [regexp {<b>DOB:</b>} $line] } { regexp {</b> ?(.*?)</td>} $line match player(birthday); continue }
if { [regexp {<b>Age:</b>} $line] } { regexp {</b> ?(.*?)</td>} $line match player(age); continue }
if { [regexp {<b>Place of Birth:</b>} $line] } { regexp {</b> ?(.*?)</td>} $line match player(birthplace); continue }
if { [regexp {<b>Hometown:</b>} $line] } { regexp {</b> ?(.*?)</td>} $line match player(hometown); continue }
if { [regexp {<b>College:</b>} $line] } { regexp {</b> ?(.*?)</td>} $line match player(college); continue }
if { [regexp {<b>HT:</b>} $line] } {
regexp {HT:</b> ?(.*?) ?<b>} $line match player(height)
regexp {WT:</b> ?(.*?)</td>} $line match player(weight)
continue
}
if { [regexp {<b>Shoots: ?</b>} $line] } {
regexp {</b>(.*?)</td>} $line match player(hand)
if { $player(hand) == "L" } { set player(hand) "left" }
if { $player(hand) == "R" } { set player(hand) "right" }
continue
}
if { [regexp {<b>Bats/Throws: ?</b>} $line] } {
regexp {</b>(.*?)</td>} $line match hand
set player(hand) [join [lindex [split $hand {/}] 1]]
set player(handbat) [join [lindex [split $hand {/}] 0]]
if { $player(hand) == "L" } { set player(hand) "lefty" }
if { $player(hand) == "R" } { set player(hand) "righty" }
if { $player(hand) == "S" } { set player(hand) "switch" }
if { $player(handbat) == "L" } { set player(handbat) "lefty" }
if { $player(handbat) == "R" } { set player(handbat) "righty" }
if { $player(handbat) == "S" } { set player(handbat) "switch" }
continue
}
if { [regexp {<b>... Seasons: ?</b>} $line] } { regexp {</b> ?(.*?)</td>} $line match player(exp); continue }
if { [regexp {Drafted by} $line] } { regexp {\'pad10\'>(.*?)\.?</td>} $line match player(draft); continue }
if { [regexp {Signed by} $line] } { regexp {\'pad10\'>(.*?)\.?</td>} $line match player(signed); continue }
}

# player season stats and history
if { ($type == "stats") || ($type == "playoffs") || ($type == "history") } {
if { [regexp {Current Status\:} $line] } {
regexp {Current Status\: ?(.*?)</td>} $line match stats(status)
set stats(grab) 1
continue
}

if { $stats(grab) > 0 } {
if { [regexp {Playoff Stats} $line] } {
set playoffs(grab) 1
set stats(grab) 2
continue
}
if { $stats(grab) == 1 } {
if { $input(year) == 0 } {
if { [regexp {</tr>} $line] } {
set stats(grab) 3
}
} {
if { [regexp {Career Stats} $line] } {
set stats(grab) 2
} {
if { [regexp {Scouting Report} $line] } {
set history(grab) 1
continue
}

# find transactions, injuries, etc
if { $history(grab) > 0 } {
if { [regexp {row.?\'>} $line] } {

set entry ""
regexp {row.?\'>(.*?)</td>} $line match entry
# event year
if { $history(grab) == 1 } {
if { [tsn:checkyear $input(year) $input(yearalt) $entry] } {
set history(data) "$history(data) $entry"
if { [string index $history(data) end] != ":" } {
set history(data) "$history(data):"
}
set history(grab) 2
continue
}
}
# event description
if { $history(grab) == 2 } {
if { [string index $entry end] != "." } {
set entry "$entry."
}
set history(data) "$history(data) $entry"
set history(grab) 1
}
}
}
}
}
continue
} {
if { [regexp {</tr>} $line] } {
incr stats(grab)
if { $stats(grab) > 4 } {
if { $input(year) == 0 } { break }
if { $stats(grab) == 5 } {
set stats(grab) 6
if { $playoffs(grab) } {
if { [tsn:checkyear $input(year) $input(yearalt) [lindex $playoffs(data) 0]] == 0 } {
set stats(grab) 4
set playoffs(data) ""
}
} {
if { [tsn:checkyear $input(year) $input(yearalt) [lindex $stats(data) 0]] == 0 } {
set stats(grab) 4
set stats(data) ""
}
}
continue
}
if { $stats(grab) > 5 } {
if { $playoffs(grab) } {
if { [llength $playoffs(next)] <= 0 } { break }
if { [tsn:checkyear $input(year) $input(yearalt) [lindex $playoffs(next) 0]] == 0 } { break }
if { [string first "Total" "[lindex $playoffs(next) 1]"] >= 0 } { break }

foreach entry $playoffs(next) {
lappend playoffs(data) "$entry"
}
set stats(grab) 6
set playoffs(next) ""
} {
if { [llength $stats(next)] <= 0 } { set stats(grab) 1; continue }
if { [tsn:checkyear $input(year) $input(yearalt) [lindex $stats(next) 0]] == 0 } { set stats(grab) 1; continue }
if { [string first "Total" "[lindex $stats(next) 1]"] >= 0 } { set stats(grab) 1; continue }

foreach entry $stats(next) {
lappend stats(data) "$entry"
}
set stats(grab) 6
set stats(next) ""
}
}
}
continue
}

if { [regexp {row.?\'>} $line] } {
set entry ""
regexp {row.?\'>(.*?)</td>} $line match entry
if { $entry != "" } {
if { $playoffs(grab) } {
switch $stats(grab) \
3 { lappend playoffs(columns) "$entry" } \
4 { lappend playoffs(data) "$entry" } \
6 { lappend playoffs(next) "$entry" }
} {
switch $stats(grab) \
3 { lappend stats(columns) "$entry" } \
4 { lappend stats(data) "$entry" } \
6 { lappend stats(next) "$entry" }
}
}
continue
}
}
}
}

# player scouting info
if { $type == "scout" } {
if { [regexp {Honours and Awards} $line] } { break }

if { [regexp {<b>Age:</b>} $line] } { regexp {</b> ?(.*?)</td>} $line match player(age) }
if { [regexp {<b>HT:</b>} $line] } {
regexp {HT:</b> ?(.*?) <b>} $line match player(height)
regexp {WT:</b> ?(.*?)</td>} $line match player(weight)
}
if { [regexp {<b>... Seasons: ?</b>} $line] } { regexp {</b> ?(.*?)</td>} $line match player(exp) }

if { [regexp {Assets} $line] } { set scout(grab) 1; continue }
if { [regexp {Flaws} $line] } { set scout(grab) 2; continue }
if { [regexp {Career potential} $line] } { set scout(grab) 3; continue }

if { $scout(grab) == 1 } { regexp {>(.*?)</td>} $line match scout(assets); set scout(grab) 0 }
if { $scout(grab) == 2 } { regexp {>(.*?)</td>} $line match scout(flaws); set scout(grab) 0 }
if { $scout(grab) == 3 } { regexp {>(.*?)</td>} $line match scout(potential); set scout(grab) 0 }
}
}

# create final output
set output ""
if { [string index $player(number) end] != "-" } {
if { (($input(year) == 0) || ($type == "history") || ($type == "photo")) && ($player(city) != "") && ($player(team) != "") } {
set output "$player(city) $player(team) \002$player(number) $player(name)\002"
} {
set output "\002$player(number) $player(name)\002"
}
} {
if { (($input(year) == 0) || ($type == "history") || ($type == "photo")) && ($player(city) != "") && ($player(team) != "") } {
set output "$player(city) $player(team) \002$player(name)\002"
} {
set output "\002$player(name)\002"
}
}

if { $type == "photo" } {
if { $player(photo) == "" } {
puthelp "PRIVMSG $chan :No profile photo found for \002$player(name)\002."
return
}
puthelp "PRIVMSG $chan :$output Profile photo: $player(photo)"
return
}

if { $type == "core" } {
set output "$output \[$player(height) $player(weight)lbs\]"
if { $player(age) != "" } { set output "$output $player(age)yo" }
if { ($player(hand) != "") && ($sport != "mlb") } { set output "$output $player(hand)-handed" }
if { $player(position) != "" } { set output "$output $player(position)" }
if { $player(hometown) != "" } { set output "$output from $player(hometown)" }
set output "$output."
if { ($player(hand) != "") && ($sport == "mlb") } {
set output "$output Throws $player(hand), bats $player(handbat)."
}
if { ($player(birthday) != "") && ($player(birthplace) != "") } {
set output "$output Born $player(birthday) in $player(birthplace)."
}
if { $player(draft) != "" } {
set output "$output $player(draft)"
if { $player(college) != "" } { set output "$output out of $player(college)" }
set output "$output."
}
if { $player(signed) != "" } { set output "$output $player(signed)." }
if { $player(exp) != "" } { set output "$output Has played $player(exp) seasons." }

puthelp "PRIVMSG $chan :[string trim $output]"
return
}

if { $type == "history" } {
if { $history(data) == "" } {
set output "No injuries, transactions or awards found for \002$player(name)\002 in $input(year)."
} {
if { $stats(status) != "" } {
set output "$output \[Status: $stats(status)\]"
}
set output "$output $history(data)"
}
puthelp "PRIVMSG $chan :$output"
return
}

if { ($type == "stats") || ($type == "playoffs") } {
if { $type == "stats" } {
if { ([llength $stats(columns)] <= 0) || ([llength $stats(data)] <= 0) } {
if { $input(year) == 0 } {
set output "No current season stats were found for \002$input(name)\002."
} {
set output "No season $input(year) stats were found for \002$input(name)\002."
}
puthelp "PRIVMSG $chan :$output"
return
}
} {
if { ([llength $playoffs(columns)] <= 0) || ([llength $playoffs(data)] <= 0) } {
set output "No $input(year) playoff stats were found for \002$input(name)\002."
puthelp "PRIVMSG $chan :$output"
return
}
}

if { $input(year) == 0 } {
set output "$output Status($stats(status))"
} {
set output ""
if { [string index $player(number) end] != "-" } {
set output "$player(number) $player(name)"
} {
set output "$player(name)"
}
}

set col 0
set row 0
set outrun 0
while { $outrun != 2 } {
set runtype $type
if { $outrun == 1 } {
set col 0
set row 0
set runtype "playoffs"
}
if { $runtype == "stats" } {
set out(columns) $stats(columns)
set out(data) $stats(data)
set outrun 1
} {
if { ($playoffs(columns) == "") || ($playoffs(data) == "") } {
break
}
set out(columns) $playoffs(columns)
set out(data) $playoffs(data)
set outrun 2
}
foreach entry $stats(data) {
incr col
incr row
if { $input(year) == 0 } {
if { $col == 1 } {
if { ($runtype == "playoffs") } {
set output "$output \[Playoffs [lindex $out(data) 1]\] [lindex $out(data) 0]"
} {
set output "$output \[[lindex $out(data) 1]\] [lindex $out(data) 0]"
}
} {
if { $col < [llength $out(columns)] } {
set output "$output [lindex $out(columns) $col]([lindex $out(data) $row])"
}
}
continue
} {
if { $col == 1 } {
if { $sport == "nfl" } {
set output "$output \002\[[lindex $out(data) [expr { $row-1 }]] [lindex $out(data) $row]\]\002"
incr col
incr row
} {
if { $runtype == "playoffs" } {
set output "$output \002\[Playoffs [lindex $out(data) [expr { $row-1 }]] ([lindex $out(data) [expr { $row+1 }]]) [lindex $out(data) $row]\]\002"
} {
set output "$output \002\[[lindex $out(data) [expr { $row-1 }]] ([lindex $out(data) [expr { $row+1 }]]) [lindex $out(data) $row]\]\002"
}
incr col 2
incr row 2
}
}
if { ($col < [llength $out(columns)]) && ($row < [llength $out(data)]) } {
set output "$output [lindex $out(columns) $col]([lindex $out(data) $row])"
} {
if { $input(year) == 0 } { break }
if { $row >= [expr { [llength $out(data)] }] } { break }
set col 0
}
}
}
}

if { ($type != "playoffs") && ($history(data) != "") } {
set output "$output $history(data)"
}

puthelp "PRIVMSG $chan :[string trim $output]"
return
}

if { $type == "scout" } {
if { ($scout(assets) == "") && ($scout(flaws) == "") && ($scout(potential) == "") } {
puthelp "PRIVMSG $chan :Sorry, no scouting report for \002$player(name)\002 is available."
return
}

set output "$output \[$player(height) $player(weight)lbs"
if { $player(age) != "" } { set output "$output $player(age)yo" }
if { $player(exp) != "" } { set output "$output $player(exp)-seasons" }
set output "$output\] Scouting report:"
if { $scout(potential) != "" } { set output "$output $scout(potential)" }
puthelp "PRIVMSG $chan :$output"

if { $scout(assets) != "" } { puthelp "PRIVMSG $chan :Assets: $scout(assets)" }
if { $scout(flaws) != "" } { puthelp "PRIVMSG $chan :Flaws: $scout(flaws)" }

return
}

puthelp "PRIVMSG $chan :[string trim $output]"
return
}

proc tsn:checkyear { year yearalt input } {
if { ([string compare "$year" "$input"] != 0) &&
([string first "$yearalt" "$input"] < 0) } {
if { [string index $input end] == ":" } {
if { [string length $year] == 2 } {
if { [string compare $year [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }
}
if { [string length $year] == 4 } {
if { [string compare [string range $year 2 3] [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }
}
if { [string length $year] == 5 } {
if { [string compare [string range $year 0 1] [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }
# if { [string compare [string range $year 3 4] [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }
}
if { [string length $year] == 7 } {
if { [string compare [string range $year 2 3] [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }
if { [string compare [string range $year 5 6] [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }
}
if { ([string length $yearalt] == 5) && ([string index $yearalt 2] == "-") } {
if { [string compare [string range $yearalt 0 1] [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }
if { [string compare [string range $yearalt 3 4] [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }
}
} {
if { [string length $input] == 4 } {
if { ([string length $yearalt] == 5) && ([string index $yearalt 2] == "-") } {
if { [string compare [string range $yearalt 0 1] [string range $input [expr { [string length $input]-2 }] end]] == 0 } { return 1 }
if { [string compare [string range $yearalt 3 4] [string range $input [expr { [string length $input]-2 }] end]] == 0 } { return 1 }
}
}
}
return 0
}
return 1
}

putlog "tsnstats.tcl v0.6 by AkiraX <#AnimeFiends@EFnet> loaded!"
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Contact the author (and edit your post using code tags):
AkiraX <#AnimeFiends@EFnet>
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
b
bts
Voice
Posts: 3
Joined: Mon Apr 21, 2008 2:02 pm

Post by bts »

looked on efnet can't find him
Post Reply