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 

little problem.

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


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Mon Oct 15, 2007 8:14 am    Post subject: little problem. Reply with quote

Code:
   while {[gets $sock html] >= "0"} {
      if {[string match -nocase "*<tr valign=top*>*" $html] == "1"} {
        set x "0"
        set line ""
        set color "$html"
      } elseif {[string match -nocase "*<td nowrap>*" $html] == "1"} {
        set line "${line}[lrange [gets $sock] 0 1] "
 
        if {[incr x] >= "2"} {
          gets $sock html
          gets $sock html
          while {[gets $sock html] >= "0"

 [string match -nocase "*>Forecast<*" $html] == "0"} {
            if {[string match -nocase "*<br>*" $html] == "1" || [string match -nocase "*</td>*" $html] == "1"} {
              regexp {.html">(.+)</a>} $html match html
              regexp {(.+)<br>} $html match html
              regexp {(.+) </td>} $html match html
              set line "${line} ${html}."
            }
          }
          nextmatch:line $nick $color $line
        }
 
      }
    }


I think here is the error, can you check what could possibily be wrong in that code, something here is missing:

Code:
          while {[gets $sock html] >= "0"

 [string match -nocase "*>Forecast<*" $html] == "0"} {


Could you guide me please.

Thanks
_________________
|AmDeAtH @ Undernet


Death is only the *Beginning*...
Back to top
View user's profile Send private message Visit poster's website
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Mon Oct 15, 2007 11:36 am    Post subject: Reply with quote

Error msgs, specifically the .set errorInfo debug, would be helpful..
Back to top
View user's profile Send private message
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Mon Oct 15, 2007 12:04 pm    Post subject: Reply with quote

Code:
[21:03] <|AmDeAtH> .set errorInfo debug
[21:03] <Cricket`-> [21:03] #iamdeath# set errorInfo debug
[21:03] <Cricket`-> Ok, set.
[21:03] <Cricket`-> [21:03] Tcl error [nextmatch]: syntax error in expression "[gets $sock html] >= "0"
[21:03] <Cricket`->  [string match -nocase "*>Forecas...": extra tokens at end of expression


Thats the error I get.
_________________
|AmDeAtH @ Undernet


Death is only the *Beginning*...
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon Oct 15, 2007 1:15 pm    Post subject: Reply with quote

There's a chunk of code missing...

Also a hint, the decoding done by KrzychuG in your other thread is flawed, and will cause this error.

Doing a proper decoding would reveal that the conditionals "[gets $sock html] >= 0" and "[string match -nocase "*>Forecast<*" $html] == 0" should be combined using logical AND (&&), creating a proper if-clause.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Mon Oct 15, 2007 2:14 pm    Post subject: Reply with quote

nml375 wrote:
There's a chunk of code missing...

Also a hint, the decoding done by KrzychuG in your other thread is flawed, and will cause this error.

Doing a proper decoding would reveal that the conditionals "[gets $sock html] >= 0" and "[string match -nocase "*>Forecast<*" $html] == 0" should be combined using logical AND (&&), creating a proper if-clause.


Thanks alot nml for pointing the mistake out I have now modified my script but I got some errors take a look please:

Code:
    while {[gets $sock html] >= "0"} {
      if {[string match -nocase "*<tr valign=top*>*" $html] == "1"} {
        set x "0"
        set line ""
        set color "$html"
      } elseif {[string match -nocase "*<td nowrap>*" $html] == "1"} {
        set line "${line}[lrange [gets $sock] 3 4] "
        if {[incr x] >= "2"} {
          gets $sock html
          gets $sock html
          while {[gets $sock html] >= "0"} {
            if {[string match -nocase "*>Forecast<*" $html] == "0"} {
            if {[string match -nocase "*<br>*" $html] == "1" || [string match -nocase "*</td>*" $html] == "1"} {
              regexp {.html">(.+)</a>} $html match html
              regexp {(.+)<br>} $html match html
              regexp {(.+) </td>} $html match html
              set line "${line} ${html}."
            }
          }
          nextmatch:line $nick $color $line
        }

      }
    }
}


The bot is taking text from:

LINK

Here is what I get the reply from the bot now:

Code:
[23:07] <Cricket`-> Forthcoming Live Coverage
[23:07] <Cricket`-> Date          Time             Match
[23:07] <Cricket`-> 17</span> India  v Australia      at Mumbai.
[23:07] <Cricket`-> 17</span> India  v Australia      at Mumbai. 7th ODI.
[23:07] <Cricket`-> 17</span> India  v Australia      at Mumbai. 7th ODI. </td>.
[23:07] <Cricket`-> 17</span> India  v Australia      at Mumbai. 7th ODI. </td>. </td>.
[23:07] <Cricket`-> 17</span> India  v Australia      at Mumbai. 7th ODI. </td>. </td>. </td>.
[23:07] <Cricket`-> 17</span> India  v Australia      at Mumbai. 7th ODI. </td>. </td>. </td>. Pakistan v South Africa at Lahore.
[23:07] <Cricket`-> 17</span> India  v Australia      at Mumbai. 7th ODI. </td>. </td>. </td>. Pakistan v South Africa at Lahore. 1st ODI.
[23:07] <Cricket`-> 17</span> India  v Australia      at Mumbai. 7th ODI. </td>. </td>. </td>. Pakistan v South Africa at Lahore. 1st ODI. </td>.
[23:07] <Cricket`-> 17</span> India  v Australia      at Mumbai. 7th ODI. </td>. </td>. </td>. Pakistan v South Africa at Lahore. 1st ODI. </td>. </td>.
[23:07] <Cricket`-> 17</span> India  v Australia      at Mumbai. 7th ODI. </td>. </td>. </td>. Pakistan v South Africa at Lahore. 1st ODI. </td>. </td>. </td>.
[23:07] <Cricket`-> 17</span> India  v Australia      at Mumbai. 7th ODI. </td>. </td>. </td>. Pakistan v South Africa at Lahore. 1st ODI. </td>. </td>. </td>. Dolphins v Titans at Durban.
[23:07] <Cricket`-> 17</span> India  v Australia      at Mumbai. 7th ODI. </td>. </td>. </td>. Pakistan v South Africa at Lahore. 1st ODI. </td>. </td>. </td>. Dolphins v Titans at Durban. SuperSport Series.
[23:07] <Cricket`-> 17</span> India  v Australia      at Mumbai. 7th ODI. </td>. </td>. </td>. Pakistan v South Africa at Lahore. 1st ODI. </td>. </td>. </td>. Dolphins v Titans at Durban. SuperSport Series. </td>.
[23:07] <Cricket`-> 17</span> India  v Australia      at Mumbai. 7th ODI. </td>. </td>. </td>. Pakistan v South Africa at Lahore. 1st ODI. </td>. </td>. </td>. Dolphins v Titans at Durban. SuperSport Series. </td>. </td>.


and then bot crashes:

Code:
[23:07] * Quits: Cricket`- (cricket@cricket.users.undernet.org) (Excess Flood)


The bot is supposed to show Date: Time: Teams and then Venue. Could you please suggest me more thank you soo much.

iamdeath
_________________
|AmDeAtH @ Undernet


Death is only the *Beginning*...
Back to top
View user's profile Send private message Visit poster's website
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Fri Oct 26, 2007 3:48 am    Post subject: Reply with quote

Code:
  #--- Download Info
  if {[catch {set sock "[socket content-usa.cricinfo.com 80]"} error] == "0"} {
    puts $sock "GET /ci/content/match/fixtures/live.html HTTP/1.0"
    puts $sock "Accept: text/html"
    puts $sock "Host: content-usa.cricinfo.com"
    puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
    puts $sock "Connection: close"
    puts $sock ""
    flush $sock

    #--- Header
    putquick "PRIVMSG $nick :\037\00300,06Forthcoming Live Coverage\003\037"
    putquick "PRIVMSG $nick :\037Date          Time             Match\037"

    #--- Filtering Info
    while {[gets $sock html] >= "0"} {
      if {[string match -nocase "*<tr valign=top*>*" $html] == "1"} {
        set x "0"
        set line ""
        set color "$html"
      } elseif {[string match -nocase "*<td nowrap>*" $html] == "1"} {
        set line "${line}[lrange [gets $sock] 0 1] "

        if {[incr x] >= "2"} {
          gets $sock html
          gets $sock html
          while {[gets $sock html] >= "0" && [string match -nocase "*>Forecast<*" $html] == "0"} {
            if {[string match -nocase "*<br>*" $html] == "1" || [string match -nocase "*</td>*" $html] == "1"} {
              regexp {.html">(.+)</a>} $html match html
              regexp {(.+)<br>} $html match html
              regexp {(.+) </td>} $html match html
              set line "${line} ${html}."
            }
          }
          nextmatch:line $nick $color $line
        }

      }
    }

    #--- Footer
    putquick "PRIVMSG $nick :\037\00300,06Current Date: [strftime "%a, %d %b %Y %H:%M:%S"]\003\037"

    close $sock
  } else {
    putquick "NOTICE $nick :Timeout while querying Server."
  }
}
proc nextmatch:line {nick color text} {
  if {[string match -nocase "*class=?blue?*" $color] == "1"} {
    putquick "PRIVMSG $nick :\00306,15[lrange $text 0 1] [string repeat " " [expr 10 - [string length "[lrange $text 0 1]"]]] [lrange $text 2 3]      [lrange $text 4 end]\003"
  } else {
    putquick "PRIVMSG $nick :[lrange $text 0 1] [string repeat " " [expr 10 - [string length "[lrange $text 0 1]"]]] [lrange $text 2 3]      [lrange $text 4 end]"
  }
}


The reply I get is:

Code:
[00:38] <Cricket`-> Forthcoming Live Coverage
[00:38] <Cricket`-> Date          Time             Match
[00:38] <Cricket`-> <span style=\"vertical-align:  06:30 GMT      Namibia v Canada at Windhoek. ICC Intercontinental Cup.
[00:38] <Cricket`-> <span style=\"vertical-align:  08:00 GMT      Border v South Western Districts at East London. SAA Provincial Three-Day Challenge.
[00:38] <Cricket`-> <span style=\"vertical-align:  08:00 GMT      Eastern Province v Western Province at Port Elizabeth. SAA Provincial Three-Day Challenge.
[00:38] <Cricket`-> <span style=\"vertical-align:  08:00 GMT      Gauteng v Free State at Dobsonville. SAA Provincial Three-Day Challenge.
[00:38] <Cricket`-> <span style=\"vertical-align:  08:00 GMT      North West v Easterns at Potchefstroom. SAA Provincial Three-Day Challenge.
[00:38] <Cricket`-> <span style=\"vertical-align:  08:30 GMT      South African Invitation XI v New Zealanders at Bloemfontein. Tour Match.
[00:38] <Cricket`-> <span style=\"vertical-align:  08:30 GMT      Pakistan v South Africa at Multan. 4th ODI.
[00:38] <Cricket`-> <span style=\"vertical-align:  09:00 GMT      India Red v India Green at Ahmedabad. NKP Salve Challenger Trophy.
[00:39] <Cricket`-> <span style=\"vertical-align:  06:30 GMT      Kenya v Bermuda at Nairobi (Gym).
[00:39] <Cricket`-> <span style=\"vertical-align:  06:00 GMT      Pakistan v South Africa at Lahore. 5th ODI.
[00:39] <Cricket`-> <span style=\"vertical-align:  08:00 GMT      Griqualand West v North West at Kimberley. SAA Provincial Three-Day Challenge.
[00:39] <Cricket`-> <span style=\"vertical-align:  08:00 GMT      Northerns v Free State at Centurion. SAA Provincial Three-Day Challenge.
[00:39] <Cricket`-> <span style=\"vertical-align:  08:30 GMT      South Africa A v New Zealanders at Potchefstroom. Tour Match.
[00:39] <Cricket`-> Current Date: Fri, 26 Oct 2007 12:38:46


You see it's not showing date in the first place but showing:

Code:
<span style=\"vertical-align:


can I get rid of it?

The source if:

http://content-pak.cricinfo.com/ci/content/current/match/fixtures/live.html

Thanks.
_________________
|AmDeAtH @ Undernet


Death is only the *Beginning*...
Back to top
View user's profile Send private message Visit poster's website
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