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.
Help for those learning Tcl or writing their own scripts.
FcLan
Halfop
Posts: 64 Joined: Fri Sep 30, 2005 10:46 am
Location: Poland
Post
by FcLan » Fri Dec 16, 2005 1:31 pm
I`ve a livescore script for my eggdrop. It works, but the problem is it gives results from down from bottom i want to see results from top and not only one, for example frist 5 please help me, thx.
Code: Select all
set url "www.pilkanozna.pl"
proc get_news {nick uhost handle channel text} {
global url
set sock [socket $url 80]
fconfigure $sock -buffering line -buffersize 1000
puts $sock "GET /pn.php?dzial=online HTTP/1.0"
puts $sock "Host: www.pilkanozna.pl"
puts $sock ""
puts $sock "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; WindowsNT 5.0)"
flush $sock
while {![eof $sock]} {
gets $sock body
regexp -all {<td align=right>(.*?)</td>} $body _ team1
regexp -all {<td align=center>(.*?)</td>} $body _ result
regexp -all {<td align=left>(.*?)</td>} $body _ team2
}
if {[eof $sock]} { close $sock }
regsub -all {(<.+?>)} $team1"" team1
regsub -all {(<.+?>)} $result"" result
regsub -all {(<.+?>)} $team2"" team2
puthelp "PRIVMSG $channel :[lindex $team1][lindex $result][lindex $team2]"
}
bind pub - !score get_news
demond
Revered One
Posts: 3073 Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:
Post
by demond » Fri Dec 16, 2005 11:29 pm
don't use raw sockets for HTTP, use the http package and its [geturl] command
connection, sharing, dcc problems? click
<here>
before asking for scripting help, read
<this>
use
FcLan
Halfop
Posts: 64 Joined: Fri Sep 30, 2005 10:46 am
Location: Poland
Post
by FcLan » Sat Dec 17, 2005 7:36 am
Hmm, I understand only a sock.. really can`t change it?
FcLan
Halfop
Posts: 64 Joined: Fri Sep 30, 2005 10:46 am
Location: Poland
Post
by FcLan » Sat Dec 17, 2005 7:37 am
Can u show me example script "http package and its [geturl] command" ?
avilon
Halfop
Posts: 64 Joined: Tue Jul 13, 2004 6:58 am
Location: Germany
Post
by avilon » Sat Dec 17, 2005 9:38 am