| View previous topic :: View next topic |
| Author |
Message |
FcLan Halfop
Joined: 30 Sep 2005 Posts: 64 Location: Poland
|
Posted: Fri Jun 16, 2006 5:04 am Post subject: Egghttp problem |
|
|
Welcome after break I have some problem with my http script.. I would like that bot don`t reply this same news, text from any site, and i want to read more than only 1 st news, also if it is possible i would like to add timer to this script like in mirc for ex /timer 0 300 /anyalias, but when i trying with this script bot reply the same text.. and read only frist news
| Code: | package require http
bind pub - !news www:news
proc www:news {nick host handle chan text} {
set token [::http::geturl http://anysite.com -timeout 10000]
set status [::http::status $token]
::http::cleanup $token;
set data [http::data [http::geturl http://anysite.com]]
regexp {<html>(.*?)<html>} $data data something
set news "$something"
set news.old "$news"
set count 3
if {$count=="5"} {return}
if {$news != "news.old"} {
puthelp "PRIVMSG $chan :$news"
incr count
} |
|
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Fri Jun 16, 2006 9:02 am Post subject: |
|
|
you are not using egghttp anything... you use http with eggdrop, not egghttp .
You can 'loop' procs by using timer or utimer at their end to call themselves (read tcl-commands.doc or search this board for references). _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
FcLan Halfop
Joined: 30 Sep 2005 Posts: 64 Location: Poland
|
Posted: Fri Jun 16, 2006 9:20 am Post subject: |
|
|
| ok, I`ll look, but why bot reply the same text, what`s wrong? |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Fri Jun 16, 2006 10:38 am Post subject: |
|
|
It should only change, when the page actually changes. I can see only these strange things:
| Code: | set count 3
if {$count=="5"} {return} | Will be always false... you could also write 'if 0 {return}'
| Code: | | set news "$something" | redudant... just use news from beginning or continue with something. btw you dont need these "" around variables as long you don't operate with strings that might cause to false list interpretations (or simply for code readablility/clearity)
| Code: | set news.old "$news"
...
if {$news != "news.old"} { | Look like you wanted to write '$news != $news.old' instead (putting around "" at this one, will even cause the unexpected behavior that it compares '$news' with '$news' + '.old' )
since count is no global var (and should be avoided to be used by that common name), it will only make the proc return the value '4' and value gets lost..
maybe some of these hints help you. _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
FcLan Halfop
Joined: 30 Sep 2005 Posts: 64 Location: Poland
|
Posted: Mon Jun 19, 2006 7:50 am Post subject: |
|
|
sorry, it does not help me  |
|
| Back to top |
|
 |
|