NBA Scoreboard

By orkz on Mar 15, 2007

It's a simple scoreboard of NBA active or upcoming games. Just like on www.nba.com. Type /nba to activate.

; NBA Scoreboard
; orkz @ irc.lv
; pumpuri@gmail.com

alias nba {
  .remove nbalive.txt
  if ($sock(nbalive)) { sockclose nbalive }
  sockopen nbalive www.nba.com 80
}
on *:sockopen:nbalive:{
  sockwrite -n nbalive GET /scores/simpleScoreboard.jsp HTTP/1.1
  sockwrite -n nbalive Host: www.nba.com
  sockwrite -n nbalive Connection: close
  sockwrite -n nbalive $crlf
}
on *:sockread:nbalive:{
  sockread -fn &nbainfo
  breplace &nbainfo 0 10
  breplace &nbainfo 62 10
  bwrite nbalive.txt -1 -1 &nbainfo
}
ON *:sockclose:nbalive: {
  shownbalive
}
alias shownbalive {
  var %lines $lines(nbalive.txt), %i 1, %nbagame 1
  while (%i <= %lines) {
    var %temp = $read(nbalive.txt,%i)
    if (<game isin $read(nbalive.txt,%i)) {
      if (: isin $gettok(%temp,8,34)) {
        var %game_info = ( $+ Starts $gettok(%temp,8,34) $+ )
      }
      elseif (Start of isin $gettok(%temp,8,34)) {
        var %game_info = ( $+ $gettok(%temp,8,34) $+ )
      }
      else {
        if ($gettok(%temp,2,34) == $chr(32)) {
          var %game_info = ( $+ $gettok(%temp,8,34) $+ )
        } 
        else {
          var %game_info = ( $+ $gettok(%temp,2,34) left in $gettok(%temp,8,34) $+ )  
        }
      }
    }
    if (<htm isin $read(nbalive.txt,%i)) var %team_1 = $gettok($gettok(%temp,$numtok(%temp,34),34),4,124) $iif($gettok($gettok(%temp,10,34),9,124) >= 0,$+(04,$v1,))
    if (<vtm isin $read(nbalive.txt,%i)) var %team_2 = $gettok($gettok(%temp,$numtok(%temp,34),34),4,124) $iif($gettok($gettok(%temp,10,34),9,124) >= 0,$+(04,$v1,))
    if (%game_info) && (%team_1) && (%team_2) {
      echo -a %nbagame $+ ) %team_2 $chr(124) %team_1 %game_info
      inc %nbagame
      unset %game_info %team_1 %team_2
    }
    inc %i
  }
  .remove nbalive.txt
}

Comments

Sign in to comment.
edition   -  Jul 26, 2009

Hi does this script still work?

 Respond  
Jester   -  Mar 17, 2007

I totally like this script... just think it would be better if it said it instead of echoing it... edits it

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.