ScoreBoard — File Browser

ScoreBoardv1.0 / ScoreBoardv1.0 / Scoreboard.mrc

Scoreboard.mrc — 25.85 KB — Download this file

menu channel,query {
  .ScoreBoard:/Score
}
alias -l opennba {
  sockclose scores.nba
  set %games 0
  set %i 0
  sockopen scores.nba sportsillustrated.cnn.com 80
  write -c scores.txt
}
alias -l opennhl {
  sockclose scores.nhl
  set %games 0
  set %write.score 0
  .timerscores off
  .timerrepeat off
  set %i 0
  sockopen scores.nhl sportsillustrated.cnn.com 80
  write -c scores.txt
}
alias opennfl {
  sockclose scores
  set %games 0
  set %write.score 0
  .timerscores off
  .timerrepeat off
  set %i 0
  sockopen scores sportsillustrated.cnn.com 80
  write -c scores.txt
}
alias -l nohtml {
  var %tmp, %ignore = $regsub($1-,/(<[^>]+>)/g,$chr(32),%tmp)
  return %tmp
}

on *:sockopen:scores.nba:{
  sockwrite -n $sockname GET /basketball/nba/scoreboards/today/ HTTP/1.1
  sockwrite -n $sockname Host: sportsillustrated.cnn.com
  sockwrite -n $sockname Connection: close
  sockwrite -n $sockname
}
on *:sockread:scores.nba:{
  var %scores.temp
  sockread %scores.temp
  if (%write.time == 1) {
    write scores.txt %scores.temp
    inc %games
    unset %write.time
  }
  if (%write.team == 1) {
    set %team $remove($nohtml(%scores.temp),&nbsp;)
    unset %write.team
  }
  if (%write.score == 1) {
    set %score $remove($nohtml(%scores.temp),&nbsp;)
    write scores.txt %team - %score
    unset %write.score
  }
  if (*<td class="ScoreTitle" nowrap colspan="3" width="100%">* iswm %scores.temp) {
    set %write.time 1
  }
  elseif (*<td align="left" class="ScoreMData1" noWrap width="100%">* iswm %scores.temp) {
    set %write.team 1
  }
  elseif (*<td align="right" class="ScoreMData1" noWrap>* iswm %scores.temp) {
    set %write.score 1
  }
}
on *:sockclose:scores.nba:{
  inc %i
  drawrect -rf @score 8007982 10 1 1 250 10 251 1 90 100
  drawrect -rf @score $rgb(0,0,0) 10 1 11 170 90
  drawrect -rf @score 16777215 10 171 11 80 90
  drawline -rf @score $rgb(0,0,0) 4 338 1 338 99
  drawline -rf @score $rgb(0,0,0) 4 170 13 250 13
  drawline -rf @score $rgb(0,0,0) 4 250 15 250 99
  drawrect -r @score 8007982 12 320 6 10 10
  drawtext -rob @score $rgb(255,242,0) 8007982 "times new roman" 12 322 2 x
  drawline -rf @score $rgb(0,0,0) 2 319 5 331 5
  drawline -rf @score $rgb(0,0,0) 2 319 5 319 17
  drawline -rf @score $rgb(0,0,0) 2 319 17 331 17
  drawline -rf @score $rgb(0,0,0) 2 331 17 331 5
  drawline -rf @score $rgb(0,0,0) 4 2 1 338 1
  drawrect -rf @score $rgb(180,180,180) 10 1 100 340 17
  drawrect -rf @score $rgb(180,180,180) 10 3 100 40 15
  drawrect -rf @score $rgb(180,180,180) 10 103 100 40 15
  drawrect -rf @score $rgb(180,180,180) 10 203 100 35 15
  drawrect -rf @score $rgb(180,180,180) 10 303 100 35 15
  drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 10 100 MLB
  drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 110 100 NHL
  drawtext -rob @score $rgb(255,242,0) $rgb(180,180,180) "times new roman" 12 210 100 NBA
  drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 310 100 NFL
  drawline -rf @score $rgb(0,0,0) 4 3 1 3 115
  drawline -rf @score $rgb(0,0,0) 4 3 115 339 115
  drawline -rf @score $rgb(0,0,0) 4 339 115 339 100
  drawline -rf @score $rgb(0,0,0) 4 250 98 170 98
  drawline -rf @score $rgb(0,0,0) 4 250 98 338 98
  ;Time
  if ($remove($read(scores.txt, %i),&nbsp;) == $null) {
    drawtext -rob @score $rgb(255,255,255) $rgb(0,0,0) "times new roman" 15 10 45 No Games Today
    return
  }
  drawtext -rob @score $rgb(255,255,255) 8007982 "times new roman" 13 $iif(Final == $remove($read(scores.txt, %i),&nbsp;),276,$iif($len($remove($read(scores.txt, %i),&nbsp;)) =< 10 ,270,258)) 45 $remove($gettok($read(scores.txt, %i),2,59),&nbsp) $remove($gettok($read(scores.txt, %i),4,59),&nbsp)
  inc %i
  ;team1
  drawtext -rob @score $rgb(255,255,255) $rgb(0,0,0) "times new roman" 15 10 21 $gettok($read(scores.txt, %i),1-2,45)
  ;score1
  if ($gettok($read(scores.txt, %i),3,45) == $null) {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 205 21 -
  }
  else {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 $iif($len($gettok($read(scores.txt, %i),3,45)) == 2,198,196) 21 $gettok($read(scores.txt, %i),3,45)
  }
  inc %i
  ;team2
  drawtext -rob @score $rgb(255,255,255) $rgb(0,0,0) "times new roman" 15 10 61 $gettok($read(scores.txt, %i),1-2,45)
  ;score2
  if ($gettok($read(scores.txt, %i),3,45) == $null) {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 205 61 -
  }
  else {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 196 61 $gettok($read(scores.txt, %i),3,45)
  }
  $iif(%games == 1,return, .timerscores $calc(%games - 1) 4 /nbaalias)
  .timerrepeat 1 $calc((%games - 1) * 5) /opennba
}
alias nbaalias {
  inc %i
  drawrect -rf @score 8007982 10 1 1 250 10 251 1 90 100
  drawrect -rf @score $rgb(0,0,0) 10 1 11 170 90
  drawrect -rf @score 16777215 10 171 11 80 90
  drawline -rf @score $rgb(0,0,0) 4 338 1 338 99
  drawline -rf @score $rgb(0,0,0) 4 170 13 250 13
  drawline -rf @score $rgb(0,0,0) 4 250 15 250 99
  drawrect -r @score 8007982 12 320 6 10 10
  drawtext -rob @score $rgb(255,242,0) 8007982 "times new roman" 12 322 2 x
  drawline -rf @score $rgb(0,0,0) 2 319 5 331 5
  drawline -rf @score $rgb(0,0,0) 2 319 5 319 17
  drawline -rf @score $rgb(0,0,0) 2 319 17 331 17
  drawline -rf @score $rgb(0,0,0) 2 331 17 331 5
  drawline -rf @score $rgb(0,0,0) 4 2 1 338 1
  drawrect -rf @score $rgb(180,180,180) 10 1 100 340 17
  drawrect -rf @score $rgb(180,180,180) 10 3 100 40 15
  drawrect -rf @score $rgb(180,180,180) 10 103 100 40 15
  drawrect -rf @score $rgb(180,180,180) 10 203 100 35 15
  drawrect -rf @score $rgb(180,180,180) 10 303 100 35 15
  drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 10 100 MLB
  drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 110 100 NHL
  drawtext -rob @score $rgb(255,242,0) $rgb(180,180,180) "times new roman" 12 210 100 NBA
  drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 310 100 NFL
  drawline -rf @score $rgb(0,0,0) 4 3 1 3 115
  drawline -rf @score $rgb(0,0,0) 4 3 115 339 115
  drawline -rf @score $rgb(0,0,0) 4 339 115 339 100
  drawline -rf @score $rgb(0,0,0) 4 250 98 170 98
  drawline -rf @score $rgb(0,0,0) 4 250 98 338 98
  ;Time
  drawtext -rob @score $rgb(255,255,255) 8007982 "times new roman" 13 $iif(Final == $remove($read(scores.txt, %i),&nbsp;),276,$iif($len($remove($read(scores.txt, %i),&nbsp;)) =< 10 ,270,258)) 45 $remove($gettok($read(scores.txt, %i),2,59),&nbsp) $remove($gettok($read(scores.txt, %i),4,59),&nbsp)
  inc %i
  ;team1
  drawtext -rob @score $rgb(255,255,255) $rgb(0,0,0) "times new roman" 15 10 21 $gettok($read(scores.txt, %i),1-2,45)
  ;score1
  if ($gettok($read(scores.txt, %i),3,45) == $null) {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 205 21 -
  }
  else {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 $iif($len($gettok($read(scores.txt, %i),3,45)) == 2,198,196) 21 $gettok($read(scores.txt, %i),3,45)
  }
  inc %i
  ;team2
  drawtext -rob @score $rgb(255,255,255) $rgb(0,0,0) "times new roman" 15 10 61 $gettok($read(scores.txt, %i),1-2,45)
  ;score2
  if ($gettok($read(scores.txt, %i),3,45) == $null) {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 205 61 -
  }
  else {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 196 61 $gettok($read(scores.txt, %i),3,45)
  }
}

alias Score { 
  window -podhk1 +d @score 1 1 343 118
  drawrect -rf @score 8007982 10 1 1 250 10 251 1 90 100
  drawrect -rf @score $rgb(0,0,0) 10 1 11 170 90
  drawrect -rf @score 16777215 10 171 11 80 90
  drawline -rf @score $rgb(0,0,0) 4 338 1 338 99
  drawline -rf @score $rgb(0,0,0) 4 170 13 250 13
  drawline -rf @score $rgb(0,0,0) 4 250 15 250 99
  drawrect -r @score 8007982 12 320 6 10 10
  drawtext -rob @score $rgb(255,242,0) 8007982 "times new roman" 12 322 2 x
  drawline -rf @score $rgb(0,0,0) 2 319 5 331 5
  drawline -rf @score $rgb(0,0,0) 2 319 5 319 17
  drawline -rf @score $rgb(0,0,0) 2 319 17 331 17
  drawline -rf @score $rgb(0,0,0) 2 331 17 331 5
  drawline -rf @score $rgb(0,0,0) 4 2 1 338 1
  drawrect -rf @score $rgb(180,180,180) 10 1 100 340 17
  drawrect -rf @score $rgb(180,180,180) 10 3 100 40 15
  drawrect -rf @score $rgb(180,180,180) 10 103 100 40 15
  drawrect -rf @score $rgb(180,180,180) 10 203 100 35 15
  drawrect -rf @score $rgb(180,180,180) 10 303 100 35 15
  drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 10 100 MLB
  drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 110 100 NHL
  drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 210 100 NBA
  drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 310 100 NFL
  drawline -rf @score $rgb(0,0,0) 4 3 1 3 115
  drawline -rf @score $rgb(0,0,0) 4 3 115 339 115
  drawline -rf @score $rgb(0,0,0) 4 339 115 339 100
  drawline -rf @score $rgb(0,0,0) 4 250 98 170 98
  drawline -rf @score $rgb(0,0,0) 4 250 98 338 98
}
menu @score {
  sclick:{
    if ($inrect($mouse.x,$mouse.y,320,6,10,10)) {
      drawline -rf @score $rgb(255,242,0) 2 319 5 331 5
      drawline -rf @score $rgb(255,242,0) 2 319 5 319 17
      drawline -rf @score $rgb(255,242,0) 2 319 17 331 17
      drawline -rf @score $rgb(255,242,0) 2 331 17 331 5
    }
    elseif ($inrect($mouse.x,$mouse.y,3,100,40,15)) {
      drawtext -rob @score $rgb(255,242,0) $rgb(180,180,180) "times new roman" 12 10 100 MLB
      drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 110 100 NHL
      drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 210 100 NBA
      drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 310 100 NFL
      drawline -rf @score $rgb(0,0,0) 4 3 115 339 115
    }
    elseif ($inrect($mouse.x,$mouse.y,110,100,40,15)) {
      drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 10 100 MLB
      drawtext -rob @score $rgb(255,242,0) $rgb(180,180,180) "times new roman" 12 110 100 NHL
      drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 210 100 NBA
      drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 310 100 NFL
      drawline -rf @score $rgb(0,0,0) 4 250 98 170 98
      drawline -rf @score $rgb(0,0,0) 4 250 98 338 98
      sockclose scores.nhl
      set %games 0
      set %write.score 0
      .timerscores off
      .timerrepeat off
      set %i 0
      sockopen scores.nhl sportsillustrated.cnn.com 80
      write -c scores.txt
      drawline -rf @score $rgb(0,0,0) 4 3 115 339 115
    }

    elseif ($inrect($mouse.x,$mouse.y,210,100,40,15)) {
      drawline -rf @score $rgb(0,0,0) 4 3 115 339 115
      drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 10 100 MLB
      drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 110 100 NHL
      drawtext -rob @score $rgb(255,242,0) $rgb(180,180,180) "times new roman" 12 210 100 NBA
      drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 310 100 NFL
      drawline -rf @score $rgb(0,0,0) 4 3 115 339 115
      .timerscores off
      .timerrepeat off
      opennba
      drawline -rf @score $rgb(0,0,0) 4 3 115 339 115
    }
    elseif ($inrect($mouse.x,$mouse.y,303,100,35,15)) {
      drawline -rf @score $rgb(0,0,0) 4 3 115 339 115
      drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 10 100 MLB
      drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 110 100 NHL
      drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 210 100 NBA
      drawtext -rob @score $rgb(255,242,0) $rgb(180,180,180) "times new roman" 12 310 100 NFL
      drawline -rf @score $rgb(0,0,0) 4 3 115 339 115
      sockclose scores
      set %games 0
      set %write.score 0
      .timerscores off
      .timerrepeat off
      set %i 0
      sockopen scores sportsillustrated.cnn.com 80
      write -c scores.txt
      drawline -rf @score $rgb(0,0,0) 4 3 115 339 115
    }
    else {
      move_begin
    }
  }
  mouse:move_ondrag
  drop:{ 
    if ($inrect($mouse.x,$mouse.y,320,6,10,10)) {
      window -c @score
      unset %games
      unset %write.*
      unset %team
      unset %score
      unset %i
      .timerscores off
      .timerrepeat off
    }
    else {
      drawline -rf @score $rgb(0,0,0) 2 319 5 331 5
      drawline -rf @score $rgb(0,0,0) 2 319 5 319 17
      drawline -rf @score $rgb(0,0,0) 2 319 17 331 17
      drawline -rf @score $rgb(0,0,0) 2 331 17 331 5
      move_end

    }
    if ($mouse.key & 1) { move_ondrag } | elseif (%move_dragging) { move_end }
  }
}

alias -l move_begin {
  %move_dragging = 1
  %move_x = $mouse.x
  %move_y = $mouse.y
}

alias -l move_ondrag {
  if (!%move_dragging) { return }
  var %w = @score
  window %w $calc($window(%w).x + $mouse.x - %move_x) $calc($window(%w).y + $mouse.y - %move_y)
}

alias -l move_end unset %move_*
on *:sockopen:scores:{
  sockwrite -n $sockname GET /football/nfl/scoreboards/today/ HTTP/1.1
  sockwrite -n $sockname Host: sportsillustrated.cnn.com
  sockwrite -n $sockname Connection: close
  sockwrite -n $sockname
}
on *:sockread:scores:{
  var %scores.temp
  sockread %scores.temp
  if (%write.time == 1) {
    write scores.txt %scores.temp
    inc %games
    unset %write.time
  }
  elseif (%write.team == 1) {
    set %team $remove($nohtml(%scores.temp),&nbsp;)
    unset %write.team
  }
  elseif (%write.score == 2) {
    set %score $remove($nohtml(%scores.temp),&nbsp;)
    write scores.txt %team - %score
    unset %write.score
  }
  if (*<td class="ScoreTitle" nowrap colspan="3" width="100%">* iswm %scores.temp) {
    set %write.time 1
  }
  elseif (*<td align="left" class="ScoreMData1" noWrap>* iswm %scores.temp) {
    set %write.team 1
  }
  elseif (*<td align="center" class="ScoreMData1" noWrap>* iswm %scores.temp) {
    inc %write.score 1
  }
}
on *:sockclose:scores:{
  inc %i
  drawrect -rf @score 8007982 10 1 1 250 10 251 1 90 100
  drawrect -rf @score $rgb(0,0,0) 10 1 11 170 90
  drawrect -rf @score 16777215 10 171 11 80 90
  drawline -rf @score $rgb(0,0,0) 4 338 1 338 99
  drawline -rf @score $rgb(0,0,0) 4 170 13 250 13
  drawline -rf @score $rgb(0,0,0) 4 250 15 250 99
  drawrect -r @score 8007982 12 320 6 10 10
  drawtext -rob @score $rgb(255,242,0) 8007982 "times new roman" 12 322 2 x
  drawline -rf @score $rgb(0,0,0) 2 319 5 331 5
  drawline -rf @score $rgb(0,0,0) 2 319 5 319 17
  drawline -rf @score $rgb(0,0,0) 2 319 17 331 17
  drawline -rf @score $rgb(0,0,0) 2 331 17 331 5
  drawline -rf @score $rgb(0,0,0) 4 2 1 338 1
  drawrect -rf @score $rgb(180,180,180) 10 1 100 340 17
  drawrect -rf @score $rgb(180,180,180) 10 3 100 40 15
  drawrect -rf @score $rgb(180,180,180) 10 103 100 40 15
  drawrect -rf @score $rgb(180,180,180) 10 203 100 35 15
  drawrect -rf @score $rgb(180,180,180) 10 303 100 35 15
  drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 10 100 MLB
  drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 110 100 NHL
  drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 210 100 NBA
  drawtext -rob @score $rgb(255,242,0) $rgb(180,180,180) "times new roman" 12 310 100 NFL
  drawline -rf @score $rgb(0,0,0) 4 3 1 3 115
  drawline -rf @score $rgb(0,0,0) 4 3 115 339 115
  drawline -rf @score $rgb(0,0,0) 4 339 115 339 100
  drawline -rf @score $rgb(0,0,0) 4 250 98 170 98
  drawline -rf @score $rgb(0,0,0) 4 250 98 338 98
  ;Time
  if ($remove($read(scores.txt, %i),&nbsp;) == $null) {
    drawtext -rob @score $rgb(255,255,255) $rgb(0,0,0) "times new roman" 15 10 45 No Games Today
    return
  }
  drawtext -rob @score $rgb(255,255,255) 8007982 "times new roman" 13 $iif(Final == $remove($read(scores.txt, %i),&nbsp;),276,$iif($len($remove($read(scores.txt, %i),&nbsp;)) =< 10 ,270,258)) 45 $remove($gettok($read(scores.txt, %i),2,59),&nbsp) $remove($gettok($read(scores.txt, %i),4,59),&nbsp)
  inc %i
  ;team1
  drawtext -rob @score $rgb(255,255,255) $rgb(0,0,0) "times new roman" 15 10 21 $gettok($read(scores.txt, %i),1,45)
  ;score1
  if ($gettok($read(scores.txt, %i),2,45) == $null) {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 205 21 -
  }
  else {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 196 21 $gettok($read(scores.txt, %i),2,45)
  }
  inc %i
  ;team2
  drawtext -rob @score $rgb(255,255,255) $rgb(0,0,0) "times new roman" 15 10 61 $gettok($read(scores.txt, %i),1,45)
  ;score2
  if ($gettok($read(scores.txt, %i),2,45) == $null) {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 205 61 -
  }
  else {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 196 61 $gettok($read(scores.txt, %i),2,45)
  }
  $iif(%games == 1,return, .timerscores $calc(%games - 1) 4 /nflalias)
  .timerrepeat 1 $calc(%games * 4) /opennfl
}
alias nflalias {
  inc %i
  drawrect -rf @score 8007982 10 1 1 250 10 251 1 90 100
  drawrect -rf @score $rgb(0,0,0) 10 1 11 170 90
  drawrect -rf @score 16777215 10 171 11 80 90
  drawline -rf @score $rgb(0,0,0) 4 338 1 338 99
  drawline -rf @score $rgb(0,0,0) 4 170 13 250 13
  drawline -rf @score $rgb(0,0,0) 4 250 15 250 99
  drawrect -r @score 8007982 12 320 6 10 10
  drawtext -rob @score $rgb(255,242,0) 8007982 "times new roman" 12 322 2 x
  drawline -rf @score $rgb(0,0,0) 2 319 5 331 5
  drawline -rf @score $rgb(0,0,0) 2 319 5 319 17
  drawline -rf @score $rgb(0,0,0) 2 319 17 331 17
  drawline -rf @score $rgb(0,0,0) 2 331 17 331 5
  drawline -rf @score $rgb(0,0,0) 4 2 1 338 1
  drawrect -rf @score $rgb(180,180,180) 10 1 100 340 17
  drawrect -rf @score $rgb(180,180,180) 10 3 100 40 15
  drawrect -rf @score $rgb(180,180,180) 10 103 100 40 15
  drawrect -rf @score $rgb(180,180,180) 10 203 100 35 15
  drawrect -rf @score $rgb(180,180,180) 10 303 100 35 15
  drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 10 100 MLB
  drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 110 100 NHL
  drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 210 100 NBA
  drawtext -rob @score $rgb(255,242,0) $rgb(180,180,180) "times new roman" 12 310 100 NFL
  drawline -rf @score $rgb(0,0,0) 4 3 1 3 115
  drawline -rf @score $rgb(0,0,0) 4 3 115 339 115
  drawline -rf @score $rgb(0,0,0) 4 339 115 339 100
  drawline -rf @score $rgb(0,0,0) 4 250 98 170 98
  drawline -rf @score $rgb(0,0,0) 4 250 98 338 98
  ;Time
  drawtext -rob @score $rgb(255,255,255) 8007982 "times new roman" 13 $iif(Final == $remove($read(scores.txt, %i),&nbsp;),276,$iif($len($remove($read(scores.txt, %i),&nbsp;)) =< 10 ,270,258)) 45 $remove($gettok($read(scores.txt, %i),2,59),&nbsp) $remove($gettok($read(scores.txt, %i),4,59),&nbsp)
  inc %i
  ;team1
  drawtext -rob @score $rgb(255,255,255) $rgb(0,0,0) "times new roman" 15 10 21 $gettok($read(scores.txt, %i),1,45)
  ;score1
  if ($gettok($read(scores.txt, %i),2,45) == $null) {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 205 21 -
  }
  else {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 $iif($len($gettok($read(scores.txt, %i),2,45)) == 2,198,196) 21 $gettok($read(scores.txt, %i),2,45)
  }
  inc %i
  ;team2
  drawtext -rob @score $rgb(255,255,255) $rgb(0,0,0) "times new roman" 15 10 61 $gettok($read(scores.txt, %i),1,45)
  ;score2
  if ($gettok($read(scores.txt, %i),2,45) == $null) {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 205 61 -
  }
  else {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 196 61 $gettok($read(scores.txt, %i),2,45)
  }
}
on *:sockopen:scores.nhl:{
  sockwrite -n $sockname GET /hockey/nhl/scoreboards/today/ HTTP/1.1
  sockwrite -n $sockname Host: sportsillustrated.cnn.com
  sockwrite -n $sockname Connection: close
  sockwrite -n $sockname
}
on *:sockread:scores.nhl:{
  if ($sockerr > 0) {
    return
  }
  var %scores.temp
  sockread %scores.temp
  if (%write.time == 1) {
    write scores.txt %scores.temp
    inc %games
    unset %write.time
  }
  if (%write.team == 1) {
    set %team $remove($nohtml(%scores.temp),&nbsp;)
    unset %write.team
  }
  if (%write.score == 1) {
    set %score $remove($nohtml(%scores.temp),&nbsp;)
    write scores.txt %team - %score
    unset %write.score
  }
  if (*<td class="ScoreTitle" nowrap colspan="3" width="100%">* iswm %scores.temp) {
    set %write.time 1
  }
  elseif (*<td align="left" class="ScoreMData1" noWrap width="100%">* iswm %scores.temp) {
    set %write.team 1
  }
  elseif (*<td align="right" class="ScoreMData1" noWrap>* iswm %scores.temp) {
    set %write.score 1
  }
}

on *:sockclose:scores.nhl:{
  inc %i
  drawrect -rf @score 8007982 10 1 1 250 10 251 1 90 100
  drawrect -rf @score $rgb(0,0,0) 10 1 11 170 90
  drawrect -rf @score 16777215 10 171 11 80 90
  drawline -rf @score $rgb(0,0,0) 4 338 1 338 99
  drawline -rf @score $rgb(0,0,0) 4 170 13 250 13
  drawline -rf @score $rgb(0,0,0) 4 250 15 250 99
  drawrect -r @score 8007982 12 320 6 10 10
  drawtext -rob @score $rgb(255,242,0) 8007982 "times new roman" 12 322 2 x
  drawline -rf @score $rgb(0,0,0) 2 319 5 331 5
  drawline -rf @score $rgb(0,0,0) 2 319 5 319 17
  drawline -rf @score $rgb(0,0,0) 2 319 17 331 17
  drawline -rf @score $rgb(0,0,0) 2 331 17 331 5
  drawline -rf @score $rgb(0,0,0) 4 2 1 338 1
  drawrect -rf @score $rgb(180,180,180) 10 1 100 340 17
  drawrect -rf @score $rgb(180,180,180) 10 3 100 40 15
  drawrect -rf @score $rgb(180,180,180) 10 103 100 40 15
  drawrect -rf @score $rgb(180,180,180) 10 203 100 35 15
  drawrect -rf @score $rgb(180,180,180) 10 303 100 35 15
  drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 10 100 MLB
  drawtext -rob @score $rgb(255,242,0) $rgb(180,180,180) "times new roman" 12 110 100 NHL
  drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 210 100 NBA
  drawtext -rob @score $rgb(0,0,0) $rgb(180,180,180) "times new roman" 12 310 100 NFL
  drawline -rf @score $rgb(0,0,0) 4 3 1 3 115
  drawline -rf @score $rgb(0,0,0) 4 3 115 339 115
  drawline -rf @score $rgb(0,0,0) 4 339 115 339 100
  drawline -rf @score $rgb(0,0,0) 4 250 98 170 98
  drawline -rf @score $rgb(0,0,0) 4 250 98 338 98
  ;Time
  if ($remove($read(scores.txt, %i),&nbsp;) == $null) {
    drawtext -rob @score $rgb(255,255,255) $rgb(0,0,0) "times new roman" 15 10 45 No Games Today
    return
  }
  drawtext -rob @score $rgb(255,255,255) 8007982 "times new roman" 13 $iif(Final == $remove($read(scores.txt, %i),&nbsp;),276,$iif($len($remove($read(scores.txt, %i),&nbsp;)) <= 10 ,268,262)) 45 $remove($read(scores.txt, %i),&nbsp;)
  inc %i
  ;team1
  drawtext -rob @score $rgb(255,255,255) $rgb(0,0,0) "times new roman" 13 10 21 $gettok($read(scores.txt, %i),1-4,45)
  ;score1
  if ($gettok($read(scores.txt, %i),5,45) == $null) {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 205 21 -
  }
  else {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 $iif($len($gettok($read(scores.txt, %i),5,45)) > 2,202,205) 21 $gettok($read(scores.txt, %i),5,45)
  }
  inc %i
  ;team2
  drawtext -rob @score $rgb(255,255,255) $rgb(0,0,0) "times new roman" 13 10 61 $gettok($read(scores.txt, %i),1-4,45)
  ;score2
  if ($gettok($read(scores.txt, %i),5,45) == $null) {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 205 61 -
  }
  else {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 $iif($len($gettok($read(scores.txt, %i),5,45)) > 2,202,205) 61 $gettok($read(scores.txt, %i),5,45)
  }
  $iif(%games == 1,return, .timerscores $calc(%games - 1) 4 /nhlalias)
  .timerrepeat 1 $calc(%games * 4) /opennhl
}
alias nhlalias {
  inc %i
  drawrect -rf @score 8007982 10 1 1 250 10 251 1 90 100
  drawrect -rf @score $rgb(0,0,0) 10 1 11 170 90
  drawrect -rf @score 16777215 10 171 11 80 90
  drawline -rf @score $rgb(0,0,0) 4 338 1 338 99
  drawline -rf @score $rgb(0,0,0) 4 170 13 250 13
  drawline -rf @score $rgb(0,0,0) 4 250 15 250 99
  drawline -rf @score $rgb(0,0,0) 4 250 99 170 99
  drawline -rf @score $rgb(0,0,0) 4 250 99 338 99
  drawline -rf @score $rgb(0,0,0) 4 3 1 2 11
  drawrect -r @score 8007982 12 320 6 10 10
  drawtext -rob @score $rgb(255,242,0) 8007982 "times new roman" 12 322 2 x
  drawline -rf @score $rgb(0,0,0) 2 319 5 331 5
  drawline -rf @score $rgb(0,0,0) 2 319 5 319 17
  drawline -rf @score $rgb(0,0,0) 2 319 17 331 17
  drawline -rf @score $rgb(0,0,0) 2 331 17 331 5
  drawline -rf @score $rgb(0,0,0) 4 2 1 338 1
  ;Time
  drawtext -rob @score $rgb(255,255,255) 8007982 "times new roman" 13 $iif(Final == $remove($read(scores.txt, %i),&nbsp;),276,$iif($len($remove($read(scores.txt, %i),&nbsp;)) =< 10 ,268,262)) 45 $remove($read(scores.txt, %i),&nbsp;)
  inc %i
  ;team1
  drawtext -rob @score $rgb(255,255,255) $rgb(0,0,0) "times new roman" 13 10 21 $gettok($read(scores.txt, %i),1-4,45)
  ;score1
  if ($gettok($read(scores.txt, %i),5,45) == $null) {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 205 21 -
  }
  else {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 $iif($len($gettok($read(scores.txt, %i),5,45)) > 2,202,205) 21 $gettok($read(scores.txt, %i),5,45)
  }
  inc %i
  ;team2
  drawtext -rob @score $rgb(255,255,255) $rgb(0,0,0) "times new roman" 13 10 61 $gettok($read(scores.txt, %i),1-4,45)
  ;score2
  if ($gettok($read(scores.txt, %i),5,45) == $null) {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 205 61 -
  }
  else {
    drawtext -rob @score $rgb(0,0,0) $rgb(255,255,255) "times new roman" 18 $iif($len($gettok($read(scores.txt, %i),5,45)) > 2,202,205) 61 $gettok($read(scores.txt, %i),5,45)
  }
}