<?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/16658" />

	<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>2009-02-26T16:34:30-04:00</updated>

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

		<entry>
		<author><name><![CDATA[tomekk]]></name></author>
		<updated>2009-02-26T16:34:30-04:00</updated>

		<published>2009-02-26T16:34:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87580#p87580</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87580#p87580"/>
		<title type="html"><![CDATA[Pull top scorers from page and display...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87580#p87580"><![CDATA[
fix, works with !topscorer X, !topscorer X X, !topscorer X-X <br><div class="codebox"><p>Code: </p><pre><code>package require http setudef flag football set vTimeout 10 set vUrl http://www.4thegame.com/football-statistics/premiership/topscorers/ bind PUB - !topscorer pTopScorer proc pTopScorer {nick uhost hand channel txt} {     global vTimeout vUrl     if {[channel get $channel football]} {         set arguments [string trim $txt] set args_len [llength [split $arguments]]if {$args_len == 1} {if {[regexp {^[1-9]+\-[1-9]+$} $arguments]} {set arg_split [split $arguments "-"]set min [lindex $arg_split 0]set max [lindex $arg_split 1]} {set min $argumentsset max $arguments}} {set arg_split [split $arguments]set min [lindex $arg_split 0]set max [lindex $arg_split 1]}if {([regexp {^[1-9][0-9]*$} $min]) &amp;&amp; ([regexp {^[1-9][0-9]*$} $max])} {             set agent [::http::config -useragent "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"]             if {![catch {set http [::http::geturl $vUrl -timeout [expr {$vTimeout * 1000}]]}]} {                 switch -- [::http::status $http] {                     "timeout" {putserv "PRIVMSG $channel :attempt to scrape $vUrl timed out after $vTimeout seconds"}                     "error" {putserv "PRIVMSG $channel :attempt to scrape $vUrl returned error [::http::error $http]"}                     "ok" {                         switch -- [::http::ncode $http] {                             200 {                                 regexp -- {wastarget="_blank"&gt;(.+?)&lt;br&gt;Prem} [::http::data $http] -&gt; table                                 if {[info exists table]} {                                     set table [regsub -all -- {&lt;[^&gt;]+&gt;} $table " "]; set table [regsub -all -- {[\n]} $table ""]                                     set table [regsub -all -- {[\s]{5}} $table \n]; set table [regsub -all -- {[\s]{2}\*} $table ""]                                     set table [regsub -all -- {[\s]{2,4}} $table |]                                     set playerlist [split $table \n]                                     set count 0                                     foreach line $playerlist {                                         set itemlist [split $line |]                                         if {[llength $itemlist] != 0} {                                             incr count                                             set player($count) [lindex $itemlist 0]; set team($count) [lindex $itemlist 1]                                             set prem($count) [lindex $itemlist 2]; set cc($count) [lindex $itemlist 3]                                             set fa($count) [lindex $itemlist 4]; set uefa($count) [lindex $itemlist 5]                                             set cl($count) [lindex $itemlist 6]; set other($count) [lindex $itemlist 7]                                             set total($count) [lindex $itemlist 8]                                         }                                     }                                     switch -- $count {                                         0 {putserv "PRIVMSG $channel :top score table found from $vUrl but empty"}                                         default {                                             if {[expr {$min &lt;= $max}]} {                                                 if {[expr {$min &lt;= $count}]} {                                                     for {set loop $min} {$loop &lt;= $max} {incr loop} {                                                         if {[info exists player($loop)]} {                                                             lappend outputlist \00312$player($loop)\003 ($team($loop)) Premier League ($prem($loop))                                                             lappend outputlist Carling Cup ($cc($loop)) FA Cup ($fa($loop)) UEFA Cup ($uefa($loop))                                                             lappend outputlist Champions League ($cl($loop)) Other ($other($loop)) Total ($total($loop))                                                             set output [regsub -all -- {\(} [join $outputlist] \(\00314]                                                             set output [regsub -all -- {\)} $output \003\)]                                                             putserv "PRIVMSG $channel :$output"                                                             unset outputlist                                                         }                                                     }                                                 } else {putserv "PRIVMSG $channel :results from $vUrl do not include top scorer $min onwards"}                                             } else {putserv "PRIVMSG $channel :the first argument must be equal to or less than any second argument"}                                         }                                     }                                 } else {putserv "PRIVMSG $channel :top score table not found from $vUrl"}                             }                             default {putserv "PRIVMSG $channel :attempt to scrape $vUrl returned ncode [::http::ncode $http]"}                         }                     }                 }                 ::http::cleanup $http             } else {putserv "PRIVMSG $channel :attempted connection to $vUrl failed"}         } else {putserv "PRIVMSG $channel :correct syntax is !topscorer &lt;non-zero integer&gt; ?integer?"}     }         return 0 }</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10332">tomekk</a> — Thu Feb 26, 2009 4:34 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zombie_gaz]]></name></author>
		<updated>2009-02-26T15:13:19-04:00</updated>

		<published>2009-02-26T15:13:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87579#p87579</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87579#p87579"/>
		<title type="html"><![CDATA[Use - between intigers...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87579#p87579"><![CDATA[
There's no way to change this? That really sucks. :\<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10517">zombie_gaz</a> — Thu Feb 26, 2009 3:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-02-26T15:11:04-04:00</updated>

		<published>2009-02-26T15:11:04-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87578#p87578</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87578#p87578"/>
		<title type="html"><![CDATA[Pull top scorers from page and display...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87578#p87578"><![CDATA[
I expect you'd have to get somebody to make a different script<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Thu Feb 26, 2009 3:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zombie_gaz]]></name></author>
		<updated>2009-02-26T14:56:37-04:00</updated>

		<published>2009-02-26T14:56:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87577#p87577</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87577#p87577"/>
		<title type="html"><![CDATA[Small change]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87577#p87577"><![CDATA[
What about if I wanted it to use input in the form #-# instead of # #?<br><br>So '!topscorer 1-5' instead of '!topscorer 1 5'.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10517">zombie_gaz</a> — Thu Feb 26, 2009 2:56 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-02-26T12:28:39-04:00</updated>

		<published>2009-02-26T12:28:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87576#p87576</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87576#p87576"/>
		<title type="html"><![CDATA[Pull top scorers from page and display...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87576#p87576"><![CDATA[
script requires http package which should be available by default on eggdrops, but not windrops.<br><br>script requires +football flag setting in partyline for channel(s) you require it to function in, for example as follows :-<br><br>.chanset #eggTCL +football<br><br>as it stands, the script outputs text embelished with colour so the network/channel must allow it. for example a channel setting of +c on dalnet would prevent it working.<br><br>syntax is !topscorer &lt;non-zero integer&gt; ?non-zero integer?<br><div class="codebox"><p>Code: </p><pre><code>package require httpsetudef flag footballset vTimeout 10set vUrl http://www.4thegame.com/football-statistics/premiership/topscorers/bind PUB - !topscorer pTopScorerproc pTopScorer {nick uhost hand channel txt} {    global vTimeout vUrl    if {[channel get $channel football]} {        set arguments [string trim $txt]        set min [lindex $arguments 0]        if {[llength [split $arguments]] == 1} {set max $min} else {set max [lindex [split $arguments] 1]}        if {([regexp {^[1-9][0-9]*$} $min]) &amp;&amp; ([regexp {^[1-9][0-9]*$} $max])} {            set agent [::http::config -useragent "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"]            if {![catch {set http [::http::geturl $vUrl -timeout [expr {$vTimeout * 1000}]]}]} {                switch -- [::http::status $http] {                    "timeout" {putserv "PRIVMSG $channel :attempt to scrape $vUrl timed out after $vTimeout seconds"}                    "error" {putserv "PRIVMSG $channel :attempt to scrape $vUrl returned error [::http::error $http]"}                    "ok" {                        switch -- [::http::ncode $http] {                            200 {                                regexp -- {wastarget="_blank"&gt;(.+?)&lt;br&gt;Prem} [::http::data $http] -&gt; table                                if {[info exists table]} {                                    set table [regsub -all -- {&lt;[^&gt;]+&gt;} $table " "]; set table [regsub -all -- {[\n]} $table ""]                                    set table [regsub -all -- {[\s]{5}} $table \n]; set table [regsub -all -- {[\s]{2}\*} $table ""]                                    set table [regsub -all -- {[\s]{2,4}} $table |]                                    set playerlist [split $table \n]                                    set count 0                                    foreach line $playerlist {                                        set itemlist [split $line |]                                        if {[llength $itemlist] != 0} {                                            incr count                                            set player($count) [lindex $itemlist 0]; set team($count) [lindex $itemlist 1]                                            set prem($count) [lindex $itemlist 2]; set cc($count) [lindex $itemlist 3]                                            set fa($count) [lindex $itemlist 4]; set uefa($count) [lindex $itemlist 5]                                            set cl($count) [lindex $itemlist 6]; set other($count) [lindex $itemlist 7]                                            set total($count) [lindex $itemlist 8]                                        }                                    }                                    switch -- $count {                                        0 {putserv "PRIVMSG $channel :top score table found from $vUrl but empty"}                                        default {                                            if {[expr {$min &lt;= $max}]} {                                                if {[expr {$min &lt;= $count}]} {                                                    for {set loop $min} {$loop &lt;= $max} {incr loop} {                                                        if {[info exists player($loop)]} {                                                            lappend outputlist \00312$player($loop)\003 ($team($loop)) Premier League ($prem($loop))                                                            lappend outputlist Carling Cup ($cc($loop)) FA Cup ($fa($loop)) UEFA Cup ($uefa($loop))                                                            lappend outputlist Champions League ($cl($loop)) Other ($other($loop)) Total ($total($loop))                                                            set output [regsub -all -- {\(} [join $outputlist] \(\00314]                                                            set output [regsub -all -- {\)} $output \003\)]                                                            putserv "PRIVMSG $channel :$output"                                                            unset outputlist                                                        }                                                    }                                                } else {putserv "PRIVMSG $channel :results from $vUrl do not include top scorer $min onwards"}                                            } else {putserv "PRIVMSG $channel :the first argument must be equal to or less than any second argument"}                                        }                                    }                                } else {putserv "PRIVMSG $channel :top score table not found from $vUrl"}                            }                            default {putserv "PRIVMSG $channel :attempt to scrape $vUrl returned ncode [::http::ncode $http]"}                        }                    }                }                ::http::cleanup $http            } else {putserv "PRIVMSG $channel :attempted connection to $vUrl failed"}        } else {putserv "PRIVMSG $channel :correct syntax is !topscorer &lt;non-zero integer&gt; ?integer?"}    }        return 0}</code></pre></div>example output as follows :-<br><br><img src="http://i672.photobucket.com/albums/vv90/arfer/football.png" class="postimage" alt="Image"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Thu Feb 26, 2009 12:28 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[zombie_gaz]]></name></author>
		<updated>2009-02-25T21:48:53-04:00</updated>

		<published>2009-02-25T21:48:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=87563#p87563</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=87563#p87563"/>
		<title type="html"><![CDATA[Pull top scorers from page and display...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=87563#p87563"><![CDATA[
I need a script that can do !topscorer # or !topscorer #-# using this web page.<br><br><a href="http://www.4thegame.com/football-statistics/premiership/topscorers/" class="postlink">http://www.4thegame.com/football-statis ... opscorers/</a><br><br>Obviously, it needs to make updates based on that web page.<br><br>So...<br><br>Doing !topscorer 1-2 would give you:<br>Top Scorer | Team | Prem | CC | FA | UEFA | CL | Other | Total<br>Nicolas Anelka | Chelsea | 15 | 0 | 4 | 0 | 2 | 0 | 21<br>Steven Gerrard | Liverpool | 9 | 0 | 1 | 0 | 5 | 0 | 15<br><br>If that's too much then just using <a href="http://news.bbc.co.uk/sport2/hi/football/eng_prem/top_scorers/default.stm" class="postlink">http://news.bbc.co.uk/sport2/hi/footbal ... efault.stm</a> to display player, team and total would be fine. :\<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10517">zombie_gaz</a> — Wed Feb 25, 2009 9:48 pm</p><hr />
]]></content>
	</entry>
	</feed>
