egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Egghttp problem

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
FcLan
Halfop


Joined: 30 Sep 2005
Posts: 64
Location: Poland

PostPosted: Fri Jun 16, 2006 5:04 am    Post subject: Egghttp problem Reply with quote

Welcome after break Very Happy 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
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Fri Jun 16, 2006 9:02 am    Post subject: Reply with quote

you are not using egghttp anything... you use http with eggdrop, not egghttp Very Happy.

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
View user's profile Send private message MSN Messenger
FcLan
Halfop


Joined: 30 Sep 2005
Posts: 64
Location: Poland

PostPosted: Fri Jun 16, 2006 9:20 am    Post subject: Reply with quote

ok, I`ll look, but why bot reply the same text, what`s wrong?
Back to top
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Fri Jun 16, 2006 10:38 am    Post subject: Reply with quote

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}' Very Happy

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 Smile (putting around "" at this one, will even cause the unexpected behavior that it compares '$news' with '$news' + '.old' Very Happy)

Code:
         incr count
 }
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
View user's profile Send private message MSN Messenger
FcLan
Halfop


Joined: 30 Sep 2005
Posts: 64
Location: Poland

PostPosted: Mon Jun 19, 2006 7:50 am    Post subject: Reply with quote

sorry, it does not help me Sad
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber