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.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
offndr
Voice
Posts: 6 Joined: Tue Jan 04, 2005 6:53 pm
Post
by offndr » Tue Nov 18, 2008 3:48 am
hi
I want a script that when I do !text it takes information from
http://svt.se/svttext/web/pages/358.html and prints the whole table of stats into my channel(It is kind of experimental so it doesnt realy matter how it looks like, the main part is that something goes into the channel).
Further on I want to implement a !search function that for example !text <searchword> does output the whole row of that searchword.
So, If I do !text <modo> it should output the whole row for modo stats only.
Is this possible?
I would appreciate this ALOT
Thank you
ultralord
Master
Posts: 255 Joined: Mon Nov 06, 2006 6:52 pm
Post
by ultralord » Thu Nov 20, 2008 9:03 am
you must use sockets to do that i need to learn about sockets is very usefull so i would know who you can do that if someone want to make it .
gl
username
Op
Posts: 196 Joined: Thu Oct 06, 2005 9:20 am
Location: Russian Federation, Podolsk
Contact:
Post
by username » Thu Nov 20, 2008 12:22 pm
Code: Select all
namespace eval svt {}
setudef flag nopubsvt
set svt(pref) "!"
set svt(commands) "svt"
set svt(time) 30
set svt(page) http://svt.se/svttext/web/pages/358.html
set svt(version) "1.0"
set svt(author) "tvrsh @ IrcNet.ru"
package require http
foreach bind [split $svt(commands) " "] {
bind pub -|- $svt(pref)$bind ::svt::pub
bind msg -|- $svt(pref)$bind ::svt::msg
}
proc ::svt::msg {nick uhost hand arg} {
::svt::svt $nick $uhost $hand $nick $arg
}
proc ::svt::pub {nick uhost hand chan arg} {
if {[channel get $chan nopubsvt]} return
::svt::svt $nick $uhost $hand $chan $arg
}
proc ::svt::svt {nick uhost hand chan arg} {
global svt lastbind
set arg [lindex [split $arg] 0]
if {[info exists svt(host,$uhost)]} {
if {$chan == $nick} {
putquick "PRIVMSG $nick :\00303Wait \00304$svt(time) \00303seconds before next request."
return
} else {
putquick "NOTICE $nick :\00303Wait \00304$svt(time) \00303seconds before next request."
return
}
}
set agent "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1"
set svt(host,$uhost) 1
set svt(timer,$uhost) [utimer $svt(time) [list ::svt::reset $uhost ] ]
set svt_tok [::http::config -useragent $agent]
set svt_tok [::http::geturl $svt(page) -timeout 30000]
set html [::http::data $svt_tok]
::http::cleanup $svt_tok
set rgx "<span\\\ class=\\\"W\\\ bgB\\\">(.*?)<div\\\ class=\\\"subWrapper\\\">"
regsub -all -- {\n} $html "" html
foreach line [split $html \n] {
if {[regexp -nocase -- $rgx $line garb data]} {
set html $data
regsub -all -- {</span><span.*?>} $html " " html
regsub -all -- {<span\ class=.*?>} $html "|" html
regsub -all -- {</span>} $html "" html
regsub -all -- {</div>} $html "" html
regsub -all -- {</pre>} $html "" html
regsub -all -- {\s+} $html " " html
#putlog $html
foreach line [split $html "|"] {
if {$line != " "} { putserv "PRIVMSG $chan :\00302$line" }
}
return
}
}
}
proc ::svt::reset { uhost } {
global svt
catch {killutimer $svt(timer,$uhost)}
catch {unset svt(timer,$uhost)}
catch {unset svt(host,$uhost)}
}
putlog "svt.tcl v$svt(version) by $svt(author) loaded."
This is the result:
[19:19:53] <tvrsh> !svt
[19:19:53] <bionic> ISHOCKEY Elitserien (55 omg.)
[19:19:53] <bionic> 17/11 Frцlunda - Sцdertдlje 3-2
[19:19:53] <bionic> Linkцping - Rцgle 3-1
[19:19:53] <bionic> Modo - Skellefteе 0-6
[19:19:53] <bionic> 18/11 HV71 - Luleе 1-1 SD
[19:19:53] <bionic> Fдrjestad - Timrе 2-0
[19:19:56] <bionic> Djurgеrden - Brynдs 2-4
[19:19:58] <bionic> S V O F VЦ GM IM P
[19:20:00] <bionic> 1 Linkцpin 22 12 5 5 1 65- 50 42
[19:20:01] <bionic> 2 Skelleft 22 10 5 7 1 66- 54 36
[19:20:04] <bionic> 3 Fдrjesta 22 11 3 8 0 53- 47 36
[19:20:06] <bionic> 4 Brynдs 22 10 3 9 2 51- 58 35
[19:20:08] <bionic> 5 Rцgle 22 9 5 8 1 62- 59 33
[19:20:09] <bionic> 6 Modo 23 9 4 10 2 66- 71 33
[19:20:12] <bionic> 7 Luleе 22 9 5 8 0 60- 57 32
[19:20:14] <bionic> 8 Frцlunda 22 8 5 9 2 55- 56 31
[19:20:16] <bionic> 9 HV71 22 7 7 8 3 60- 62 31
[19:20:17] <bionic> 10 Djurgеrd 23 6 8 9 3 63- 66 29
[19:20:20] <bionic> 11 Timrе 22 6 5 11 4 55- 66 27
[19:20:22] <bionic> 12 Sцdertдl 22 5 7 10 2 53- 63 24
[19:20:24] <bionic> Kommande omgеngar sid. 359