Advertisement
mruno

!NHL 09NOV2014 - Not working

Nov 9th, 2014
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 40.52 KB | None | 0 0
  1. ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. ;script !NHL Script
  3. ;version 09NOV2014
  4. ;author mruno
  5. ;email mruno@ircN.org
  6. ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  7. ;
  8. ;
  9. ;to disable team colors, change alias -l NHL.team.colors return 0
  10. ;to enable team colors, change alias -l NHL.team.colors return 1
  11. ;
  12. ;to enable !scorealert, change alias -l NHL.scorealert.enable return 1
  13. ;to disable !scorealert, change alias -l NHL.scorealert.enable return 0
  14. ;
  15. ;######################################################
  16. ;
  17. alias -l NHL.team.colors return 0
  18. alias -l NHL.scorealert.enable return 1
  19. ;
  20. ;######################################################
  21. ;
  22. ;
  23. alias -l set.correct.network {
  24.   if ($1) {
  25.     var %loop 0
  26.     while ($scon(0) > %loop) {
  27.       inc %loop
  28.       if ($scon(%loop).network == $1) {
  29.         scon %loop
  30.         break
  31.       }
  32.     }
  33.   }
  34. }
  35. on 1:PART:#:{
  36.   if ($hget(NHL.get.scores.NHL.alert,$+($nick,.,$network,.,$chan))) {
  37.     hdel NHL.get.scores.NHL.alert $+($nick,.,$network,.,$chan)
  38.     msg $nick Your NHL ScoreAlert has been deleted for parting.
  39.   }
  40. }
  41. on 1:JOIN:#:if ($timer(NHL.get.scores.NHL.remove.alert. $+ $+($nick,.,$network,.,$chan))) .timerNHL.get.scores.NHL.remove.alert. $+ $+($nick,.,$network,.,$chan) off
  42. on 1:KICK:#:if ($hget(NHL.get.scores.NHL.alert,$+($nick,.,$network,.,$chan))) .timerNHL.get.scores.NHL.remove.alert. $+ $+($nick,.,$network,.,$chan) 1 120 hdel NHL.get.scores.NHL.alert $+($nick,.,$network,.,$chan)
  43. on 1:QUIT:if ($hget(NHL.get.scores.NHL.alert)) hdel -w NHL.get.scores.NHL.alert $nick $+ .*
  44. on 1:NICK:{
  45.   if ($hget(NHL.get.scores.NHL.alert,$+($nick,.,$network,.,$chan))) {
  46.     hadd NHL.get.scores.NHL.alert $newnick $+ . $+ $chan $hget(NHL.get.scores.NHL.alert,$+($nick,.,$network,.,$chan))
  47.     hdel NHL.get.scores.NHL.alert $+($nick,.,$network,.,$chan)
  48.   }
  49. }
  50. on 1:TEXT:?scorealert*:#:{
  51.   if (!$NHL.scorealert.enable) return
  52.   if ($2 != NHL) {
  53.     .timerscorealertNHL 1 2 .notice $nick For NHL scorealerts, Type !scorealert NHL <team>
  54.     halt
  55.   }  
  56.   if ($3 == off) {
  57.     if ($hget(NHL.get.scores.NHL.alert $+($nick,.,$network,.,$chan))) hdel NHL.get.scores.NHL.alert $+($nick,.,$network,.,$chan)
  58.     .notice $nick Deleted your ScoreAlert.
  59.     return
  60.   }
  61.   if ($4 == off) {
  62.     if ($hget(NHL.get.scores.NHL.alert,$+($nick,.,$network,.,$chan))) || ($nick isop $chan) {
  63.       if ($team.lookup($3)) {
  64.         if ($hget(NHL.get.scores.NHL.alert,$+($nick,.,$network,.,$chan))) {
  65.           hdel NHL.get.scores.NHL.alert $+($nick,.,$network,.,$chan)
  66.           .notice $nick Deleted your ScoreAlert for $3
  67.           return
  68.         }
  69.         if ($nick isop $chan) {
  70.           var %a = 0
  71.           while (%a < $hfind(NHL.get.scores.NHL.alert,* $+ $team.lookup($3) $+ *,0,w).data) {
  72.             inc %a
  73.             if ($gettok($hfind(NHL.get.scores.NHL.alert,* $+ $team.lookup($3) $+ *,%a,w).data,2,46) == $chan) {
  74.               hdel NHL.get.scores.NHL.alert $hfind(NHL.get.scores.NHL.alert,* $+ $team.lookup($3) $+ *,%a,w).data
  75.               .notice $nick Deleted ScoreAlert for $3
  76.               return
  77.             }
  78.           }
  79.         }
  80.       }
  81.       else .notice $nick Invalid team name.
  82.     }
  83.     return
  84.   }
  85.   else {
  86.     if (%NHL.get.scores.NHL.ON) || ($hget(NHL.get.scores)) {
  87.       .timerNHL. $+ $nick 1 3 .notice $nick Please try again in 1 minute.
  88.       if (!$timer(NHL.get.scores.NHL.Timeout)) .timerNHL.get.scores.NHL.Timeout 1 15 NHL.get.scores.NHL.Timeout 1
  89.       halt
  90.     }
  91.     if ($3) {
  92.       if ($team.lookup($3)) {
  93.         if ($hget(NHL.get.scores.NHL.alert,$+($nick,.,$network,.,$chan))) .notice $nick Your current scorealert $paren($gettok($v1,1,187)) will be overwritten.
  94.         set %NHL.get.scores.NHL.TEMP.info scorealert
  95.         set %NHL.get.scores.NHL.TEMP.search $team.lookup($3)
  96.         set %NHL.get.scores.NHL.TEMP.chan $chan
  97.         set %NHL.get.scores.NHL.TEMP.nick $nick
  98.  
  99.         NHL.get.scores
  100.       }
  101.       else .notice $nick Invalid team name.
  102.     }
  103.     else .notice $nick Please specify a team.
  104.   }
  105. }
  106. on 1:TEXT:?NHL*:#:{
  107.   set %NHL.get.scores.NHL.TEMP.chan $chan
  108.   set %NHL.get.scores.NHL.TEMP.nick $nick
  109.   if (%NHL.get.scores.NHL.ON) || ($hget(NHL.get.scores)) {
  110.     .timerNHL.spam. $+ nick 1 3 .notice %NHL.get.scores.NHL.TEMP.nick Please try again in 1 minute.
  111.     if (!$timer(NHL.get.scores.NHL.Timeout)) .timerNHL.get.scores.NHL.Timeout 1 15 NHL.get.scores.NHL.Timeout 1
  112.   }
  113.   else {
  114.     if ($2 == all) || ($2 == final) || ($2 == current) || ($2 == upcoming) || ($2 == now) set %NHL.get.scores.NHL.TEMP.info $iif($2 == now,current,$2)
  115.     elseif ($2 == Sunday) || ($2 == Monday) || ($2 == Tuesday) || ($2 == Wednesday) || ($2 == Thursday) || ($2 == Friday) || ($2 == Saturday) || ($2 == Today) || ($2 == Tomorrow) || ($2 == Yesterday) {
  116.       set %NHL.get.scores.NHL.TEMP.info search
  117.       if ($2 == today) set %NHL.get.scores.NHL.TEMP.search $asctime($ctime,dddd)
  118.       elseif ($2 == tomorrow) set %NHL.get.scores.NHL.TEMP.search $asctime($calc(86400 + $ctime),dddd)
  119.       elseif ($2 == yesterday) set %NHL.get.scores.NHL.TEMP.search $asctime($calc($ctime - 86400),dddd)
  120.       else set %NHL.get.scores.NHL.TEMP.search $2
  121.     }
  122.     elseif ($team.lookup($2)) {
  123.       set %NHL.get.scores.NHL.TEMP.info search
  124.       set %NHL.get.scores.NHL.TEMP.search $ifmatch
  125.     }
  126.     elseif (search isin $2) {
  127.       if ($3) {
  128.         if ($3 == today) {
  129.           ;if ($3 == Sunday) || ($3 == Monday) || ($3 == Tuesday) || ($3 == Wednesday) || ($3 == Thursday) || ($3 == Friday) || ($3 == Saturday) || ($3 == Today) || ($3 == Tomorrow) || ($3 == Yesterday) {
  130.           set %NHL.get.scores.NHL.TEMP.info search
  131.           if ($3 == today) set %NHL.get.scores.NHL.TEMP.search $asctime($ctime,dddd)
  132.           elseif ($3 == tomorrow) set %NHL.get.scores.NHL.TEMP.search $asctime($calc(86400 + $ctime),dddd)
  133.           elseif ($3 == yesterday) set %NHL.get.scores.NHL.TEMP.search $asctime($calc($ctime - 86400),dddd)
  134.           else set %NHL.get.scores.NHL.TEMP.search $3
  135.         }
  136.         elseif ($team.lookup($3)) {
  137.           set %NHL.get.scores.NHL.TEMP.info search
  138.           set %NHL.get.scores.NHL.TEMP.search $team.lookup($3)
  139.         }
  140.         else { .notice $nick Invalid search item. Use a team name or city. | halt }
  141.       }
  142.     }
  143.     elseif ($2) { .notice $nick Invalid option or team name. Try $1 Search <team> or $1 Current or $1 Final or $1 Upcoming | halt }
  144.     if (!$2) {
  145.       .timer 1 3 .notice $nick You can also use the following options: Current, Final, or Search <team>. Example: $1 Search Bulls
  146.       .timer 1 3 .notice $nick Or you can have scores messaged to the channel by using: !ScoreAlert NHL <team>
  147.     }
  148.     if (!%NHL.get.scores.NHL.TEMP.info) set %NHL.get.scores.NHL.TEMP.info $iif($2,$2,all)
  149.     set %NHL.get.scores.NHL.TEMP.chan $chan
  150.     set %NHL.get.scores.NHL.TEMP.nick $nick
  151.     NHL.get.scores
  152.   }
  153. }
  154. alias NHL.get.scores.NHL.msg {
  155.   if (%NHL.get.scores.NHL.TEMP.chan) msg %NHL.get.scores.NHL.TEMP.chan $1-
  156. }
  157. alias NHL.get.scores {
  158.   if (%NHL.get.scores.NHL.TEMP.nick) .notice %NHL.get.scores.NHL.TEMP.nick !NHL by mruno gathering data, please wait...
  159.   if ($sock(NHL.get.scores)) sockclose NHL.get.scores
  160.   set -u45 %NHL.get.scores.NHL.ON 1
  161.   if (!$hget(NHL.get.scores)) hmake NHL.get.scores
  162.   sockopen NHL.get.scores scores.covers.com 80
  163.   .timerNHL.get.scores.NHL.Timeout 1 30 NHL.get.scores.NHL.Timeout
  164. }
  165. alias NHL.get.scores.NHL.Timeout {
  166.   if (%NHL.get.scores.NHL.TEMP.info != alert.check) && (!$1) NHL.get.scores.NHL.msg     Error: The NHL request timed out. Please try again later. :(
  167.   NHL.get.scores.NHL.Close
  168. }
  169. alias NHL.get.scores.NHL.alert.check {
  170.   if (!$hget(NHL.get.scores.NHL.options)) hmake NHL.get.scores.NHL.options
  171.   if (!$hget(NHL.get.scores.NHL.options,alert.check)) hadd NHL.get.scores.NHL.options alert.check 1
  172.   else {
  173.     if ($hget(NHL.get.scores.NHL.options,alert.check) > 2) && (!%NHL.get.scores.NHL.ON) {
  174.       ;check for updated scores
  175.       set %NHL.get.scores.NHL.TEMP.info alert.check
  176.       hadd NHL.get.scores.NHL.options alert.check 0
  177.       NHL.get.scores
  178.     }
  179.     else hinc NHL.get.scores.NHL.options alert.check
  180.   }
  181.   if (!$hget(NHL.get.scores.NHL.alert,0).item) {
  182.     .timerNHL.get.scores.NHL.alert off
  183.     hfree NHL.get.scores.NHL.alert
  184.     hfree NHL.get.scores.NHL.options
  185.   }
  186. }
  187. alias NHL.get.scores.NHL.scorealert {
  188.   if (!$1) return
  189.   if (!$hget(NHL.get.scores.NHL.alert)) hmake NHL.get.scores.NHL.alert
  190.   if ($hget(NHL.get.scores.NHL.alert,%NHL.get.scores.NHL.TEMP.nick)) NHL.get.scores.NHL.msg  %NHL.get.scores.NHL.TEMP.nick $+ $chr(44) You can only can track one NHL team at a time.
  191.   else {
  192.     ;team»Current»Today»Now»Oakland at Denver»Pre-game »null:null
  193.     hadd NHL.get.scores.NHL.alert %NHL.get.scores.NHL.TEMP.nick $+ . $+ %NHL.get.scores.NHL.TEMP.chan $+($gettok($1-,1,187),$chr(187),$gettok($1-,7,187))
  194.     NHL.get.scores.NHL.msg 15,1 NHL   Now monitoring:12 $gettok($1-,5,187)   Score:12  $replace( $+ $gettok($1-,7,187),:,$chr(32) to $chr(32),null,0)
  195.     ;.notice %NHL.get.scores.NHL.TEMP.nick If you leave this channel, score alerts will be disabled.
  196.     if (!$timer(NHL.get.scores.NHL.alert)) .timerNHL.get.scores.NHL.alert 0 60 NHL.get.scores.NHL.alert.check
  197.   }
  198. }
  199. alias NHL.get.scores.NHL.End {
  200.   var %a = 0, %item, %items, %team1, %team2, %data
  201.  
  202.   ;scorealert
  203.   if ($hget(NHL.get.scores.NHL.alert)) {
  204.     while ($hget(NHL.get.scores.NHL.alert,0).item > %a) {
  205.       inc %a
  206.       set %item $hget(NHL.get.scores.NHL.alert,%a).item
  207.       set %data $hget(NHL.get.scores.NHL.alert,%a).data
  208.       var %newdata $hget(NHL.get.scores,$hfind(NHL.get.scores,* $+ $gettok(%data,1,187) $+ *,1,w).data)
  209.       if (%newdata) {
  210.         if ($gettok(%newdata,1,187) == final) {
  211.           ;msg final score here
  212.           ;check and see if score alert is still needed
  213.           ;Current»Today»Now»Oakland at Denver»Pre-game »null:null
  214.  
  215.           var %sep $iif(vs isin $gettok(%newdata,4,187),vs,at)
  216.           var %team1 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%newdata,4,187),1- $+ $calc($findtok($gettok(%newdata,4,187),%sep,1,32) - 1),32))
  217.           var %team2 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%newdata,4,187),$calc($findtok($gettok(%newdata,4,187),%sep,1,32) + 1) $+ -,32))
  218.           if (%team isin %team1) var %team0 %team1
  219.           else var %team0 %team2
  220.           set %team1 $remove($strip(%team1),[,],)
  221.           set %team2 $remove($strip(%team2),[,],)
  222.           var %teams, %winner
  223.           if ($gettok($replace($gettok(%newdata,5,187),null,0),1,58) > $gettok($replace($gettok(%newdata,5,187),null,0),2,58)) {
  224.             set %teams  $+ %team1 $+  at %team2 $+ 
  225.             set %winner $strip(%team1)
  226.           }
  227.           elseif ($gettok($replace($gettok(%newdata,5,187),null,0),1,58) < $gettok($replace($gettok(%newdata,5,187),null,0),2,58)) {
  228.             set %teams %team1 at %team2 $+ 
  229.             set %winner $strip(%team2)
  230.           }
  231.           else set %teams %team1 at %team2
  232.           var %rand $rand(1,15)
  233.           .timerScoreAlert. $+ $gettok(%item,2,46) $+ . $+ $replace(%Teams,$chr(32),.) 1 %rand msg $gettok(%item,2,46)   15,1 NHL    4Final: %teams 12Score:2 $replace( $+ $gettok(%newdata,5,187),:,$chr(32) to $chr(32),null,0) 
  234.           .msg $gettok(%item,1,46) 15,1 NHL   4Final: %teams 12Score:2 $replace( $+ $gettok(%newdata,5,187),:,$chr(32) to $chr(32),null,0) 
  235.           hdel NHL.get.scores.NHL.alert %item
  236.         }
  237.         else {
  238.           if ($gettok(%newdata,6,187) != $gettok(%data,2,187)) {
  239.             var %sep $iif(vs isin $gettok(%newdata,4,187),vs,at)
  240.             var %team1 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%newdata,4,187),1- $+ $calc($findtok($gettok(%newdata,4,187),%sep,1,32) - 1),32))
  241.             var %team2 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%newdata,4,187),$calc($findtok($gettok(%newdata,4,187),%sep,1,32) + 1) $+ -,32))
  242.             if (%team isin %team1) var %team0 %team1
  243.             else var %team0 %team2
  244.             set %team1 $remove($strip(%team1),[,],)
  245.             set %team2 $remove($strip(%team2),[,],)
  246.             var %teams
  247.             if ($gettok($replace($gettok(%newdata,6,187),null,0),1,58) > $gettok($replace($gettok(%newdata,6,187),null,0),2,58)) set %teams  $+ %team1 $+  at %team2 $+ 
  248.             elseif ($gettok($replace($gettok(%newdata,6,187),null,0),1,58) < $gettok($replace($gettok(%newdata,6,187),null,0),2,58)) set %teams %team1 at  $+ %team2 $+ 
  249.             else set %teams %team1 at %team2
  250.  
  251.             .timerScoreAlert. $+ $gettok(%item,2,46) $+ . $+ $replace(%Teams,$chr(32),.) 1 $rand(1,10) msg $gettok(%item,2,46)   4[!ScoreAlert] 15,1 NHL   %teams  12 New Score:2 $replace( $+ $gettok(%newdata,6,187),:,$chr(32) to $chr(32),null,0)  14 Status:3 $gettok(%newdata,5,187) 
  252.             hadd NHL.get.scores.NHL.alert %item $gettok(%data,1,187) $+ $chr(187) $+ $gettok(%newdata,6,187)
  253.           }
  254.         }
  255.       }
  256.     }
  257.   }
  258.   if (%NHL.get.scores.NHL.TEMP.info == alert.check) {
  259.     if ($hget(NHL.get.scores)) hfree NHL.get.scores
  260.     unset %NHL.get.scores*
  261.     sockclose NHL.get.scores
  262.     return
  263.   }
  264.  
  265.   if (%NHL.get.scores.NHL.TEMP.info == scorealert) && (%NHL.get.scores.NHL.TEMP.search) {
  266.     if ($hget(NHL.get.scores,$hfind(NHL.get.scores,*current* $+ %NHL.get.scores.NHL.TEMP.search $+ *,1,w).data)) {
  267.       NHL.get.scores.NHL.scorealert %NHL.get.scores.NHL.TEMP.search $+ $chr(187) $+ $ifmatch
  268.       .notice %NHL.get.scores.NHL.TEMP.nick Your ScoreAlert will be disabled if you leave %NHL.get.scores.NHL.TEMP.chan or by typing 12!ScoreAlert NHL off 
  269.     }
  270.     else NHL.get.scores.NHL.msg %NHL.get.scores.NHL.TEMP.nick $+ $chr(44) please choose an NHL game that is currently playing. $iif($hfind(NHL.get.scores,*upcoming* $+ %NHL.get.scores.NHL.TEMP.search $+ *,1,w).data,%NHL.get.scores.NHL.TEMP.search plays on12 $gettok($hget(NHL.get.scores,$ifmatch),2,187) at $gettok($hget(NHL.get.scores,$ifmatch),3,187)) 
  271.   }
  272.   ;team search
  273.   if (%NHL.get.scores.NHL.TEMP.info == search) && (%NHL.get.scores.NHL.TEMP.search) {
  274.     var %a = 0, %item, %items, %team0, %team1, %team2, %team = %NHL.get.scores.NHL.TEMP.search
  275.     set %item $hget(NHL.get.scores,$hfind(NHL.get.scores,* $+ %team $+ *,1,w).data)
  276.     if (!%item) set %item $hget(NHL.get.scores,$hfind(NHL.get.scores,* $+ $left(%team,3) $+ *,1,w).data)
  277.     if (!%item) {
  278.       NHL.get.scores.NHL.msg   Sorry, there are no NHL games found for: %team :(
  279.       NHL.get.scores.NHL.Close
  280.       return
  281.     }
  282.     if (%team == Sun) || (%team == Sunday) || (%team == Mon) || (%team == Monday) || (%team == Tue) || (%team == Tuesday) || (%team == Wed) || (%team == Wednesday) || (%team == Thu) || (%team == Thursday) || (%team == Fri) || (%team == Friday) || (%team == Sat) || (%team == Saturday) || (%team == Today) || (%team == Tomorrow) || (%team == Yesterday) {
  283.       ;Day Search
  284.       set %abbr $left(%team,3)
  285.       var %a = 0, %games, %temp
  286.  
  287.       while ($hfind(NHL.get.scores,* $+ %abbr $+ *,0,w).data > %a) {
  288.         inc %a
  289.         if (%a == 1) NHL.get.scores.NHL.msg 15,1 NHL  $gettok(%item,2,187) $+ :
  290.         set %temp $gettok($hfind(NHL.get.scores,* $+ %abbr $+ *,%a,w).data,2,46)
  291.         if ($len(%temp) == 1) set %temp 0 $+ %temp
  292.         set %games $addtok(%temp,%games,32)
  293.       }
  294.       set %games $sorttok(%games,32)
  295.       set %a 0
  296.       var %game
  297.       while ($gettok(%games,0,32) > %a) {
  298.         inc %a
  299.         set %game NHL. $+ $iif($left($gettok(%games,%a,32),1) == 0,$right($gettok(%games,%a,32),1),$gettok(%games,%a,32))
  300.         set %item $hget(NHL.get.scores,%game)
  301.         if ($gettok(%item,1,187) == Upcoming) NHL.get.scores.NHL.upcoming %item
  302.         elseif ($gettok(%item,1,187) == Final) {
  303.           NHL.get.scores.NHL.final %item
  304.         }
  305.         elseif ($gettok(%item,1,187) == Current) {
  306.           NHL.get.scores.NHL.current %item
  307.         }
  308.       }
  309.  
  310.       ;end of loop
  311.     }
  312.     elseif ($gettok(%item,1,187) == upcoming) {
  313.       set %team %NHL.get.scores.NHL.TEMP.search
  314.       var %sep $iif(vs isin $gettok(%item,4,187),vs,at)
  315.       set %team1 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),1- $+ $calc($findtok($gettok(%item,4,187),%sep,1,32) - 1),32))
  316.       set %team2 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),$calc($findtok($gettok(%item,4,187),%sep,1,32) + 1) $+ -,32))
  317.       if (%team isin %team1) set %team0 %team1
  318.       else set %team0 %team2
  319.       var %consensus
  320.       if ($chr(37) isin $remove($gettok(%item,7,187),$chr(32))) {
  321.         if ($remove($gettok(%item,7,187),$chr(32)) == $remove($gettok(%item,9,187),$chr(32))) set %consensus Dead Even
  322.         elseif ($remove($gettok(%item,7,187),$chr(37)) > $remove($gettok(%item,9,187),$chr(37))) set %consensus  $+ $remove($gettok($strip(%team1),$iif(!$team.colors,-1,-2),32),]) $+  $paren($remove($gettok(%item,7,187),$chr(32))) 14over $remove($gettok($strip(%team2),$iif(!$team.colors,-1,-2),32),]) $paren($remove($gettok(%item,9,187),$chr(32)))
  323.         elseif ($remove($gettok(%item,7,187),$chr(37)) < $remove($gettok(%item,9,187),$chr(37))) set %consensus  $+ $remove($gettok($strip(%team2),$iif(!$team.colors,-1,-2),32),]) $+  $paren($remove($gettok(%item,9,187),$chr(32))) 14over $remove($gettok($strip(%team1),$iif(!$team.colors,-1,-2),32),]) $paren($remove($gettok(%item,7,187),$chr(32)))
  324.       }
  325.       NHL.get.scores.NHL.msg  15,1 NHL    %team0 14Record:12 $iif($gettok($gettok(%item,$iif($gettok(%team,0,32) == 1,4,4-5),187),1,32) isin $strip(%team0),$gettok(%item,6,187),$gettok(%item,$iif(%consensus,8,7),187))
  326.       NHL.get.scores.NHL.msg     14Next game:12 $gettok(%item,4,187) 14 $paren( $+ $gettok(%item,2,187) @ $gettok(%item,3,187) $+ 14) $iif(%consensus,14Consensus: %consensus)
  327.     }
  328.     elseif ($gettok(%item,1,187) == final) {
  329.       var %sep $iif(vs isin $gettok(%item,4,187),vs,at)
  330.       set %team1 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),1- $+ $calc($findtok($gettok(%item,4,187),%sep,1,32) - 1),32))
  331.       set %team2 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),$calc($findtok($gettok(%item,4,187),%sep,1,32) + 1) $+ -,32))
  332.       if (%team isin %team1) set %team0 %team1
  333.       else set %team0 %team2
  334.       set %team1 $remove($strip(%team1),[,],)
  335.       set %team2 $remove($strip(%team2),[,],)
  336.       var %teams
  337.       if ($gettok($replace($gettok(%item,5,187),null,0),1,58) > $gettok($replace($gettok(%item,5,187),null,0),2,58)) set %teams  $+ %team1 $+  at %team2 $+ 
  338.       elseif ($gettok($replace($gettok(%item,5,187),null,0),1,58) < $gettok($replace($gettok(%item,5,187),null,0),2,58)) set %teams %team1 at %team2 $+ 
  339.       else set %teams %team1 at %team2
  340.       NHL.get.scores.NHL.msg  15,1 NHL    %team0 Last game:12 $gettok(%item,2,187)
  341.       NHL.get.scores.NHL.msg         %teams  - Score: $replace($gettok(%item,5,187),null,0,:,$chr(32) to $chr(32)) - $paren(12FINAL) 
  342.     }
  343.     elseif ($gettok(%item,1,187) == current) {
  344.       set %team1 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),1- $+ $calc($findtok($gettok(%item,4,187),%sep,1,32) - 1),32))
  345.       set %team2 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),$calc($findtok($gettok(%item,4,187),%sep,1,32) + 1) $+ -,32))
  346.       if (%team isin %team1) set %team0 %team1
  347.       else set %team0 %team2
  348.       set %team1 $remove($strip(%team1),[,],)
  349.       set %team2 $remove($strip(%team2),[,],)
  350.       var %teams
  351.       if ($gettok($replace($gettok(%item,5,187),null,0),1,58) > $gettok($replace($gettok(%item,5,187),null,0),2,58)) set %teams  $+ %team1 $+  at %team2 $+ 
  352.       elseif ($gettok($replace($gettok(%item,5,187),null,0),1,58) < $gettok($replace($gettok(%item,5,187),null,0),2,58)) set %teams %team1 at %team2 $+ 
  353.       else set %teams %team1 at %team2
  354.  
  355.       NHL.get.scores.NHL.msg  15,1 NHL    %team0 14Currently playing: $replace($gettok(%item,4,187),at,14@)
  356.       NHL.get.scores.NHL.msg      14Score:12 $replace($gettok(%item,6,187),null,0,:,$chr(32) to $chr(32))  14Status:12 $gettok(%item,5,187) $iif(%NHL.get.scores.NHL.TEMP.GameStatus,- %NHL.get.scores.NHL.TEMP.GameStatus)
  357.     }
  358.   }
  359.  
  360.   if (%NHL.get.scores.NHL.TEMP.info == all) || (%NHL.get.scores.NHL.TEMP.info == current) {
  361.     ;gathers all the CURRENT games
  362.     while (%a < $hget(NHL.get.scores,0).item) {
  363.       inc %a
  364.       set %item $hget(NHL.get.scores,%a).item
  365.       if ($gettok($hget(NHL.get.scores,%item),1,187) == Current) set %items $addtok(%items,%item,44)
  366.     }
  367.     ;echoes all the CURRENT games
  368.     ;Current»Today»Now»Oakland at Denver»Pre-game »null:null
  369.  
  370.     set %a 0
  371.     set %item
  372.     if (%items) {
  373.       NHL.get.scores.NHL.msg 15,1 NHL   Games 12currently playing:
  374.       while (%a < $gettok(%items,0,44)) {
  375.         inc %a
  376.         ;if (%a == 1) NHL.get.scores.NHL.msg  15,1 NHL 
  377.         set %item $hget(NHL.get.scores,$gettok(%items,%a,44))
  378.         NHL.get.scores.NHL.current %item
  379.       }
  380.     }
  381.     else {
  382.       if (%NHL.get.scores.NHL.TEMP.info == current) NHL.get.scores.NHL.msg There are currently no NHL games being played.
  383.     }
  384.   }
  385.  
  386.   if (%NHL.get.scores.NHL.TEMP.info == all) || (%NHL.get.scores.NHL.TEMP.info == final) {
  387.     ;gathers all the FINAL games
  388.  
  389.     ;Final»Thursday September 19 2013»0»Kansas City at Philadelphia »26:16
  390.  
  391.     set %a 0
  392.     set %item
  393.     set %items
  394.     while (%a < $hget(NHL.get.scores,0).item) {
  395.       inc %a
  396.       set %item $hget(NHL.get.scores,%a).item
  397.       if ($gettok($hget(NHL.get.scores,%item),1,187) == FINAL) set %items $addtok(%items,%item,44)
  398.     }
  399.     ;echoes all the FINAL games
  400.     set %a 0
  401.     set %item
  402.     if (%items) {
  403.       while (%a < $gettok(%items,0,44)) {
  404.         inc %a
  405.         set %item $hget(NHL.get.scores,$gettok(%items,%a,44))
  406.         ;if (%a == 1) NHL.get.scores.NHL.msg  15,1 NHL 
  407.         NHL.get.scores.NHL.final %item
  408.       }
  409.     }
  410.     else {
  411.       if (%NHL.get.scores.NHL.TEMP.info == final) NHL.get.scores.NHL.msg There are currently no NHL final games for this week.
  412.     }
  413.   }
  414.   if (%NHL.get.scores.NHL.TEMP.info == all) || (%NHL.get.scores.NHL.TEMP.info == upcoming) {
  415.     ;    Upcoming»Monday September 23 2013»8:40p ET»Oakland at Denver» »1-1 (0-1 V) »36% »2-0 (1-0 H) »64%
  416.     var %a = 1, %data, %last, %item, %total = 0
  417.     while ($hget(NHL.get.scores,NHL. $+ %a)) {
  418.       set %data $hget(NHL.get.scores,NHL. $+ %a)
  419.       if (upcoming isin $gettok(%data,1,187)) {
  420.         if (%last != $gettok(%data,2,187)) NHL.get.scores.NHL.msg 15,1 NHL   $gettok(%data,2,187) $+ :
  421.         inc %total
  422.         NHL.get.scores.NHL.upcoming %data
  423.       }
  424.       set %last $gettok(%data,2,187)
  425.       inc %a
  426.     }
  427.     if (!%total) && (%NHL.get.scores.NHL.TEMP.info == upcoming) NHL.get.scores.NHL.msg There are no more NHL upcoming games for this week.
  428.   }
  429.   .timerNHL.get.scores.NHL.Close 1 15 NHL.get.scores.NHL.Close
  430. }
  431. alias NHL.get.scores.NHL.final {
  432.   if (!$1) return
  433.   var %item = $1-, %team1, %team2
  434.   var %sep $iif(vs isin $gettok(%item,4,187),vs,at)
  435.   set %team1 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),1- $+ $calc($findtok($gettok(%item,4,187),%sep,1,32) - 1),32))
  436.   set %team2 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),$calc($findtok($gettok(%item,4,187),%sep,1,32) + 1) $+ -,32))
  437.  
  438.   var %teams
  439.   if ($gettok($replace($gettok(%item,5,187),null,0),1,58) > $gettok($replace($gettok(%item,5,187),null,0),2,58)) set %teams  $+ %team1 $+  14@ %team2 $+ 
  440.   elseif ($gettok($replace($gettok(%item,5,187),null,0),1,58) < $gettok($replace($gettok(%item,5,187),null,0),2,58)) set %teams %team1 14@  $+ %team2 $+ 
  441.   else set %teams %team1 14@ %team2
  442.  
  443.   NHL.get.scores.NHL.msg       %teams  14 Score:12 $replace($gettok(%item,5,187),null,0,:,$chr(32) 14to12 $chr(32))  14 Status:4 FINAL 
  444. }
  445. alias NHL.get.scores.NHL.upcoming {
  446.   if (!$1) return
  447.   var %item $1-
  448.   var %sep $iif(vs isin $gettok(%item,4,187),vs,at)
  449.   var %team1 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),1- $+ $calc($findtok($gettok(%item,4,187),%sep,1,32) - 1),32))
  450.   var %team2 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),$calc($findtok($gettok(%item,4,187),%sep,1,32) + 1) $+ -,32))
  451.  
  452.   var %consensus
  453.   if ($chr(37) isin $remove($gettok(%item,7,187),$chr(32))) {
  454.     if ($remove($gettok(%item,7,187),$chr(32)) == $remove($gettok(%item,9,187),$chr(32))) set %consensus Dead Even
  455.     elseif ($remove($gettok(%item,7,187),$chr(37)) > $remove($gettok(%item,9,187),$chr(37))) set %consensus  $+ $remove($gettok($strip(%team1),$iif(!$team.colors,-1,-2),32),]) $+  $paren($remove($gettok(%item,7,187),$chr(32))) $+  14over $remove($gettok($strip(%team2),$iif(!$team.colors,-1,-2),32),]) $paren($remove($gettok(%item,9,187),$chr(32))) 
  456.     elseif ($remove($gettok(%item,7,187),$chr(37)) < $remove($gettok(%item,9,187),$chr(37))) set %consensus  $+ $remove($gettok($strip(%team2),$iif(!$team.colors,-1,-2),32),]) $+  $paren($remove($gettok(%item,9,187),$chr(32))) $+  14over $remove($gettok($strip(%team1),$iif(!$team.colors,-1,-2),32),]) $paren($remove($gettok(%item,7,187),$chr(32))) 
  457.   }
  458.   NHL.get.scores.NHL.msg       $gettok(%item,3,187)  %team1 $paren($gettok($gettok(%item,6,187),1,32)) 14@ %team2 $paren($gettok($gettok(%item,$iif(%consensus,8,7),187),1,32)) $iif(%consensus,14 Consensus: %consensus)
  459. }
  460. alias NHL.get.scores.NHL.current {
  461.   if (!$1) return
  462.   var %item = $1-, %team1, %team2
  463.   var %sep $iif(vs isin $gettok(%item,4,187),vs,at)
  464.   set %team1 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),1- $+ $calc($findtok($gettok(%item,4,187),%sep,1,32) - 1),32))
  465.   set %team2 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),$calc($findtok($gettok(%item,4,187),%sep,1,32) + 1) $+ -,32))
  466.   var %teams
  467.   var %team1score $gettok($replace($gettok(%item,6,187),null,0),1,58)
  468.   var %team2score $gettok($replace($gettok(%item,6,187),null,0),2,58)
  469.   if (%team1score > %team2score) set %teams  $+ %team1 14@ %team2 
  470.   elseif (%team1score < %team2score) set %teams %team1 14@  $+ %team2 
  471.   else set %teams %team1 14@ %team2
  472.   NHL.get.scores.NHL.msg       %teams 14 14Score: $replace($gettok(%item,6,187),null,0,:,$chr(32) to $chr(32))  14 Status:3 $gettok(%item,5,187) $iif($gettok(%item,7,187),- $gettok(%item,7,187)) 
  473. }
  474. alias NHL.get.scores.NHL.Sorted {
  475.   if ($1) {
  476.     ;sorts items by putting all the dates in hash tables
  477.     var %z = 0, %new
  478.     while ($hget(NHL.get.scores,0).item > %z) {
  479.       inc %z
  480.       if (NHL. isin $hget(NHL.get.scores,%z).item) set %new $addtok(%new,$v2,44)
  481.     }
  482.     set %z 0
  483.     var %data, %time, %data2, %all, %item
  484.     while ($gettok(%items,0,44) > %z) {
  485.       inc %z
  486.       set %item $gettok(%items,%z,44)
  487.       set %data $hget(NHL.get.scores,%item)
  488.       set %new $gettok(%data,2,187) $+ . $+ $gettok(%data,3,187)
  489.       set %data2 %new
  490.       set %time $remove($gettok(%data2,2,46),p,a,et)
  491.       set %time $calc($calc($gettok(%time,1,58) * 360) + $calc($gettok(%time,2,58) * 60))
  492.       set %time $calc($ctime($gettok(%data2,1,46)) + %time)
  493.       hadd NHL.get.scores %time $addtok($hget(NHL.get.scores,%time),%item,44)
  494.     }
  495.  
  496.     var %z = 0
  497.     set %new
  498.     while ($hget(NHL.get.scores,0).item > %z) {
  499.       inc %z
  500.       if (NHL. !isin $hget(NHL.get.scores,%z).item) set %new $addtok(%new,$v2,44)
  501.     }
  502.     return $sorttok(%new,44,n)
  503.   }
  504. }
  505. alias NHL.get.scores.NHL.Close {
  506.   sockclose NHL.get.scores
  507.   unset %NHL.get.scores.NHL.TEMP.*
  508.   .timerhfree.NHL.get.scores 1 30 if ($hget(NHL.get.scores)) hfree NHL.get.scores
  509. }
  510. alias -l useragent {
  511.   var %r $rand(1,11)
  512.   if (%r == 1) return User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
  513.   elseif (%r == 2) return User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6
  514.   elseif (%r == 3) return User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)
  515.   elseif (%r == 4) return User-Agent: Opera/9.20 (Windows NT 6.0; U; en)
  516.   elseif (%r == 5) return User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20060127 Netscape/8.1
  517.   elseif (%r == 6) return User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2
  518.   elseif (%r == 7) return User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; da-dk) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1
  519.   elseif (%r == 8) return User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.2; WOW64; rv:1.8.0.7) Gecko/20110321 MultiZilla/4.33.2.6a SeaMonkey/8.6.55
  520.   elseif (%r == 9) return User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36
  521.   elseif (%r == 10) return User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.67 Safari/537.36
  522.   elseif (%r == 11) return User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0
  523. }
  524. on *:sockopen:NHL.get.scores: {
  525.   sockwrite -nt $sockname GET /hockey-scores-matchups.aspx HTTP/1.1
  526.   sockwrite -nt $sockname $useragent
  527.   sockwrite -nt $sockname Host: scores.covers.com
  528.   sockwrite -nt $sockname Accept-Language: en-us
  529.   sockwrite -nt $sockname Accept: */*
  530.   sockwrite -nt $sockname $crlf
  531. }
  532. on *:sockread:NHL.get.scores: {
  533.   var %temp, %date, %item, %data
  534.   if ($sockerr) {
  535.     var %error
  536.     if ($sockerr == 3) set %error Connection refused by remote host
  537.     elseif ($sockerr == 4) set %error DNS lookup for hostname failed
  538.     elseif ($sockerr > 0) set %error Unknown socket error ( $+ $sockerr $+ )
  539.     echo -s NHL.get.scores:     4Socket Error: %error
  540.     .timerNHL.get.scores.NHL.error 1 10 NHL.get.scores.NHL.msg     15,1 NHL   Socket Error. Please try again later. :(
  541.     .timerNHL.get.scores.NHL.close 1 15 NHL.get.scores.NHL.close
  542.     halt
  543.   }
  544.   else {
  545.     .timerNHL.get.scores.NHL.Timeout off
  546.     sockread %temp
  547.  
  548.     ;STATUS»DATE»TIME»TEAMS»STATUS»SCORE(Away:Home)»Game Status
  549.  
  550.     ;new date for NHL games
  551.     ;<h2><div ID="DayNav" class="date-nav"><a href="javascript:void(0);" onclick="javascript:ClientUpdateCalAndNav(9,&#39;2014-2015&#39;,2014,11,7);">Fri, Nov 7</a>&nbsp;&nbsp;&#8226;&nbsp;<a><b>Sat, Nov 8</b></a>&nbsp;&nbsp;&#8226;&nbsp;<a href="javascript:void(0);" onclick="javascript:ClientUpdateCalAndNav(9,&#39;2014-2015&#39;,2014,11,9);">Sun, Nov 9</a></div></h2>
  552.     ;$wildtok(%test,nbsp;<a><b>*</b></a>,1,38)
  553.     if (<h2><div ID="DayNav" class="date-nav"><a href="javascript:void(0);" onclick="javascript:ClientUpdateCalAndNav isin %temp) && (%date != $striphtml(%temp)) {
  554.       set %NHL.get.scores.NHL.TEMP.DATE $remove($striphtml($wildtok(%test,nbsp;<a><b>*</b></a>,1,38)),nbsp;)
  555.     }
  556.     elseif (*<span class="activetab" id="In_Game_Status_6_*">Final</span>* iswm %temp) set %NHL.get.scores.NHL.TEMP.DATE Final
  557.     else set %NHL.get.scores.NHL.TEMP.DATE Today
  558.  
  559.     ;if (<td colspan="2" class="scoreboard-left"><h2> isin %temp) && (%date != $striphtml(%temp)) set %NHL.get.scores.NHL.TEMP.DATE $remove($striphtml(%temp),$chr(44))
  560.  
  561.     if (*<td class="scoreboard-*">* iswm %temp) {
  562.       if ($striphtml(%temp)) {
  563.         if (!$hget(NHL.get.scores)) hmake NHL.get.scores
  564.         ;In_Game_Status_6_
  565.         unset %NHL.get.scores.NHL.TEMP.GameStatus
  566.         set %item $striphtml(%temp)
  567.  
  568.         set %NHL.get.scores.NHL.TEMP.title $gettok($wildtok(%temp,*Title_6_*,1,60),2,62)
  569.  
  570.         if (Final isin %item) {
  571.           ;Game Over
  572.           set %NHL.get.scores.NHL.TEMP.STATUS Final
  573.           hadd NHL.get.scores NHL. $+ $calc($hget(NHL.get.scores,0).item + 1) $+(Final,$chr(187),%NHL.get.scores.NHL.TEMP.DATE,$chr(187),0,$chr(187),$gettok($wildtok(%temp,*Title_6_*,1,60),2,62))
  574.         }
  575.         elseif (*AM ET* iswm %item) || (*PM ET* iswm %item) {
  576.           ;Game Upcoming
  577.           set %NHL.get.scores.NHL.TEMP.STATUS Upcoming
  578.           hadd NHL.get.scores NHL. $+ $calc($hget(NHL.get.scores,0).item + 1) $+(Upcoming,$chr(187),%NHL.get.scores.NHL.TEMP.DATE,$chr(187),$replace($remove($gettok($wildtok(%temp,*span class="pretab">*,1,60),2,62),$chr(32)),pmET,p ET,amET,a ET),$chr(187),$gettok($wildtok(%temp,*Title_6_*,1,60),2,62),$chr(187))
  579.         }
  580.         else {
  581.           ;Game is ON!
  582.           set %NHL.get.scores.NHL.TEMP.STATUS Current
  583.           hadd NHL.get.scores NHL. $+ $calc($hget(NHL.get.scores,0).item + 1) $+(Current,$chr(187),$asctime($ctime,dddd),$chr(187),Now,$chr(187),$gettok($wildtok(%temp,*Title_6_*,1,60),2,62),$chr(187),$gettok($wildtok(%temp,*In_Game_Status_6_*,1,60),2,62))
  584.  
  585.         }
  586.       }
  587.     }
  588.   }
  589.   ;if (*<td class="datac" id="*Score_6* iswm %temp) {
  590.   if (<td class="datarcb isin %temp) {
  591.     if (%NHL.get.scores.NHL.TEMP.STATUS == Current) || (%NHL.get.scores.NHL.TEMP.STATUS == Final) {
  592.       var %i $hfind(NHL.get.scores,* $+ %NHL.get.scores.NHL.TEMP.title $+ *,1,w).data
  593.  
  594.       if (VisitScore isin %temp) {
  595.         hadd NHL.get.scores %i $hget(NHL.get.scores,%i) $+($chr(187),$iif(!$striphtml(%temp),null,$remove($striphtml(%temp),$chr(32))),:)
  596.       }
  597.       elseif (HomeScore isin %temp) {
  598.         hadd NHL.get.scores %i $hget(NHL.get.scores,%i) $+ $iif(!$striphtml(%temp),null,$remove($striphtml(%temp),$chr(32)))
  599.       }
  600.     }
  601.   }
  602.   if (%NHL.get.scores.NHL.TEMP.STATUS == Upcoming) && ($striphtml(%temp)) {
  603.     var %i $hfind(NHL.get.scores,* $+ %NHL.get.scores.NHL.TEMP.title $+ *,1,w).data
  604.     ;if (*<td class="data">*-* (*-* ?)</td>* iswm %temp) hadd NHL.get.scores %i $hget(NHL.get.scores,%i) $+($chr(187),$striphtml(%temp))
  605.     if (*<td class="data">*(*)*</td>* iswm %temp) {
  606.       hadd NHL.get.scores %i $hget(NHL.get.scores,%i) $+($chr(187),$striphtml(%temp))
  607.     }
  608.  
  609.     if (*<td class="datac">*%</td>* iswm %temp) {
  610.       ;consensus
  611.       ;<td class="datac">68%</td>
  612.       hadd NHL.get.scores %i $hget(NHL.get.scores,%i) $+($chr(187),$striphtml(%temp))
  613.     }
  614.   }
  615.   .timerNHL.get.scores.NHL.End 1 3 NHL.get.scores.NHL.End
  616. }
  617.  
  618. alias NHL.get.scores.NHL.teamcolors {
  619.   if (!$1) return
  620.   var %a
  621.   if ($1- ==  Tampa Bay) set %a 0,3[ $v1 Lightning ]
  622.   elseif (Montreal isin $1-) set %a 1,0[ $v1 Canadiens ]
  623.   elseif (Detroit isin $1-) set %a 7,12[ $v1 Red Wings ]
  624.   elseif (Boston isin $1-) set %a 12,0[ $v1 Bruins ]
  625.   elseif (Ottawa isin $1-) set %a 4,1[ $v1 Senators ]
  626.   elseif (Toronto isin $1-) set %a 1,4[ $v1 Maple Leafs ]
  627.   elseif (Florida isin $1-) set %a 7,12[ $v1 Panthers ]
  628.   elseif (Buffalo isin $1-) set %a 0,7[ $v1 Sabres ]
  629.   elseif (Pittsburgh isin $1-) set %a 8,12[ $v1 Penguins ]
  630.   elseif (N.Y. Islanders isin $1-) || (New York Islanders isin $1-) || (N. Y. Islanders isin $1-) || (NY Islanders isin $1-) set %a 7,3[ NY Islanders ]
  631.   elseif (N.Y. Rangers isin $1-) || (New York Rangers isin $1-) || (N. Y. Rangers isin $1-) || (NY Rangers isin $1-) set %a 7,12[ NY Rangers ]
  632.   elseif (Philadelphia isin $1-) set %a 1,11[ $v1 Flyers ]
  633.   elseif (New Jersey isin $1-) set %a 1,7[ $v1 Devils ]
  634.   elseif (Carolina isin $1-) set %a 1,11[ $v1 Hurricanes ]
  635.   elseif (Washington isin $1-) set %a 7,2[ $v1 Capitals ]
  636.   elseif (Dallas isin $1-) set %a 0,2[ $v1 Stars ]
  637.   elseif (Columbus isin $1-) set %a 4,0[ $v1 Blue Jackets ]
  638.   elseif (St. Louis isin $1-) set %a 10,1[ $v1 Blues ]
  639.   elseif (Nashville isin $1-) set %a 8,2[ $v1 Predators ]
  640.   elseif (Winnipeg isin $1-) set %a 15,1[ $v1 Jets ]
  641.   elseif (Chicago isin $1-) set %a 7,10[ $v1 Black Hawks ]
  642.   elseif (Minnesota isin $1-) set %a 11,14[ $v1 Wild ]
  643.   elseif (Colorado isin $1-) set %a 11,7[ $v1 Avalanche ]
  644.   elseif (Anaheim isin $1-) set %a 7,1[ $v1 Ducks ]
  645.   elseif (Vancouver isin $1-) set %a 8,2[ $v1 Canucks ]
  646.   elseif (Calgary isin $1-) set %a 8,12[ $v1 Flames ]
  647.   elseif (San Jose isin $1-) set %a 8,12[ $v1 Sharks ]
  648.   elseif (Los Angeles isin $1-) || (Los Angeles Kings isin $1-) || (L.A. Kings isin $1-) || (LA Kings isin $1-) || (L. A. Kings isin $1-) set %a 2,4[ Los Angeles Kings ]
  649.   elseif (Arizona isin $1-) set %a 7,1[ $v1 Coyotes ]
  650.   elseif (Edmonton isin $1-) set %a 6,15[ $v1 Oilers ]
  651.   else {
  652.     iecho 4ERROR UNKNOWN NHL TEAM: $1-
  653.     return
  654.   }
  655.  
  656.   if (!$team.colors) return 12 $+ $remove($strip(%a),[,]) $+ 
  657.   else return %a
  658. }
  659.  
  660. alias -l team.lookup {
  661.   if (!$1) return
  662.   var %a
  663.   if (Tampa Bay isin $1-) set %a $v1
  664.   elseif (Montreal isin $1-) set %a $v1
  665.   elseif (Detroit isin $1-) set %a $v1
  666.   elseif (Boston isin $1-) set %a $v1
  667.   elseif (Ottawa isin $1-) set %a $v1
  668.   elseif (Toronto isin $1-) set %a $v1
  669.   elseif (Florida isin $1-) set %a $v1
  670.   elseif (Buffalo isin $1-) set %a $v1
  671.   elseif (Pittsburgh isin $1-) set %a $v1
  672.   elseif (Philadelphia isin $1-) set %a $v1
  673.   elseif (New Jersey isin $1-) set %a $v1
  674.   elseif (N.Y. Islanders isin $1-) || (NY Islanders isin $1-) || (N. Y. Islanders isin $1-) || (New York Islanders isin $1-) set %a N.Y. Islanders
  675.   elseif (N.Y. Rangers isin $1-) || (NY Rangers isin $1-) || (N. Y. Rangers isin $1-) || (New York Rangers isin $1-) set %a N.Y. Rangers
  676.   elseif (Carolina isin $1-) set %a $v1
  677.   elseif (Washington isin $1-) set %a $v1
  678.   elseif (Dallas isin $1-) set %a $v1
  679.   elseif (Columbus isin $1-) set %a $v1
  680.   elseif (St. Louis isin $1-) set %a $v1
  681.   elseif (Nashville isin $1-) set %a $v1
  682.   elseif (Winnipeg isin $1-) set %a $v1
  683.   elseif (Chicago isin $1-) set %a $v1
  684.   elseif (Minnesota isin $1-) set %a $v1
  685.   elseif (Colorado isin $1-) set %a $v1
  686.   elseif (Anaheim isin $1-) set %a $v1
  687.   elseif (Vancouver isin $1-) set %a $v1
  688.   elseif (San Jose isin $1-) set %a $v1
  689.   elseif (Los Angeles isin $1-) set %a $v1
  690.   elseif (Arizona isin $1-) set %a $v1
  691.   elseif (Edmonton isin $1-) set %a $v1
  692.   elseif (Calgary isin $1-) set %a $v1
  693.  
  694.   elseif (Lightning isin $1-) set %a Tampa Bay
  695.   elseif (Canadiens isin $1-) set %a Montreal
  696.   elseif (Red Wings isin $1-) set %a Detroit
  697.   elseif (Bruins isin $1-) set %a Boston
  698.   elseif (Senators isin $1-) set %a Ottawa
  699.   elseif (Maple Leafs isin $1-) set %a Toronto
  700.   elseif (Panthers isin $1-) set %a Florida
  701.   elseif (Sabres isin $1-) set %a Buffalo
  702.   elseif (Penguins isin $1-) set %a Pittsburgh
  703.   elseif (Flyers isin $1-) set %a Philadelphia
  704.   elseif (Devils isin $1-) set %a New Jersey
  705.   elseif (Hurricanes isin $1-) set %a Carolina
  706.   elseif (Capitals isin $1-) set %a Washington
  707.   elseif (Stars isin $1-) set %a Dallas
  708.   elseif (Blue Jackets isin $1-) set %a Columbus
  709.   elseif (Blues isin $1-) set %a St. Louis
  710.   elseif (Predators isin $1-) set %a Nashville
  711.   elseif (Jets isin $1-) set %a Winnipeg
  712.   elseif (Black Hawks isin $1-) set %a Chicago
  713.   elseif (Wild isin $1-) set %a Minnesota
  714.   elseif (Avalanche isin $1-) set %a Colorado
  715.   elseif (Ducks isin $1-) set %a Anaheim
  716.   elseif (Canucks isin $1-) set %a Vancouver
  717.   elseif (Sharks isin $1-) set %a San Jose
  718.   elseif (Kings isin $1-) set %a Los Angeles
  719.   elseif (Islanders isin $1-) set %a New York
  720.   elseif (Rangers isin $1-) set %a New York
  721.   elseif (Coyotes isin $1-) set %a Arizona
  722.   elseif (Oilers isin $1-) set %a Edmonton
  723.   elseif (Flames isin $1-) set %a Calgary
  724.  
  725.  
  726.   else {
  727.     iecho 4Error Unknown NHL team: $1-
  728.     return $1-
  729.   }
  730.  
  731.   return %a
  732. }
  733.  
  734.  
  735. alias -l paren if ($1) return ( $+ $1- $+ )
  736.  
  737. ;==================================================================================
  738. ;Author  : fubar
  739. ;Function: $striphtml identifier
  740. ;          This identifier strips html code from a string of text.
  741. ;         Good for using when retrieving webpages within mirc.  
  742. ;==================================================================================
  743. ;
  744. ;This identifier strips html code from a string of text. Good for using when retrieving webpages within mirc.
  745. ;
  746. ;Usage: $striphtml(html code)
  747. alias -l Xchr {
  748.   var %return $regsubex($regsubex($1-,/&#x([A-F0-9]{1,2});/g,$chr($base($regml(\n),16,10))),/&#([0-9]{2});/g,$chr(\1))
  749.   return $replacecs(%return,&ndash;,–,&middot;,·,&raquo;,»,&laquo;,«,&Uuml;,Ü,&uuml;,ü,&Aacute;,Á,&aacute;,á,&Eacute;,$&
  750.     É,&eacute;,é,&Iacute;,Í,&iacute;,í,&Oacute;,Ó,&oacute;,ó,&Ntilde;,Ñ,&ntilde;,ñ,&Uacute;,Ú,&uacute;,ú,&nbsp;,$chr(32),$&
  751.     &aelig;,æ,&quot;,")
  752. }
  753. alias -l striphtml {
  754.   ; making sure there are parameters to work with
  755.   IF ($1) {
  756.     ; Setting my variables. The %opt is set kind of funky
  757.     ; all it does is combine <two><brackets> into 1 <twobrackets>, fewer loops this way
  758.     ; also stripped tab spaces
  759.     VAR %strip
  760.     var %opt <> $remove($1-,> <,><,$chr(9)) <>
  761.     var %n 2
  762.     ; using $gettok() I checked the text in front of '>' (chr 62)
  763.     ; then the second $gettok checks the text behind '<' (chr 60)
  764.     ; so I'm extracting anything between >text<
  765.     WHILE ($gettok($gettok(%opt,%n,62),1,60)) {
  766.       ; take each peice of text and add it to the same variable
  767.       %strip = %strip $ifmatch
  768.       %strip = $replace(%strip,&quot;,")
  769.       ; increase the variable so the while statement can check the next part
  770.       INC %n
  771.     }
  772.     ; now that the loop has finished we can return the stripped html code
  773.     RETURN $xchr(%strip)
  774.   }
  775. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement