Advertisement
mruno

!NHL 09NOV2014 - Not working

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