<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/15667" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2008-04-21T21:02:28-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/15667</id>

		<entry>
		<author><name><![CDATA[bts]]></name></author>
		<updated>2008-04-21T21:02:28-04:00</updated>

		<published>2008-04-21T21:02:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82475#p82475</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82475#p82475"/>
		<title type="html"><![CDATA[tsnstats.tcl help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82475#p82475"><![CDATA[
looked on efnet can't find him<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9883">bts</a> — Mon Apr 21, 2008 9:02 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Alchera]]></name></author>
		<updated>2008-04-21T20:32:10-04:00</updated>

		<published>2008-04-21T20:32:10-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82473#p82473</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82473#p82473"/>
		<title type="html"><![CDATA[tsnstats.tcl help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82473#p82473"><![CDATA[
Contact the author (and <strong class="text-strong">edit your post using code tags</strong>):<blockquote class="uncited"><div>AkiraX &lt;#AnimeFiends@EFnet&gt;</div></blockquote><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3646">Alchera</a> — Mon Apr 21, 2008 8:32 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[bts]]></name></author>
		<updated>2008-04-21T14:05:50-04:00</updated>

		<published>2008-04-21T14:05:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=82465#p82465</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=82465#p82465"/>
		<title type="html"><![CDATA[tsnstats.tcl help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=82465#p82465"><![CDATA[
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<br><br>#############################################<br>#  tsnstats.tcl v0.6       by AkiraX        #<br>#                    &lt;#AnimeFiends@EFNet&gt;   #<br>#############################################<br><br>####### DESCRIPTION #########################<br># looks up player stats and info for<br># professional sports leagues from tsn.ca<br>#############################################<br><br>####### LICENSE #############################<br># Copyright (C) 2006 Jeremy Glazman   <br>#<br># This program is free software: you can redistribute it and/or modify<br># it under the terms of the GNU General Public License as published by<br># the Free Software Foundation, either version 3 of the License, or<br># (at your option) any later version.<br>#<br># This program is distributed in the hope that it will be useful,<br># but WITHOUT ANY WARRANTY; without even the implied warranty of<br># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br># GNU General Public License for more details.<br>#<br># You should have received a copy of the GNU General Public License<br># along with this program.  If not, see &lt;<a href="http://www.gnu.org/licenses/" class="postlink">http://www.gnu.org/licenses/</a>&gt;.<br>#############################################<br><br>####### USAGE ###############################<br>#<br># [league] can be: !nhl !nfl !mlb !nba !pga<br>#<br># ![league] &lt;name&gt; ................... personal player info<br># ![league]stats [year] &lt;name&gt; ....... player stats and injury/roster status<br># ![league]playoffs [year] &lt;name&gt; .... playoff stats<br># ![league]history [year] &lt;name&gt; ..... player transactions and awards<br># ![league]history &lt;name&gt; "search" ... transactions and awards matching "search"<br># ![league]scout &lt;name&gt; .............. scouting report<br># ![league]photo &lt;name&gt; .............. player profile photo<br>#<br># &lt;name&gt; can be "firstname lastname" or "lastname, firstname"<br>#<br># [year] is optional, and can be "20XX" or "XX" or "XX-YY"<br>#<br>#############################################<br><br>####### NOTES ###############################<br># Limited results for playoffs in all sports<br># (NHL and NBA seem to be the only good ones)<br>#############################################<br><br>package require http<br><br>bind pub -|- !nhl tsn:nhl<br>proc tsn:nhl { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name nhl core<br>}<br><br>bind pub -|- !nhlstats tsn:nhlstats<br>proc tsn:nhlstats { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name nhl stats<br>}<br><br>bind pub -|- !nhlplayoffs tsn:nhlplayoffs<br>proc tsn:nhlplayoffs { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name nhl playoffs<br>}<br><br>bind pub -|- !nhlhistory tsn:nhlhistory<br>proc tsn:nhlhistory { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name nhl history<br>}<br><br>bind pub -|- !nhlscout tsn:nhlscout<br>proc tsn:nhlscout { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name nhl scout<br>}<br><br>bind pub -|- !nhlphoto tsn:nhlphoto<br>proc tsn:nhlphoto { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name nhl photo<br>}<br><br>bind pub -|- !nfl tsn:nfl<br>proc tsn:nfl { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name nfl core<br>}<br><br>bind pub -|- !nflstats tsn:nflstats<br>proc tsn:nflstats { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name nfl stats<br>}<br><br>bind pub -|- !nflplayoffs tsn:nflplayoffs<br>proc tsn:nflplayoffs { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name nfl playoffs<br>}<br><br>bind pub -|- !nflhistory tsn:nflhistory<br>proc tsn:nflhistory { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name nfl history<br>}<br><br>bind pub -|- !nflscout tsn:nflscout<br>proc tsn:nflscout { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name nfl scout<br>}<br><br>bind pub -|- !nflphoto tsn:nflphoto<br>proc tsn:nflphoto { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name nfl photo<br>}<br><br>bind pub -|- !mlb tsn:mlb<br>proc tsn:mlb { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name mlb core<br>}<br><br>bind pub -|- !mlbstats tsn:mlbstats<br>proc tsn:mlbstats { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name mlb stats<br>}<br><br>bind pub -|- !mlbplayoffs tsn:mlbplayoffs<br>proc tsn:mlbplayoffs { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name mlb playoffs<br>}<br><br>bind pub -|- !mlbhistory tsn:mlbhistory<br>proc tsn:mlbhistory { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name mlb history<br>}<br><br>bind pub -|- !mlbscout tsn:mlbscout<br>proc tsn:mlbscout { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name mlb scout<br>}<br><br>bind pub -|- !mlbphoto tsn:mlbphoto<br>proc tsn:mlbphoto { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name mlb photo<br>}<br><br>bind pub -|- !nba tsn:nba<br>proc tsn:nba { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name nba core<br>}<br><br>bind pub -|- !nbastats tsn:nbastats<br>proc tsn:nbastats { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name nba stats<br>}<br><br>bind pub -|- !nbaplayoffs tsn:nbaplayoffs<br>proc tsn:nbaplayoffs { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name nba playoffs<br>}<br><br>bind pub -|- !nbahistory tsn:nbahistory<br>proc tsn:nbahistory { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name nba history<br>}<br><br>bind pub -|- !nbascout tsn:nbascout<br>proc tsn:nbascout { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name nba scout<br>}<br><br>bind pub -|- !nbaphoto tsn:nbaphoto<br>proc tsn:nbaphoto { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name nba photo<br>}<br><br>bind pub -|- !pga tsn:pga<br>proc tsn:pga { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name pga core<br>}<br><br>bind pub -|- !pgastats tsn:pgastats<br>proc tsn:pgastats { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name pga stats<br>}<br><br>bind pub -|- !pgaplayoffs tsn:pgaplayoffs<br>proc tsn:pgaplayoffs { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name pga playoffs<br>}<br><br>bind pub -|- !pgahistory tsn:pgahistory<br>proc tsn:pgahistory { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name pga history<br>}<br><br>bind pub -|- !pgascout tsn:pgascout<br>proc tsn:pgascout { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name pga scout<br>}<br><br>bind pub -|- !pgaphoto tsn:pgaphoto<br>proc tsn:pgaphoto { nick host handle chan text } {<br>set name [join [lrange [split $text] 0 end]]<br>tsn:run $chan $name pga photo<br>}<br><br>proc tsn:run { chan name sport type } {<br># format the input<br>set year 0<br>set namecount 0<br>set namecheck ""<br>foreach entry [split $name] {<br>set entry [string map { {-} {} } $entry]<br>if { [string is integer -strict $entry] } {<br>set year [join [lindex [split $name] $namecount]]<br>} {<br>set namecheck "$namecheck [join [lindex [split $name] $namecount]]"<br>}<br>incr namecount<br>}<br>if { $namecheck != "" } {<br>set name $namecheck<br>}<br><br>if { $name == "" } {<br>if { ($type == "stats") || ($type == "playoffs") || ($type == "history") } {<br>if { $year == 0 } {<br>puthelp "PRIVMSG $chan :You must provide a last name: !$sport$type \[year\] lastname, firstname"<br>} {<br>puthelp "PRIVMSG $chan :You must provide a last name: !$sport$type $year lastname, firstname"<br>}<br>} {<br>puthelp "PRIVMSG $chan :You must provide a last name: !$sport$type lastname, firstname"<br>}<br>return<br>}<br><br># format the year<br>set input(year) $year<br>set input(yearalt) "$year-"<br>if { $year == 0 } {<br>if { ($type == "playoffs") || ($type == "history") } {<br>set input(year) "2006"<br>set input(yearalt) "05-06"<br>}<br>} {<br>if { [string first "-" $year] &lt; 0 } {<br>if { [string length $year] == 4 } {<br>set input(yearalt) "[string range $year 2 3]"<br>}<br>}<br>}<br><br># format the name<br>set name [string trim $name]<br>if { ([regexp {\,} $name]) || ([regexp { } $name]) } {<br>if { [regexp {\,} $name] } {<br>set input(lastname) [join [lindex [split $name {,}] 0]]<br>set input(firstname) [join [lindex [split $name {,}] 1]]<br>} {<br>if { [regexp { } $name] } {<br>set input(firstname) [string totitle [join [lindex [split $name] 0]]]<br>set input(lastname) [string totitle [join [lrange [split $name] 1 end]]]<br>}<br>}<br>set input(name) "[string totitle [string trim $input(lastname)]], [string totitle [string trim $input(firstname)]]"<br>} {<br>set input(name) [string totitle $name]<br>}<br><br># find the player page<br>set token [http::config -useragent "Mozilla"]<br>set input(lookupurl) "<a href="http://www.tsn.ca/$sport/teams/players/?letter=" class="postlink">http://www.tsn.ca/$sport/teams/players/?letter=</a>[string index $input(name) 0]"<br>if { $sport == "nfl" } { set input(lookupurl) "<a href="http://www.tsn.ca/nfl/player_list.asp?letter=" class="postlink">http://www.tsn.ca/nfl/player_list.asp?letter=</a>[string index $input(name) 0]" }<br>if { $sport == "pga" } { set input(lookupurl) "<a href="http://www.tsn.ca/golf/player_list.asp?letter=" class="postlink">http://www.tsn.ca/golf/player_list.asp?letter=</a>[string index $input(name) 0]" }<br>set token [http::geturl $input(lookupurl) -timeout 15000]<br>upvar #0 $token state<br>if { $state(status) == "timeout" } {<br>puthelp "PRIVMSG $chan :Sorry, your request timed out."<br>return<br>}<br>set input(html) [split [http::data $token] "\n"]<br>http::cleanup $token<br><br># find the player url<br>set input(url) ""<br>set input(namelist) ""<br>foreach line $input(html) {<br>if { [regexp {/players?.bio} $line] } {<br>if { [string match -nocase *$input(name)* "$line"]} {<br># perfect match<br>if { [regexp {\,} $input(name)] } {<br>regexp {&lt;a href\=\"(.*?)\"} $line match input(url)<br>break<br>}<br><br># collect $name* matches<br>set first ""<br>set last ""<br>if { ($sport == "nfl") || ($sport == "pga") } {<br>regexp {&gt;(.*?)\,} [string range $line [string last "\"" $line] end] match lastname<br>} {<br>regexp {hubname=.*?\"&gt;(.*?)\,} $line match lastname<br>}<br>regexp {\,(.*?)&lt;} $line match firstname<br><br>if { ([string match -nocase $input(name)* "$lastname"]) ||<br> ([string compare -nocase "$input(name)" "$lastname"] == 0) } {<br>regexp {&lt;a href\=\"(.*?)\"} $line match input(url)<br>lappend input(namelist) "[string trim $firstname] [string trim $lastname]"<br>continue<br>}<br>}<br>}<br>}<br><br>if { $input(url) == "" } {<br>puthelp "PRIVMSG $chan :Couldn't find \002$input(name)\002 in the database."<br>return<br>}<br><br>if { [llength $input(namelist)] &gt; 1 } {<br>set output "Found [llength $input(namelist)] matches: [lindex $input(namelist) 0]"<br>foreach name [lrange $input(namelist) 1 end] {<br>set output "$output, $name"<br>}<br>puthelp "PRIVMSG $chan :$output"<br>return<br>}<br><br># grab the player page<br>set token [http::geturl "http://www.tsn.ca$input(url)" -timeout 15000]<br>upvar #0 $token state<br>if { $state(status) == "timeout" } {<br>puthelp "PRIVMSG $chan :Sorry, your request timed out."<br>return<br>}<br>set input(html) [split [http::data $token] "\n"]<br>http::cleanup $token<br><br>## get player stats<br>set player(name) ""<br>set player(team) ""<br>set player(city) ""<br>set player(number) ""<br>set player(position) ""<br>set player(photo) ""<br>set player(age) ""<br>set player(birthday) ""<br>set player(birthplace) ""<br>set player(hometown) ""<br>set player(college) ""<br>set player(height) ""<br>set player(weight) ""<br>set player(hand) ""<br>set player(handbat) ""<br>set player(exp) ""<br>set player(draft) ""<br>set player(signed) ""<br>set scout(grab) 0<br>set scout(assets) ""<br>set scout(flaws) ""<br>set scout(potential) ""<br>set stats(grab) 0<br>set stats(status) ""<br>set stats(columns) ""<br>set stats(data) ""<br>set stats(next) ""<br>set history(grab) 0<br>set history(data) ""<br>set playoffs(grab) 0<br>set playoffs(columns) ""<br>set playoffs(data) ""<br>set playoffs(next) ""<br>foreach line $input(html) {<br># team<br>if { [regexp {szone} $line] } {<br>regexp {szone\=\"...\-(.*?)\"} $line match player(team)<br>set player(team) [string trim [string totitle $player(team)]]<br>set player(team) [string map { {_} {} } $player(team)]<br>continue<br>}<br><br># city<br>if { ($player(city) == "") &amp;&amp; ([regexp {&lt;td class\=\'pad10\'&gt;} $line]) } {<br>if { $sport == "mlb" } { regexp {&lt;b&gt;(.*?) } $line match player(city) }<br>if { $player(city) == "" } { regexp {&lt;b&gt;(.*?)&lt;/b&gt;} $line match player(city) }<br>if { $player(city) == "" } { set player(city) " " }<br>if { $type == "photo" } { break }<br>continue<br>}<br><br># name, number and position<br>if { [regexp {class\=\'playername\'} $line] } {<br>regexp {\'playername\'&gt;(.*?)&lt;} $line match player(name)<br>set player(name) [string trim [string map { { } {} } $player(name)]]<br><br>regexp {\'playerposition\'&gt;(.*?)&lt;} $line match numpos<br>set numpos [string trim [string map { { } {} } $numpos]]<br>set player(number) [join [lindex [split $numpos] 0]]<br>set player(position) [join [lindex [split $numpos] 1]]<br>continue<br>}<br><br># image<br>if { $type == "photo" } {<br>if { [regexp {pics.forecaster.ca} $line] } {<br>set player(photo) ""<br>regexp {&lt;img src=\'(.*?)\'} $line match player(photo)<br>continue<br>}<br>}<br><br># player core info<br>if { $type == "core" } {<br>if { [regexp {Current Status} $line] } { break }<br><br>if { [regexp {&lt;b&gt;DOB:&lt;/b&gt;} $line] } { regexp {&lt;/b&gt; ?(.*?)&lt;/td&gt;} $line match player(birthday); continue }<br>if { [regexp {&lt;b&gt;Age:&lt;/b&gt;} $line] } { regexp {&lt;/b&gt; ?(.*?)&lt;/td&gt;} $line match player(age); continue }<br>if { [regexp {&lt;b&gt;Place of Birth:&lt;/b&gt;} $line] } { regexp {&lt;/b&gt; ?(.*?)&lt;/td&gt;} $line match player(birthplace); continue }<br>if { [regexp {&lt;b&gt;Hometown:&lt;/b&gt;} $line] } { regexp {&lt;/b&gt; ?(.*?)&lt;/td&gt;} $line match player(hometown); continue }<br>if { [regexp {&lt;b&gt;College:&lt;/b&gt;} $line] } { regexp {&lt;/b&gt; ?(.*?)&lt;/td&gt;} $line match player(college); continue }<br>if { [regexp {&lt;b&gt;HT:&lt;/b&gt;} $line] } {<br>regexp {HT:&lt;/b&gt; ?(.*?) ?&lt;b&gt;} $line match player(height)<br>regexp {WT:&lt;/b&gt; ?(.*?)&lt;/td&gt;} $line match player(weight)<br>continue<br>}<br>if { [regexp {&lt;b&gt;Shoots: ?&lt;/b&gt;} $line] } {<br>regexp {&lt;/b&gt;(.*?)&lt;/td&gt;} $line match player(hand)<br>if { $player(hand) == "L" } { set player(hand) "left" }<br>if { $player(hand) == "R" } { set player(hand) "right" }<br>continue<br>}<br>if { [regexp {&lt;b&gt;Bats/Throws: ?&lt;/b&gt;} $line] } {<br>regexp {&lt;/b&gt;(.*?)&lt;/td&gt;} $line match hand<br>set player(hand) [join [lindex [split $hand {/}] 1]]<br>set player(handbat) [join [lindex [split $hand {/}] 0]]<br>if { $player(hand) == "L" } { set player(hand) "lefty" }<br>if { $player(hand) == "R" } { set player(hand) "righty" }<br>if { $player(hand) == "S" } { set player(hand) "switch" }<br>if { $player(handbat) == "L" } { set player(handbat) "lefty" }<br>if { $player(handbat) == "R" } { set player(handbat) "righty" }<br>if { $player(handbat) == "S" } { set player(handbat) "switch" }<br>continue<br>}<br>if { [regexp {&lt;b&gt;... Seasons: ?&lt;/b&gt;} $line] } { regexp {&lt;/b&gt; ?(.*?)&lt;/td&gt;} $line match player(exp); continue }<br>if { [regexp {Drafted by} $line] } { regexp {\'pad10\'&gt;(.*?)\.?&lt;/td&gt;} $line match player(draft); continue }<br>if { [regexp {Signed by} $line] } { regexp {\'pad10\'&gt;(.*?)\.?&lt;/td&gt;} $line match player(signed); continue }<br>}<br><br># player season stats and history<br>if { ($type == "stats") || ($type == "playoffs") || ($type == "history") } {<br>if { [regexp {Current Status\:} $line] } {<br>regexp {Current Status\: ?(.*?)&lt;/td&gt;} $line match stats(status)<br>set stats(grab) 1<br>continue<br>}<br><br>if { $stats(grab) &gt; 0 } {<br>if { [regexp {Playoff Stats} $line] } {<br>set playoffs(grab) 1<br>set stats(grab) 2<br>continue<br>}<br>if { $stats(grab) == 1 } {<br>if { $input(year) == 0 } {<br>if { [regexp {&lt;/tr&gt;} $line] } {<br>set stats(grab) 3<br>}<br>} {<br>if { [regexp {Career Stats} $line] } {<br>set stats(grab) 2<br>} {<br>if { [regexp {Scouting Report} $line] } {<br>set history(grab) 1<br>continue<br>}<br><br># find transactions, injuries, etc<br>if { $history(grab) &gt; 0 } {<br>if { [regexp {row.?\'&gt;} $line] } {<br><br>set entry ""<br>regexp {row.?\'&gt;(.*?)&lt;/td&gt;} $line match entry<br># event year<br>if { $history(grab) == 1 } {<br>if { [tsn:checkyear $input(year) $input(yearalt) $entry] } {<br>set history(data) "$history(data) $entry"<br>if { [string index $history(data) end] != ":" } {<br>set history(data) "$history(data):"<br>}<br>set history(grab) 2<br>continue<br>}<br>}<br># event description<br>if { $history(grab) == 2 } {<br>if { [string index $entry end] != "." } {<br>set entry "$entry."<br>}<br>set history(data) "$history(data) $entry"<br>set history(grab) 1<br>}<br>}<br>}<br>}<br>}<br>continue<br>} {<br>if { [regexp {&lt;/tr&gt;} $line] } {<br>incr stats(grab)<br>if { $stats(grab) &gt; 4 } {<br>if { $input(year) == 0 } { break }<br>if { $stats(grab) == 5 } {<br>set stats(grab) 6<br>if { $playoffs(grab) } {<br>if { [tsn:checkyear $input(year) $input(yearalt) [lindex $playoffs(data) 0]] == 0 } {<br>set stats(grab) 4<br>set playoffs(data) ""<br>}<br>} {<br>if { [tsn:checkyear $input(year) $input(yearalt) [lindex $stats(data) 0]] == 0 } {<br>set stats(grab) 4<br>set stats(data) ""<br>}<br>}<br>continue<br>}<br>if { $stats(grab) &gt; 5 } {<br>if { $playoffs(grab) } {<br>if { [llength $playoffs(next)] &lt;= 0 } { break }<br>if { [tsn:checkyear $input(year) $input(yearalt) [lindex $playoffs(next) 0]] == 0 } { break }<br>if { [string first "Total" "[lindex $playoffs(next) 1]"] &gt;= 0 } { break }<br><br>foreach entry $playoffs(next) {<br>lappend playoffs(data) "$entry"<br>}<br>set stats(grab) 6<br>set playoffs(next) ""<br>} {<br>if { [llength $stats(next)] &lt;= 0 } { set stats(grab) 1; continue }<br>if { [tsn:checkyear $input(year) $input(yearalt) [lindex $stats(next) 0]] == 0 } { set stats(grab) 1; continue }<br>if { [string first "Total" "[lindex $stats(next) 1]"] &gt;= 0 } { set stats(grab) 1; continue }<br><br>foreach entry $stats(next) {<br>lappend stats(data) "$entry"<br>}<br>set stats(grab) 6<br>set stats(next) ""<br>}<br>}<br>}<br>continue<br>}<br><br>if { [regexp {row.?\'&gt;} $line] } {<br>set entry ""<br>regexp {row.?\'&gt;(.*?)&lt;/td&gt;} $line match entry<br>if { $entry != "" } {<br>if { $playoffs(grab) } {<br>switch $stats(grab) \<br>3 { lappend playoffs(columns) "$entry" } \<br>4 { lappend playoffs(data) "$entry" } \<br>6 {lappend playoffs(next) "$entry" }<br>} {<br>switch $stats(grab) \<br>3 { lappend stats(columns) "$entry" } \<br>4 { lappend stats(data) "$entry" } \<br>6 {lappend stats(next) "$entry" }<br>}<br>}<br>continue<br>}<br>}<br>}<br>}<br><br># player scouting info<br>if { $type == "scout" } {<br>if { [regexp {Honours and Awards} $line] } { break }<br><br>if { [regexp {&lt;b&gt;Age:&lt;/b&gt;} $line] } { regexp {&lt;/b&gt; ?(.*?)&lt;/td&gt;} $line match player(age) }<br>if { [regexp {&lt;b&gt;HT:&lt;/b&gt;} $line] } {<br>regexp {HT:&lt;/b&gt; ?(.*?) &lt;b&gt;} $line match player(height)<br>regexp {WT:&lt;/b&gt; ?(.*?)&lt;/td&gt;} $line match player(weight)<br>}<br>if { [regexp {&lt;b&gt;... Seasons: ?&lt;/b&gt;} $line] } { regexp {&lt;/b&gt; ?(.*?)&lt;/td&gt;} $line match player(exp) }<br><br>if { [regexp {Assets} $line] } { set scout(grab) 1; continue }<br>if { [regexp {Flaws} $line] } { set scout(grab) 2; continue }<br>if { [regexp {Career potential} $line] } { set scout(grab) 3; continue }<br><br>if { $scout(grab) == 1 } { regexp {&gt;(.*?)&lt;/td&gt;} $line match scout(assets); set scout(grab) 0 }<br>if { $scout(grab) == 2 } { regexp {&gt;(.*?)&lt;/td&gt;} $line match scout(flaws); set scout(grab) 0 }<br>if { $scout(grab) == 3 } { regexp {&gt;(.*?)&lt;/td&gt;} $line match scout(potential); set scout(grab) 0 }<br>}<br>}<br><br># create final output<br>set output ""<br>if { [string index $player(number) end] != "-" } {<br>if { (($input(year) == 0) || ($type == "history") || ($type == "photo")) &amp;&amp; ($player(city) != "") &amp;&amp; ($player(team) != "") } {<br>set output "$player(city) $player(team) \002$player(number) $player(name)\002"<br>} {<br>set output "\002$player(number) $player(name)\002"<br>}<br>} {<br>if { (($input(year) == 0) || ($type == "history") || ($type == "photo")) &amp;&amp; ($player(city) != "") &amp;&amp; ($player(team) != "") } {<br>set output "$player(city) $player(team) \002$player(name)\002"<br>} {<br>set output "\002$player(name)\002"<br>}<br>}<br><br>if { $type == "photo" } {<br>if { $player(photo) == "" } {<br>puthelp "PRIVMSG $chan :No profile photo found for \002$player(name)\002."<br>return<br>}<br>puthelp "PRIVMSG $chan :$output Profile photo: $player(photo)"<br>return<br>}<br><br>if { $type == "core" } {<br>set output "$output \[$player(height) $player(weight)lbs\]"<br>if { $player(age) != "" } { set output "$output $player(age)yo" }<br>if { ($player(hand) != "") &amp;&amp; ($sport != "mlb") } { set output "$output $player(hand)-handed" }<br>if { $player(position) != "" } { set output "$output $player(position)" }<br>if { $player(hometown) != "" } { set output "$output from $player(hometown)" }<br>set output "$output."<br>if { ($player(hand) != "") &amp;&amp; ($sport == "mlb") } {<br>set output "$output Throws $player(hand), bats $player(handbat)."<br>}<br>if { ($player(birthday) != "") &amp;&amp; ($player(birthplace) != "") } {<br>set output "$output Born $player(birthday) in $player(birthplace)."<br>}<br>if { $player(draft) != "" } {<br>set output "$output $player(draft)"<br>if { $player(college) != "" } { set output "$output out of $player(college)" }<br>set output "$output."<br>}<br>if { $player(signed) != "" } { set output "$output $player(signed)." }<br>if { $player(exp) != "" } { set output "$output Has played $player(exp) seasons." }<br><br>puthelp "PRIVMSG $chan :[string trim $output]"<br>return<br>}<br><br>if { $type == "history" } {<br>if { $history(data) == "" } {<br>set output "No injuries, transactions or awards found for \002$player(name)\002 in $input(year)."<br>} {<br>if { $stats(status) != "" } {<br>set output "$output \[Status: $stats(status)\]"<br>}<br>set output "$output $history(data)"<br>}<br>puthelp "PRIVMSG $chan :$output"<br>return<br>}<br><br>if { ($type == "stats") || ($type == "playoffs") } {<br>if { $type == "stats" } {<br>if { ([llength $stats(columns)] &lt;= 0) || ([llength $stats(data)] &lt;= 0) } {<br>if { $input(year) == 0 } {<br>set output "No current season stats were found for \002$input(name)\002."<br>} {<br>set output "No season $input(year) stats were found for \002$input(name)\002."<br>}<br>puthelp "PRIVMSG $chan :$output"<br>return<br>}<br>} {<br>if { ([llength $playoffs(columns)] &lt;= 0) || ([llength $playoffs(data)] &lt;= 0) } {<br>set output "No $input(year) playoff stats were found for \002$input(name)\002."<br>puthelp "PRIVMSG $chan :$output"<br>return<br>}<br>}<br><br>if { $input(year) == 0 } {<br>set output "$output Status($stats(status))"<br>} {<br>set output ""<br>if { [string index $player(number) end] != "-" } {<br>set output "$player(number) $player(name)"<br>} {<br>set output "$player(name)"<br>}<br>}<br><br>set col 0<br>set row 0<br>set outrun 0<br>while { $outrun != 2 } {<br>set runtype $type<br>if { $outrun == 1 } {<br>set col 0<br>set row 0<br>set runtype "playoffs"<br>}<br>if { $runtype == "stats" } {<br>set out(columns) $stats(columns)<br>set out(data) $stats(data)<br>set outrun 1<br>} {<br>if { ($playoffs(columns) == "") || ($playoffs(data) == "") } {<br>break<br>}<br>set out(columns) $playoffs(columns)<br>set out(data) $playoffs(data)<br>set outrun 2<br>}<br>foreach entry $stats(data) {<br>incr col<br>incr row<br>if { $input(year) == 0 } {<br>if { $col == 1 } {<br>if { ($runtype == "playoffs") } {<br>set output "$output \[Playoffs [lindex $out(data) 1]\] [lindex $out(data) 0]"<br>} {<br>set output "$output \[[lindex $out(data) 1]\] [lindex $out(data) 0]"<br>}<br>} {<br>if { $col &lt; [llength $out(columns)] } {<br>set output "$output [lindex $out(columns) $col]([lindex $out(data) $row])"<br>}<br>}<br>continue<br>} {<br>if { $col == 1 } {<br>if { $sport == "nfl" } {<br>set output "$output \002\[[lindex $out(data) [expr { $row-1 }]] [lindex $out(data) $row]\]\002"<br>incr col<br>incr row<br>} {<br>if { $runtype == "playoffs" } {<br>set output "$output \002\[Playoffs [lindex $out(data) [expr { $row-1 }]] ([lindex $out(data) [expr { $row+1 }]]) [lindex $out(data) $row]\]\002"<br>} {<br>set output "$output \002\[[lindex $out(data) [expr { $row-1 }]] ([lindex $out(data) [expr { $row+1 }]]) [lindex $out(data) $row]\]\002"<br>}<br>incr col 2<br>incr row 2<br>}<br>}<br>if { ($col &lt; [llength $out(columns)]) &amp;&amp; ($row &lt; [llength $out(data)]) } {<br>set output "$output [lindex $out(columns) $col]([lindex $out(data) $row])"<br>} {<br>if { $input(year) == 0 } { break }<br>if { $row &gt;= [expr { [llength $out(data)] }] } { break }<br>set col 0<br>}<br>}<br>}<br>}<br><br>if { ($type != "playoffs") &amp;&amp; ($history(data) != "") } {<br>set output "$output $history(data)"<br>}<br><br>puthelp "PRIVMSG $chan :[string trim $output]"<br>return<br>}<br><br>if { $type == "scout" } {<br>if { ($scout(assets) == "") &amp;&amp; ($scout(flaws) == "") &amp;&amp; ($scout(potential) == "") } {<br>puthelp "PRIVMSG $chan :Sorry, no scouting report for \002$player(name)\002 is available."<br>return<br>}<br><br>set output "$output \[$player(height) $player(weight)lbs"<br>if { $player(age) != "" } { set output "$output $player(age)yo" }<br>if { $player(exp) != "" } { set output "$output $player(exp)-seasons" }<br>set output "$output\] Scouting report:"<br>if { $scout(potential) != "" } { set output "$output $scout(potential)" }<br>puthelp "PRIVMSG $chan :$output"<br><br>if { $scout(assets) != "" } { puthelp "PRIVMSG $chan :Assets: $scout(assets)" }<br>if { $scout(flaws) != "" } { puthelp "PRIVMSG $chan :Flaws: $scout(flaws)" }<br><br>return<br>}<br><br>puthelp "PRIVMSG $chan :[string trim $output]"<br>return<br>}<br><br>proc tsn:checkyear { year yearalt input } {<br>if { ([string compare "$year" "$input"] != 0) &amp;&amp;<br> ([string first "$yearalt" "$input"] &lt; 0) } {<br>if { [string index $input end] == ":" } {<br>if { [string length $year] == 2 } {<br>if { [string compare $year [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }<br>}<br>if { [string length $year] == 4 } {<br>if { [string compare [string range $year 2 3] [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }<br>}<br>if { [string length $year] == 5 } {<br>if { [string compare [string range $year 0 1] [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }<br>#if { [string compare [string range $year 3 4] [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }<br>}<br>if { [string length $year] == 7 } {<br>if { [string compare [string range $year 2 3] [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }<br>if { [string compare [string range $year 5 6] [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }<br>}<br>if { ([string length $yearalt] == 5) &amp;&amp; ([string index $yearalt 2] == "-") } {<br>if { [string compare [string range $yearalt 0 1] [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }<br>if { [string compare [string range $yearalt 3 4] [string range $input [expr { [string length $input]-3 }] end-1]] == 0 } { return 1 }<br>}<br>} {<br>if { [string length $input] == 4 } {<br>if { ([string length $yearalt] == 5) &amp;&amp; ([string index $yearalt 2] == "-") } {<br>if { [string compare [string range $yearalt 0 1] [string range $input [expr { [string length $input]-2 }] end]] == 0 } { return 1 }<br>if { [string compare [string range $yearalt 3 4] [string range $input [expr { [string length $input]-2 }] end]] == 0 } { return 1 }<br>}<br>}<br>}<br>return 0<br>}<br>return 1<br>}<br><br>putlog "tsnstats.tcl v0.6 by AkiraX &lt;#AnimeFiends@EFnet&gt; loaded!"<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9883">bts</a> — Mon Apr 21, 2008 2:05 pm</p><hr />
]]></content>
	</entry>
	</feed>
