Advertisement
mruno

!nfl 27NOV2014 Turkey Day Edition! - Not working

Sep 24th, 2013
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 41.30 KB | None | 0 0
  1. ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. ;script !nfl Script
  3. ;version 27NOV2014 Turkey Day Edition!
  4. ;author mruno
  5. ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  6. ;
  7. ;to disable team colors, change alias -l NFL.team.colors return 0
  8. ;to enable team colors, change alias -l NFL.team.colors return 1
  9. ;
  10. ;to enable !scorealert, change alias -l NFL.scorealert.enable return 1
  11. ;to disable !scorealert, change alias -l NFL.scorealert.enable return 0
  12. ;
  13. ;
  14. ;to show !scorealert like:
  15. ;          [!ScoreAlert]  NFL   Philadelphia Eagles scored 6 points on Dallas Cowboys!
  16. ;             Philadelphia Eagles at Dallas Cowboys   New Score: 27 to 7   Status: Halftime
  17. ;change alias -l NFL.scorealert.two.lines return 1
  18. ;
  19. ;to show !scorealert like:
  20. ;            [!ScoreAlert]  NFL   Philadelphia Eagles at Dallas Cowboys   New Score: 27 to 7   Status: Halftime
  21. ;change alias -l NFL.scorealert.two.lines return 0
  22. ;
  23. ;######################################################
  24. ;
  25. alias -l NFL.team.colors return 0
  26. alias -l NFL.scorealert.enable return 1
  27. alias -l NFL.scorealert.two.lines return 1
  28. ;
  29. ;######################################################
  30. ;
  31. ;
  32. alias -l set.correct.network {
  33.   if ($1) {
  34.     var %loop 0
  35.     while ($scon(0) > %loop) {
  36.       inc %loop
  37.       if ($scon(%loop).network == $1) {
  38.         scon %loop
  39.         break
  40.       }
  41.     }
  42.   }
  43. }
  44. on 1:PART:#:{
  45.   if ($hget(NFL.get.scores.nfl.alert,$+($nick,.,$network,.,$chan))) {
  46.     hdel NFL.get.scores.nfl.alert $+($nick,.,$network,.,$chan)
  47.     msg $nick Your NFL ScoreAlert has been deleted for parting.
  48.   }
  49. }
  50. on 1:JOIN:#:if ($timer(NFL.get.scores.nfl.remove.alert. $+ $+($nick,.,$network,.,$chan))) .timerNFL.get.scores.nfl.remove.alert. $+ $+($nick,.,$network,.,$chan) off
  51. on 1:KICK:#:if ($hget(NFL.get.scores.nfl.alert,$+($nick,.,$network,.,$chan))) .timerNFL.get.scores.nfl.remove.alert. $+ $+($nick,.,$network,.,$chan) 1 120 hdel NFL.get.scores.nfl.alert $+($nick,.,$network,.,$chan)
  52. on 1:QUIT:if ($hget(NFL.get.scores.nfl.alert)) hdel -w NFL.get.scores.nfl.alert $nick $+ .*
  53. on 1:NICK:{
  54.   if ($hget(NFL.get.scores.nfl.alert,$+($nick,.,$network,.,$chan))) {
  55.     hadd NFL.get.scores.nfl.alert $newnick $+ . $+ $chan $hget(NFL.get.scores.nfl.alert,$+($nick,.,$network,.,$chan))
  56.     hdel NFL.get.scores.nfl.alert $+($nick,.,$network,.,$chan)
  57.   }
  58. }
  59. on 1:TEXT:?scorealert*:#:{
  60.   if ($chr(36) isin $2-) return
  61.   if (!$NFL.scorealert.enable) return
  62.   if ($2 != NFL) {
  63.     .timerscorealertNFL 1 2 .notice $nick For NFL scorealerts, Type !scorealert NFL <team>
  64.     halt
  65.   }
  66.   if ($3 == off) {
  67.     if ($hget(NFL.get.scores.NFL.alert $+($nick,.,$network,.,$chan))) hdel NFL.get.scores.NFL.alert $+($nick,.,$network,.,$chan)
  68.     .notice $nick Deleted your ScoreAlert.
  69.     return
  70.   }
  71.   if ($4 == off) {
  72.     if ($hget(NFL.get.scores.nfl.alert,$+($nick,.,$network,.,$chan))) || ($nick isop $chan) {
  73.       if ($team.lookup($3)) {
  74.         if ($hget(NFL.get.scores.nfl.alert,$+($nick,.,$network,.,$chan))) {
  75.           hdel NFL.get.scores.nfl.alert $+($nick,.,$network,.,$chan)
  76.           .notice $nick Deleted your ScoreAlert for $3
  77.           return
  78.         }
  79.         if ($nick isop $chan) {
  80.           var %a = 0
  81.           while (%a < $hfind(NFL.get.scores.nfl.alert,* $+ $team.lookup($3) $+ *,0,w).data) {
  82.             inc %a
  83.             if ($gettok($hfind(NFL.get.scores.nfl.alert,* $+ $team.lookup($3) $+ *,%a,w).data,2,46) == $chan) {
  84.               hdel NFL.get.scores.nfl.alert $hfind(NFL.get.scores.nfl.alert,* $+ $team.lookup($3) $+ *,%a,w).data
  85.               .notice $nick Deleted ScoreAlert for $3
  86.               return
  87.             }
  88.           }
  89.         }
  90.       }
  91.       else .notice $nick Invalid team name.
  92.     }
  93.     return
  94.   }
  95.   else {
  96.     if (%NFL.get.scores.nfl.ON) || ($hget(NFL.get.scores)) {
  97.       .timerNFL. $+ $nick 1 3 .notice $nick Please try again in 1 minute.
  98.       if (!$timer(NFL.get.scores.nfl.Timeout)) .timerNFL.get.scores.nfl.Timeout 1 15 NFL.get.scores.nfl.Timeout 1
  99.       halt
  100.     }
  101.     if ($3) {
  102.       if ($team.lookup($3)) {
  103.         if ($hget(NFL.get.scores.nfl.alert,$+($nick,.,$network,.,$chan))) .notice $nick Your current scorealert $paren($gettok($v1,1,187)) will be overwritten.
  104.         set %NFL.get.scores.nfl.TEMP.info scorealert
  105.         set %NFL.get.scores.nfl.TEMP.search $team.lookup($3)
  106.         set %NFL.get.scores.nfl.TEMP.chan $chan
  107.         set %NFL.get.scores.nfl.TEMP.nick $nick
  108.         NFL.get.scores
  109.       }
  110.       else .notice $nick Invalid team name.
  111.     }
  112.     else .notice $nick Please specify a team.
  113.   }
  114. }
  115. on 1:TEXT:?nfl*:#:{
  116.   if ($chr(36) isin $2-) return
  117.   set %NFL.get.scores.nfl.TEMP.chan $chan
  118.   set %NFL.get.scores.nfl.TEMP.nick $nick
  119.   if (%NFL.get.scores.nfl.ON) || ($hget(NFL.get.scores)) {
  120.     .timerNFL.spam. $+ nick 1 3 .notice %NFL.get.scores.nfl.TEMP.nick Please try again in 1 minute.
  121.     if (!$timer(NFL.get.scores.nfl.Timeout)) .timerNFL.get.scores.nfl.Timeout 1 15 NFL.get.scores.nfl.Timeout 1
  122.   }
  123.   else {
  124.     if ($2 == all) || ($2 == final) || ($2 == current) || ($2 == upcoming) || ($2 == now) set %NFL.get.scores.nfl.TEMP.info $iif($2 == now,current,$2)
  125.     elseif ($2 == Sunday) || ($2 == Monday) || ($2 == Tuesday) || ($2 == Wednesday) || ($2 == Thursday) || ($2 == Friday) || ($2 == Saturday) || ($2 == Today) || ($2 == Tomorrow) || ($2 == Yesterday) {
  126.       set %NFL.get.scores.nfl.TEMP.info search
  127.       if ($2 == today) set %NFL.get.scores.nfl.TEMP.search $asctime($ctime,dddd)
  128.       elseif ($2 == tomorrow) set %NFL.get.scores.nfl.TEMP.search $asctime($calc(86400 + $ctime),dddd)
  129.       elseif ($2 == yesterday) set %NFL.get.scores.nfl.TEMP.search $asctime($calc($ctime - 86400),dddd)
  130.       else set %NFL.get.scores.nfl.TEMP.search $2
  131.     }
  132.     elseif ($team.lookup($2)) {
  133.       set %NFL.get.scores.nfl.TEMP.info search
  134.       set %NFL.get.scores.nfl.TEMP.search $ifmatch
  135.     }
  136.     elseif (search isin $2) {
  137.       if ($3) {
  138.         if ($3 == Sunday) || ($3 == Monday) || ($3 == Tuesday) || ($3 == Wednesday) || ($3 == Thursday) || ($3 == Friday) || ($3 == Saturday) || ($3 == Today) || ($3 == Tomorrow) || ($3 == Yesterday) {
  139.           set %NFL.get.scores.nfl.TEMP.info search
  140.           if ($3 == today) set %NFL.get.scores.nfl.TEMP.search $asctime($ctime,dddd)
  141.           elseif ($3 == tomorrow) set %NFL.get.scores.nfl.TEMP.search $asctime($calc(86400 + $ctime),dddd)
  142.           elseif ($3 == yesterday) set %NFL.get.scores.nfl.TEMP.search $asctime($calc($ctime - 86400),dddd)
  143.           else set %NFL.get.scores.nfl.TEMP.search $3
  144.         }
  145.         elseif ($team.lookup($3)) {
  146.           set %NFL.get.scores.nfl.TEMP.info search
  147.           set %NFL.get.scores.nfl.TEMP.search $team.lookup($3)
  148.         }
  149.         else { .notice $nick Invalid search item. Try a team name or the day of the week. | halt }
  150.       }
  151.     }
  152.     elseif ($2) { .notice $nick Invalid option, team name, or day of the week. Try $1 Current or $1 Final or $1 Search <team> or $1 Search <day> or $1 Upcoming | halt }
  153.     if (!$2) {
  154.       .timer 1 3 .notice $nick You can also use the following options: Current, Final, Search <team>, and Upcoming. Example: $1 Search 49ers
  155.       .timer 1 3 .notice $nick Or you can have scores messaged to the channel by using: !ScoreAlert NFL <team>
  156.     }
  157.     if (!%NFL.get.scores.nfl.TEMP.info) set %NFL.get.scores.nfl.TEMP.info $iif($2,$2,all)
  158.     set %NFL.get.scores.nfl.TEMP.chan $chan
  159.     set %NFL.get.scores.nfl.TEMP.nick $nick
  160.     NFL.get.scores
  161.   }
  162. }
  163. alias NFL.get.scores.nfl.msg {
  164.   if (%NFL.get.scores.nfl.TEMP.chan) msg %NFL.get.scores.nfl.TEMP.chan $1-
  165. }
  166. alias NFL.get.scores {
  167.   if (%NFL.get.scores.nfl.TEMP.nick) .notice %NFL.get.scores.nfl.TEMP.nick !NFL by mruno gathering data, please wait...
  168.   if ($sock(NFL.get.scores)) sockclose NFL.get.scores
  169.   set -u45 %NFL.get.scores.nfl.ON 1
  170.   if (!$hget(NFL.get.scores)) hmake NFL.get.scores
  171.   sockopen NFL.get.scores scores.covers.com 80
  172.   .timerNFL.get.scores.nfl.Timeout 1 30 NFL.get.scores.nfl.Timeout
  173. }
  174. alias NFL.get.scores.nfl.Timeout {
  175.   if (%NFL.get.scores.nfl.TEMP.info != alert.check) && (!$1) NFL.get.scores.nfl.msg     Error: The NFL request timed out. Please try again later. :(
  176.   NFL.get.scores.nfl.Close
  177. }
  178. alias NFL.get.scores.nfl.alert.check {
  179.   if (!$hget(NFL.get.scores.nfl.options)) hmake NFL.get.scores.nfl.options
  180.   if (!$hget(NFL.get.scores.nfl.options,alert.check)) hadd NFL.get.scores.nfl.options alert.check 1
  181.   else {
  182.     if ($hget(NFL.get.scores.nfl.options,alert.check) > 2) && (!%NFL.get.scores.nfl.ON) {
  183.       ;check for updated scores
  184.       set %NFL.get.scores.nfl.TEMP.info alert.check
  185.       hadd NFL.get.scores.nfl.options alert.check 0
  186.       NFL.get.scores
  187.     }
  188.     else hinc NFL.get.scores.nfl.options alert.check
  189.   }
  190.   if (!$hget(NFL.get.scores.nfl.alert,0).item) {
  191.     .timerNFL.get.scores.nfl.alert off
  192.     hfree NFL.get.scores.nfl.alert
  193.     hfree NFL.get.scores.nfl.options
  194.   }
  195. }
  196. alias NFL.get.scores.nfl.scorealert {
  197.   if (!$1) return
  198.   if (!$hget(NFL.get.scores.nfl.alert)) hmake NFL.get.scores.nfl.alert
  199.   if ($hget(NFL.get.scores.nfl.alert,%NFL.get.scores.nfl.TEMP.nick)) NFL.get.scores.nfl.msg  %NFL.get.scores.nfl.TEMP.nick $+ $chr(44) You can only can track one NFL team at a time.
  200.   else {
  201.     ;team»Current»Today»Now»Oakland at Denver»Pre-game »null:null
  202.     hadd NFL.get.scores.nfl.alert %NFL.get.scores.nfl.TEMP.nick $+ . $+ %NFL.get.scores.nfl.TEMP.chan $+($gettok($1-,1,187),$chr(187),$gettok($1-,7,187))
  203.     NFL.get.scores.nfl.msg 0,2 NFL   Now monitoring:12 $gettok($1-,5,187)   Score:12  $replace( $+ $gettok($1-,7,187),:,$chr(32) to $chr(32),null,0)
  204.     ;.notice %NFL.get.scores.nfl.TEMP.nick If you leave this channel, score alerts will be disabled.
  205.     if (!$timer(NFL.get.scores.nfl.alert)) .timerNFL.get.scores.nfl.alert 0 60 NFL.get.scores.nfl.alert.check
  206.   }
  207. }
  208. alias NFL.get.scores.nfl.End {
  209.   var %a = 0, %item, %items, %team1, %team2, %data
  210.  
  211.   ;scorealert
  212.   if ($hget(NFL.get.scores.nfl.alert)) {
  213.     while ($hget(NFL.get.scores.nfl.alert,0).item > %a) {
  214.       inc %a
  215.       set %item $hget(NFL.get.scores.nfl.alert,%a).item
  216.       set %data $hget(NFL.get.scores.nfl.alert,%a).data
  217.       var %newdata $hget(NFL.get.scores,$hfind(NFL.get.scores,* $+ $gettok(%data,1,187) $+ *,1,w).data)
  218.       if (%newdata) {
  219.         if ($gettok(%newdata,1,187) == final) {
  220.           ;msg final score here
  221.           ;check and see if score alert is still needed
  222.           ;Current»Today»Now»Oakland at Denver»Pre-game »null:null
  223.  
  224.           var %sep $iif(vs isin $gettok(%newdata,4,187),vs,at)
  225.           var %team1 $NFL.get.scores.nfl.teamcolors($gettok($gettok(%newdata,4,187),1- $+ $calc($findtok($gettok(%newdata,4,187),%sep,1,32) - 1),32))
  226.           var %team2 $NFL.get.scores.nfl.teamcolors($gettok($gettok(%newdata,4,187),$calc($findtok($gettok(%newdata,4,187),%sep,1,32) + 1) $+ -,32))
  227.           if (%team isin %team1) var %team0 %team1
  228.           else var %team0 %team2
  229.           set %team1 $remove($strip(%team1),[,],)
  230.           set %team2 $remove($strip(%team2),[,],)
  231.           var %teams, %winner
  232.           if ($gettok($replace($gettok(%newdata,5,187),null,0),1,58) > $gettok($replace($gettok(%newdata,5,187),null,0),2,58)) {
  233.             set %teams  $+ %team1 $+  at %team2 $+ 
  234.             set %winner $strip(%team1)
  235.           }
  236.           elseif ($gettok($replace($gettok(%newdata,5,187),null,0),1,58) < $gettok($replace($gettok(%newdata,5,187),null,0),2,58)) {
  237.             set %teams %team1 at %team2 $+ 
  238.             set %winner $strip(%team2)
  239.           }
  240.           else set %teams %team1 at %team2
  241.           var %rand $rand(1,10)
  242.           .timerScoreAlert. $+ $gettok(%item,2,46) $+ . $+ $replace(%Teams,$chr(32),.) 1 %rand msg $gettok(%item,2,46)   0,2 NFL    4Final: %teams 12Score:2 $replace( $+ $gettok(%newdata,5,187),:,$chr(32) to $chr(32),null,0) 
  243.           .msg $gettok(%item,1,46) 0,2 NFL   4Final: %teams 12Score:2 $replace( $+ $gettok(%newdata,5,187),:,$chr(32) to $chr(32),null,0) 
  244.           hdel NFL.get.scores.nfl.alert %item
  245.         }
  246.         else {
  247.           if ($gettok(%newdata,6,187) != $gettok(%data,2,187)) {
  248.             var %sep $iif(vs isin $gettok(%newdata,4,187),vs,at)
  249.             var %team1 $NFL.get.scores.nfl.teamcolors($gettok($gettok(%newdata,4,187),1- $+ $calc($findtok($gettok(%newdata,4,187),%sep,1,32) - 1),32))
  250.             var %team2 $NFL.get.scores.nfl.teamcolors($gettok($gettok(%newdata,4,187),$calc($findtok($gettok(%newdata,4,187),%sep,1,32) + 1) $+ -,32))
  251.  
  252.             if (%team isin %team1) var %team0 %team1
  253.             else var %team0 %team2
  254.             set %team1 $remove($strip(%team1),[,],)
  255.             set %team2 $remove($strip(%team2),[,],)
  256.             var %team1.old.score $gettok($gettok(%data,2,187),1,58)
  257.             var %team1.new.score $gettok($gettok(%newdata,6,187),1,58)
  258.             var %team2.old.score $gettok($gettok(%data,2,187),2,58)
  259.             var %team2.new.score $gettok($gettok(%newdata,6,187),2,58)
  260.  
  261.             var %teams
  262.             if (%team1.new.score > %team2.new.score) set %teams  $+ %team1 $+  at %team2
  263.             elseif (%team2.new.score > %team1.new.score) set %teams %team1 at  $+ %team2 $+ 
  264.             else set %teams %team1 at %team2
  265.             ;.timerScoreAlert. $+ $gettok(%item,2,46) $+ . $+ $replace(%Teams,$chr(32),.) 1 $timer(0) msg $gettok(%item,2,46)
  266.  
  267.             if ($NFL.scorealert.two.lines) {
  268.               if (%team1.old.score != %team1.new.score) .timerScoreAlert.1. $+ $gettok(%item,2,46) $+ . $+ $replace(%Teams,$chr(32),.) 1 $timer(0) msg $gettok(%item,2,46) 4[!ScoreAlert] 0,2 NFL   %team1 scored  $+ $calc(%team1.new.score - %team1.old.score) $iif($calc(%team1.new.score - %team.old.score) == 1,point,points) on the %team2 $+ !
  269.               else .timerScoreAlert.1. $+ $gettok(%item,2,46) $+ . $+ $replace(%Teams,$chr(32),.) 1 $timer(0) msg $gettok(%item,2,46) 4[!ScoreAlert] 0,2 NFL   %team2 scored  $+ $calc(%team2.new.score - %team2.old.score) $iif($calc(%team2.new.score - %team2.old.score) == 1,point,points) on the %team1 $+ !
  270.             }
  271.             ;.timerScoreAlert.2. $+ $gettok(%item,2,46) $+ . $+ $replace(%Teams,$chr(32),.) 1 $timer(0) msg $gettok(%item,2,46)   4[!ScoreAlert] 0,2 NFL   %teams  12 New Score:2 $replace( $+ $gettok(%newdata,6,187),:,$chr(32) to $chr(32),null,0)  14 Status:3 $gettok(%newdata,5,187) 
  272.             .timerScoreAlert.2. $+ $gettok(%item,2,46) $+ . $+ $replace(%Teams,$chr(32),.) 1 $timer(0) msg $gettok(%item,2,46) $iif(!$NFL.scorealert.two.lines,  4[!ScoreAlert] 2 NFL  )    %teams  12 New Score:2 $replace( $+ $gettok(%newdata,6,187),:,$chr(32) to $chr(32),null,0)  14 Status:3 $gettok(%newdata,5,187) 
  273.             hadd NFL.get.scores.nfl.alert %item $gettok(%data,1,187) $+ $chr(187) $+ $gettok(%newdata,6,187)
  274.           }
  275.         }
  276.       }
  277.     }
  278.   }
  279.   if (%NFL.get.scores.nfl.TEMP.info == alert.check) {
  280.     if ($hget(NFL.get.scores)) hfree NFL.get.scores
  281.     unset %NFL.get.scores*
  282.     sockclose NFL.get.scores
  283.     return
  284.   }
  285.  
  286.   if (%NFL.get.scores.nfl.TEMP.info == scorealert) && (%NFL.get.scores.nfl.TEMP.search) {
  287.     if ($hget(NFL.get.scores,$hfind(NFL.get.scores,*current* $+ %NFL.get.scores.nfl.TEMP.search $+ *,1,w).data)) {
  288.       NFL.get.scores.nfl.scorealert %NFL.get.scores.nfl.TEMP.search $+ $chr(187) $+ $ifmatch
  289.       .notice %NFL.get.scores.nfl.TEMP.nick Your ScoreAlert will be disabled if you leave %NFL.get.scores.nfl.TEMP.chan or by typing 12!ScoreAlert NFL off 
  290.     }
  291.     else NFL.get.scores.nfl.msg %NFL.get.scores.nfl.TEMP.nick $+ $chr(44) please choose an NFL game that is currently playing. $iif($hfind(NFL.get.scores,*upcoming* $+ %NFL.get.scores.nfl.TEMP.search $+ *,1,w).data,%NFL.get.scores.nfl.TEMP.search plays on12 $gettok($hget(NFL.get.scores,$ifmatch),2,187) at $gettok($hget(NFL.get.scores,$ifmatch),3,187)) 
  292.   }
  293.   ;team search
  294.   if (%NFL.get.scores.nfl.TEMP.info == search) && (%NFL.get.scores.nfl.TEMP.search) {
  295.     var %a = 0, %item, %items, %team0, %team1, %team2, %team = %NFL.get.scores.nfl.TEMP.search
  296.     set %item $hget(NFL.get.scores,$hfind(NFL.get.scores,* $+ %team $+ *,1,w).data)
  297.     if (!%item) {
  298.       NFL.get.scores.nfl.msg   Sorry, there are no NFL games found for: %team
  299.       NFL.get.scores.nfl.Close
  300.       return
  301.     }
  302.     if (%team == Sunday) || (%team == Monday) || (%team == Tuesday) || (%team == Wednesday) || (%team == Thursday) || (%team == Friday) || (%team == Saturday) || (%team == Today) || (%team == Tomorrow) || (%team == Yesterday) {
  303.       ;Day Search
  304.       var %a = 0, %games, %temp
  305.       while ($hfind(NFL.get.scores,* $+ %team $+ *,0,w).data > %a) {
  306.         inc %a
  307.         if (%a == 1) NFL.get.scores.nfl.msg 0,2 NFL  $gettok(%item,2,187) $+ :
  308.         set %temp $gettok($hfind(NFL.get.scores,* $+ %team $+ *,%a,w).data,2,46)
  309.         if ($len(%temp) == 1) set %temp 0 $+ %temp
  310.         set %games $addtok(%temp,%games,32)
  311.       }
  312.       set %games $sorttok(%games,32)
  313.       set %a 0
  314.       var %game
  315.       while ($gettok(%games,0,32) > %a) {
  316.         inc %a
  317.         set %game NFL. $+ $iif($left($gettok(%games,%a,32),1) == 0,$right($gettok(%games,%a,32),1),$gettok(%games,%a,32))
  318.         set %item $hget(NFL.get.scores,%game)
  319.         if ($gettok(%item,1,187) == Upcoming) NFL.get.scores.nfl.upcoming %item
  320.         elseif ($gettok(%item,1,187) == Final) {
  321.           NFL.get.scores.nfl.final %item
  322.         }
  323.         elseif ($gettok(%item,1,187) == Current) {
  324.           NFL.get.scores.nfl.current %item
  325.         }
  326.       }
  327.  
  328.       ;end of loop
  329.     }
  330.     elseif ($gettok(%item,1,187) == upcoming) {
  331.       set %team %NFL.get.scores.nfl.TEMP.search
  332.       var %sep $iif(vs isin $gettok(%item,4,187),vs,at)
  333.       set %team1 $NFL.get.scores.nfl.teamcolors($gettok($gettok(%item,4,187),1- $+ $calc($findtok($gettok(%item,4,187),%sep,1,32) - 1),32))
  334.       set %team2 $NFL.get.scores.nfl.teamcolors($gettok($gettok(%item,4,187),$calc($findtok($gettok(%item,4,187),%sep,1,32) + 1) $+ -,32))
  335.       if (%team isin %team1) set %team0 %team1
  336.       else set %team0 %team2
  337.       var %consensus
  338.       if ($chr(37) isin $remove($gettok(%item,7,187),$chr(32))) {
  339.         if ($remove($gettok(%item,7,187),$chr(32)) == $remove($gettok(%item,9,187),$chr(32))) set %consensus Dead Even
  340.         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)))
  341.         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)))
  342.       }
  343.       NFL.get.scores.nfl.msg  0,2 NFL    %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))
  344.       NFL.get.scores.nfl.msg     14Next game:12 $gettok(%item,4,187) 14 $paren( $+ $gettok(%item,2,187) @ $gettok(%item,3,187) $+ 14) $iif(%consensus,14Consensus: %consensus)
  345.     }
  346.     elseif ($gettok(%item,1,187) == final) {
  347.       var %sep $iif(vs isin $gettok(%item,4,187),vs,at)
  348.       set %team1 $NFL.get.scores.nfl.teamcolors($gettok($gettok(%item,4,187),1- $+ $calc($findtok($gettok(%item,4,187),%sep,1,32) - 1),32))
  349.       set %team2 $NFL.get.scores.nfl.teamcolors($gettok($gettok(%item,4,187),$calc($findtok($gettok(%item,4,187),%sep,1,32) + 1) $+ -,32))
  350.       if (%team isin %team1) set %team0 %team1
  351.       else set %team0 %team2
  352.       set %team1 $remove($strip(%team1),[,],)
  353.       set %team2 $remove($strip(%team2),[,],)
  354.       var %teams
  355.       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 $+ 
  356.       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 $+ 
  357.       else set %teams %team1 at %team2
  358.       NFL.get.scores.nfl.msg  0,2 NFL    %team0 Last game:12 $gettok(%item,2,187)
  359.       NFL.get.scores.nfl.msg         %teams  - Score: $replace($gettok(%item,5,187),null,0,:,$chr(32) to $chr(32)) - $paren(12FINAL) 
  360.     }
  361.     elseif ($gettok(%item,1,187) == current) {
  362.       set %team1 $NFL.get.scores.nfl.teamcolors($gettok($gettok(%item,4,187),1- $+ $calc($findtok($gettok(%item,4,187),%sep,1,32) - 1),32))
  363.       set %team2 $NFL.get.scores.nfl.teamcolors($gettok($gettok(%item,4,187),$calc($findtok($gettok(%item,4,187),%sep,1,32) + 1) $+ -,32))
  364.       if (%team isin %team1) set %team0 %team1
  365.       else set %team0 %team2
  366.       set %team1 $remove($strip(%team1),[,],)
  367.       set %team2 $remove($strip(%team2),[,],)
  368.       var %teams
  369.       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 $+ 
  370.       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 $+ 
  371.       else set %teams %team1 at %team2
  372.  
  373.       NFL.get.scores.nfl.msg  0,2 NFL    %team0 14Currently playing: $replace($gettok(%item,4,187),at,14@)
  374.       NFL.get.scores.nfl.msg      14Score:12 $replace($gettok(%item,6,187),null,0,:,$chr(32) to $chr(32))  14Status:12 $gettok(%item,5,187) $iif(%NFL.get.scores.nfl.TEMP.GameStatus,- %NFL.get.scores.nfl.TEMP.GameStatus)
  375.     }
  376.   }
  377.  
  378.   if (%NFL.get.scores.nfl.TEMP.info == all) || (%NFL.get.scores.nfl.TEMP.info == current) {
  379.     ;gathers all the CURRENT games
  380.     while (%a < $hget(NFL.get.scores,0).item) {
  381.       inc %a
  382.       set %item $hget(NFL.get.scores,%a).item
  383.       if ($gettok($hget(NFL.get.scores,%item),1,187) == Current) set %items $addtok(%items,%item,44)
  384.     }
  385.     ;echoes all the CURRENT games
  386.     ;Current»Today»Now»Oakland at Denver»Pre-game »null:null
  387.  
  388.     set %a 0
  389.     set %item
  390.     if (%items) {
  391.       NFL.get.scores.nfl.msg 0,2 NFL   Games 12currently playing:
  392.       while (%a < $gettok(%items,0,44)) {
  393.         inc %a
  394.         ;if (%a == 1) NFL.get.scores.nfl.msg  0,2 NFL 
  395.         set %item $hget(NFL.get.scores,$gettok(%items,%a,44))
  396.         NFL.get.scores.nfl.current %item
  397.       }
  398.     }
  399.     else {
  400.       if (%NFL.get.scores.nfl.TEMP.info == current) NFL.get.scores.nfl.msg There are currently no NFL games being played.
  401.     }
  402.   }
  403.  
  404.   if (%NFL.get.scores.nfl.TEMP.info == all) || (%NFL.get.scores.nfl.TEMP.info == final) {
  405.     ;gathers all the FINAL games
  406.  
  407.     ;Final»Thursday September 19 2013»0»Kansas City at Philadelphia »26:16
  408.  
  409.     set %a 0
  410.     set %item
  411.     set %items
  412.     while (%a < $hget(NFL.get.scores,0).item) {
  413.       inc %a
  414.       set %item $hget(NFL.get.scores,%a).item
  415.       if ($gettok($hget(NFL.get.scores,%item),1,187) == FINAL) set %items $addtok(%items,%item,44)
  416.     }
  417.     ;echoes all the FINAL games
  418.     set %a 0
  419.     set %item
  420.     if (%items) {
  421.       while (%a < $gettok(%items,0,44)) {
  422.         inc %a
  423.         set %item $hget(NFL.get.scores,$gettok(%items,%a,44))
  424.         if (%a == 1) NFL.get.scores.nfl.msg  0,2 NFL 
  425.         NFL.get.scores.nfl.final %item
  426.       }
  427.     }
  428.     else {
  429.       if (%NFL.get.scores.nfl.TEMP.info == final) NFL.get.scores.nfl.msg There are currently no NFL final games for this week.
  430.     }
  431.   }
  432.   if (%NFL.get.scores.nfl.TEMP.info == all) || (%NFL.get.scores.nfl.TEMP.info == upcoming) {
  433.     ;    Upcoming»Monday September 23 2013»8:40p ET»Oakland at Denver» »1-1 (0-1 V) »36% »2-0 (1-0 H) »64%
  434.     var %a = 1, %data, %last, %item, %total = 0
  435.     while ($hget(NFL.get.scores,NFL. $+ %a)) {
  436.       set %data $hget(NFL.get.scores,NFL. $+ %a)
  437.       if (upcoming isin $gettok(%data,1,187)) {
  438.         if (%last != $gettok(%data,2,187)) NFL.get.scores.nfl.msg 0,2 NFL   $gettok(%data,2,187) $+ :
  439.         inc %total
  440.         NFL.get.scores.nfl.upcoming %data
  441.       }
  442.       set %last $gettok(%data,2,187)
  443.       inc %a
  444.     }
  445.     if (!%total) && (%NFL.get.scores.nfl.TEMP.info == upcoming) NFL.get.scores.nfl.msg There are no more NFL upcoming games for this week.
  446.   }
  447.   .timerNFL.get.scores.nfl.Close 1 15 NFL.get.scores.nfl.Close
  448. }
  449. alias NFL.get.scores.nfl.final {
  450.   if (!$1) return
  451.   var %item = $1-, %team1, %team2
  452.   var %sep $iif(vs isin $gettok(%item,4,187),vs,at)
  453.   set %team1 $NFL.get.scores.nfl.teamcolors($gettok($gettok(%item,4,187),1- $+ $calc($findtok($gettok(%item,4,187),%sep,1,32) - 1),32))
  454.   set %team2 $NFL.get.scores.nfl.teamcolors($gettok($gettok(%item,4,187),$calc($findtok($gettok(%item,4,187),%sep,1,32) + 1) $+ -,32))
  455.  
  456.   var %teams
  457.   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 $+ 
  458.   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 $+ 
  459.   else set %teams %team1 14@ %team2
  460.  
  461.   NFL.get.scores.nfl.msg       %teams  14 Score:12 $replace($gettok(%item,5,187),null,0,:,$chr(32) 14to12 $chr(32))  14 Status:4 FINAL 
  462. }
  463. alias NFL.get.scores.nfl.upcoming {
  464.   if (!$1) return
  465.   var %item = $1-
  466.   var %sep $iif(vs isin $gettok(%item,4,187),vs,at)
  467.   var %team1 $NFL.get.scores.nfl.teamcolors($gettok($gettok(%item,4,187),1- $+ $calc($findtok($gettok(%item,4,187),%sep,1,32) - 1),32))
  468.   var %team2 $NFL.get.scores.nfl.teamcolors($gettok($gettok(%item,4,187),$calc($findtok($gettok(%item,4,187),%sep,1,32) + 1) $+ -,32))
  469.  
  470.   var %consensus
  471.   if ($chr(37) isin $remove($gettok(%item,7,187),$chr(32))) {
  472.     if ($remove($gettok(%item,7,187),$chr(32)) == $remove($gettok(%item,9,187),$chr(32))) set %consensus Dead Even
  473.     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))) 
  474.     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))) 
  475.   }
  476.   NFL.get.scores.nfl.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)
  477. }
  478. alias NFL.get.scores.nfl.current {
  479.   if (!$1) return
  480.   var %item = $1-, %team1, %team2
  481.   var %sep $iif(vs isin $gettok(%item,4,187),vs,at)
  482.   set %team1 $NFL.get.scores.nfl.teamcolors($gettok($gettok(%item,4,187),1- $+ $calc($findtok($gettok(%item,4,187),%sep,1,32) - 1),32))
  483.   set %team2 $NFL.get.scores.nfl.teamcolors($gettok($gettok(%item,4,187),$calc($findtok($gettok(%item,4,187),%sep,1,32) + 1) $+ -,32))
  484.   var %teams
  485.   var %team1score $gettok($replace($gettok(%item,6,187),null,0),1,58)
  486.   var %team2score $gettok($replace($gettok(%item,6,187),null,0),2,58)
  487.   if (%team1score > %team2score) set %teams  $+ %team1 14@ %team2 
  488.   elseif (%team1score < %team2score) set %teams %team1 14@  $+ %team2 
  489.   else set %teams %team1 14@ %team2
  490.   NFL.get.scores.nfl.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)) 
  491. }
  492. alias NFL.get.scores.nfl.Sorted {
  493.   if ($1) {
  494.     ;sorts items by putting all the dates in hash tables
  495.     var %z = 0, %new
  496.     while ($hget(NFL.get.scores,0).item > %z) {
  497.       inc %z
  498.       if (NFL. isin $hget(NFL.get.scores,%z).item) set %new $addtok(%new,$v2,44)
  499.     }
  500.     set %z 0
  501.     var %data, %time, %data2, %all, %item
  502.     while ($gettok(%items,0,44) > %z) {
  503.       inc %z
  504.       set %item $gettok(%items,%z,44)
  505.       set %data $hget(NFL.get.scores,%item)
  506.       set %new $gettok(%data,2,187) $+ . $+ $gettok(%data,3,187)
  507.       set %data2 %new
  508.       set %time $remove($gettok(%data2,2,46),p,a,et)
  509.       set %time $calc($calc($gettok(%time,1,58) * 360) + $calc($gettok(%time,2,58) * 60))
  510.       set %time $calc($ctime($gettok(%data2,1,46)) + %time)
  511.       hadd NFL.get.scores %time $addtok($hget(NFL.get.scores,%time),%item,44)
  512.     }
  513.  
  514.     var %z = 0
  515.     set %new
  516.     while ($hget(NFL.get.scores,0).item > %z) {
  517.       inc %z
  518.       if (NFL. !isin $hget(NFL.get.scores,%z).item) set %new $addtok(%new,$v2,44)
  519.     }
  520.     return $sorttok(%new,44,n)
  521.   }
  522. }
  523. alias NFL.get.scores.nfl.Close {
  524.   sockclose NFL.get.scores
  525.   unset %NFL.get.scores.nfl.TEMP.*
  526.   .timerhfree.NFL.get.scores 1 30 if ($hget(NFL.get.scores)) hfree NFL.get.scores
  527. }
  528. alias -l useragent {
  529.   var %r $rand(1,11)
  530.   if (%r == 1) return User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
  531.   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
  532.   elseif (%r == 3) return User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)
  533.   elseif (%r == 4) return User-Agent: Opera/9.20 (Windows NT 6.0; U; en)
  534.   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
  535.   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
  536.   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
  537.   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
  538.   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
  539.   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
  540.   elseif (%r == 11) return User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0
  541. }
  542. on *:sockopen:NFL.get.scores: {
  543.   sockwrite -nt $sockname GET /football-scores-matchups.aspx HTTP/1.1
  544.   sockwrite -nt $sockname $useragent
  545.   sockwrite -nt $sockname Host: scores.covers.com
  546.   sockwrite -nt $sockname Accept-Language: en-us
  547.   sockwrite -nt $sockname Accept: */*
  548.   sockwrite -nt $sockname $crlf
  549. }
  550. on *:sockread:NFL.get.scores: {
  551.   var %temp, %date, %item, %data
  552.   if ($sockerr) {
  553.     var %error
  554.     if ($sockerr == 3) set %error Connection refused by remote host
  555.     elseif ($sockerr == 4) set %error DNS lookup for hostname failed
  556.     elseif ($sockerr > 0) set %error Unknown socket error ( $+ $sockerr $+ )
  557.     echo -s NFL.get.scores:     4Socket Error: %error
  558.     .timerNFL.get.scores.nfl.error 1 10 NFL.get.scores.nfl.msg     0,2 NFL   Socket Error. Please try again later. :(
  559.     .timerNFL.get.scores.nfl.close 1 15 NFL.get.scores.nfl.close
  560.     halt
  561.   }
  562.   else {
  563.     .timerNFL.get.scores.nfl.Timeout off
  564.     sockread %temp
  565.  
  566.     ;STATUS»DATE»TIME»TEAMS»STATUS»SCORE(Away:Home)»Game Status
  567.  
  568.     if (<td colspan="2" class="scoreboard-left"><h2> isin %temp) && (%date != $striphtml(%temp)) set %NFL.get.scores.nfl.TEMP.DATE $remove($striphtml(%temp),$chr(44))
  569.  
  570.     if (*<td class="scoreboard-*">* iswm %temp) {
  571.       if ($striphtml(%temp)) {
  572.         if (!$hget(NFL.get.scores)) hmake NFL.get.scores
  573.         ;In_Game_Status_1_
  574.         unset %NFL.get.scores.nfl.TEMP.GameStatus
  575.         set %item $striphtml(%temp)
  576.  
  577.         set %NFL.get.scores.nfl.TEMP.title $gettok($wildtok(%temp,*Title_1_*,1,60),2,62)
  578.  
  579.         if (Final isin %item) {
  580.           ;Game Over
  581.           set %NFL.get.scores.nfl.TEMP.STATUS Final
  582.           hadd NFL.get.scores NFL. $+ $calc($hget(NFL.get.scores,0).item + 1) $+(Final,$chr(187),%NFL.get.scores.nfl.TEMP.DATE,$chr(187),0,$chr(187),$gettok($wildtok(%temp,*Title_1_*,1,60),2,62))
  583.         }
  584.         elseif (*AM ET* iswm %item) || (*PM ET* iswm %item) {
  585.           ;Game Upcoming
  586.           set %NFL.get.scores.nfl.TEMP.STATUS Upcoming
  587.           hadd NFL.get.scores NFL. $+ $calc($hget(NFL.get.scores,0).item + 1) $+(Upcoming,$chr(187),%NFL.get.scores.nfl.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_1_*,1,60),2,62),$chr(187))
  588.         }
  589.         else {
  590.           ;Game is ON!
  591.           set %NFL.get.scores.nfl.TEMP.STATUS Current
  592.           hadd NFL.get.scores NFL. $+ $calc($hget(NFL.get.scores,0).item + 1) $+(Current,$chr(187),$asctime($ctime,dddd),$chr(187),Now,$chr(187),$gettok($wildtok(%temp,*Title_1_*,1,60),2,62),$chr(187),$gettok($wildtok(%temp,*In_Game_Status_1_*,1,60),2,62))
  593.  
  594.         }
  595.       }
  596.     }
  597.   }
  598.   if (*<td class="datac" id="*Score_1* iswm %temp) {
  599.     if (%NFL.get.scores.nfl.TEMP.STATUS == Current) || (%NFL.get.scores.nfl.TEMP.STATUS == Final) {
  600.       var %i  $hfind(NFL.get.scores,* $+ %NFL.get.scores.nfl.TEMP.title $+ *,1,w).data
  601.       if (<td class="datac" id="VisitScore_1 isin %temp) hadd NFL.get.scores %i $hget(NFL.get.scores,%i) $+($chr(187),$iif(!$striphtml(%temp),null,$remove($striphtml(%temp),$chr(32))),:)
  602.       if (<td class="datac" id="HomeScore_1_ isin %temp) hadd NFL.get.scores %i $hget(NFL.get.scores,%i) $+ $iif(!$striphtml(%temp),null,$remove($striphtml(%temp),$chr(32)))
  603.     }
  604.   }
  605.   if (%NFL.get.scores.nfl.TEMP.STATUS == Upcoming) && ($striphtml(%temp)) {
  606.     var %i = $hfind(NFL.get.scores,* $+ %NFL.get.scores.nfl.TEMP.title $+ *,1,w).data
  607.     if (*<td class="data">*-* (*-* ?)</td>* iswm %temp) hadd NFL.get.scores %i $hget(NFL.get.scores,%i) $+($chr(187),$striphtml(%temp))
  608.     if (*<td class="datac">*%</td>* iswm %temp) hadd NFL.get.scores %i $hget(NFL.get.scores,%i) $+($chr(187),$striphtml(%temp))
  609.   }
  610.   .timerNFL.get.scores.nfl.End 1 3 NFL.get.scores.nfl.End
  611. }
  612.  
  613. alias NFL.get.scores.nfl.teamcolors {
  614.   var %a
  615.   if ($1- == Arizona) set %a 1,4[ Arizona Cardinals ]
  616.   elseif (Atlanta isin $1-) set %a 4,1[ Atlanta Falcons ]
  617.   elseif (Baltimore isin $1-) set %a 8,2[ Baltimore Ravens ]
  618.   elseif (Buffalo isin $1-) set %a 4,2[ Buffalo Bills ]
  619.   elseif (Carolina isin $1-) set %a 11,1[ Carolina Panthers ]
  620.   elseif (Chicago isin $1-) set %a 7,2[ Chicago Bears ]
  621.   elseif (CINCINNATI isin $1-) set %a 1,7[ Cincinnati Bengals ]
  622.   elseif (CLEVELAND isin $1-) set %a 7,15[ Cleveland Browns ]
  623.   elseif (DALLAS isin $1-) set %a 12,15[ Dallas Cowboys ]
  624.   elseif (DENVER isin $1-) set %a 7,2[ Denver Broncos ]
  625.   elseif (DETROIT isin $1-) set %a 12,15[ Detroit Lions ]
  626.   elseif (GREEN BAY isin $1-) set %a 0,3[ Green Bay Packers ]
  627.   elseif (HOUSTON isin $1-) set %a 1,4[ Houston Texans ]
  628.   elseif (INDIANAPOLIS isin $1-) set %a 12,15[ Indianapolis Colts ]
  629.   elseif (JACKSONVILLE isin $1-) set %a 1,8[ Jacksonville Jaguars ]
  630.   elseif (KANSAS CITY isin $1-) set %a 0,4[ Kansas City Chiefs ]
  631.   elseif (MIAMI isin $1-) set %a 7,11[ Miami Dolphins ]
  632.   elseif (MINNESOTA isin $1-) set %a 8,6[ Minnesota Vikings ]
  633.   elseif (NEW ENGLAND isin $1-) set %a 2,15[ New England Patriots ]
  634.   elseif (NEW ORLEANS isin $1-) set %a 8,1[ New Orleans Saints ]
  635.   elseif (NY GIANTS isin $1-) || (N.Y. GIANTS isin $1-) set %a 4,2[ New York Giants ]
  636.   elseif (NY Jets isin $1-) || (N.Y. JETS isin $1-) set %a 0,3[ New York Jets ]
  637.   elseif (OAKLAND isin $1-) set %a 15,1[ Oakland Raiders ]
  638.   elseif (PHILADELPHIA isin $1-) set %a 0,10[ Philadelphia Eagles ]
  639.   elseif (PITTSBURGH isin $1-) set %a 2,0[ Pittsburgh Steelers ]
  640.   elseif (SAN DIEGO isin $1-) set %a 8,2[ San Diego Chargers ]
  641.   elseif (SEATTLE isin $1-) set %a 0,2[ Seattle Seahawks ]
  642.   elseif (SAN FRANCISCO isin $1-) set %a 0,4[ San Francisco 49ers ]
  643.   elseif (ST. LOUIS isin $1-) set %a 8,2[ St. Louis Rams ]
  644.   elseif (TAMPA BAY isin $1-) set %a 8,4[ Tampa Bay Buccaneers ]
  645.   elseif (TENNESSEE isin $1-) set %a 11,2[ Tennessee Titans ]
  646.   elseif (WASHINGTON isin $1-) set %a 0,5[ Washington Redskins ]
  647.  
  648.   elseif (rice isin $1-) set %a Team Rice
  649.   elseif (sanders isin $1-) set %a Team Sanders
  650.   elseif (jr isin $1-) set %a Team Rice
  651.   elseif (ds isin $1-) set %a Team Sanders
  652.  
  653.   if (!$team.colors) return 12 $+ $remove($strip(%a),[,]) $+ 
  654.   else return %a
  655. }
  656.  
  657. alias -l team.lookup {
  658.   var %a
  659.   if (Arizona isin $1-) set %a $v1
  660.   elseif (Atlanta isin $1-) set %a $v1
  661.   elseif (Baltimore isin $1-) set %a $v1
  662.   elseif (Buffalo isin $1-) set %a $v1
  663.   elseif (Carolina isin $1-) set %a $v1
  664.   elseif (Chicago isin $1-) set %a $v1
  665.   elseif (CINCINNATI isin $1-) set %a $v1
  666.   elseif (CLEVELAND isin $1-) set %a $v1
  667.   elseif (DALLAS isin $1-) set %a $v1
  668.   elseif (DENVER isin $1-) set %a $v1
  669.   elseif (DETROIT isin $1-) set %a $v1
  670.   elseif (GREEN BAY isin $1-) set %a $v1
  671.   elseif (HOUSTON isin $1-) set %a $v1
  672.   elseif (INDIANAPOLIS isin $1-) set %a $v1
  673.   elseif (JACKSONVILLE isin $1-) set %a $v1
  674.   elseif (KANSAS CITY isin $1-) set %a $v1
  675.   elseif (MIAMI isin $1-) set %a $v1
  676.   elseif (MINNESOTA isin $1-) set %a $v1
  677.   elseif (NEW ENGLAND isin $1-) set %a $v1
  678.   elseif (NEW ORLEANS isin $1-) set %a $v1
  679.   elseif (NY GIANTS isin $1-) || (N. Y. GIANTS isin $1-) set %a N. Y. GIANTS
  680.   elseif (NY JETS isin $1-) || (N. Y. JETS isin $1-) set %a N. Y. Jets
  681.   elseif (OAKLAND isin $1-) set %a $v1
  682.   elseif (PHILADELPHIA isin $1-) set %a $v1
  683.   elseif (PITTSBURGH isin $1-) set %a $v1
  684.   elseif (SAN DIEGO isin $1-) set %a $v1
  685.   elseif (SEATTLE isin $1-) set %a $v1
  686.   elseif (SAN FRANCISCO isin $1-) set %a $v1
  687.   elseif (ST. LOUIS isin $1-) set %a $v1
  688.   elseif (TAMPA BAY isin $1-) set %a $v1
  689.   elseif (TENNESSEE isin $1-) set %a $v1
  690.   elseif (WASHINGTON isin $1-) set %a $v1
  691.  
  692.   elseif (Cardinals isin $1-) set %a Arizona
  693.   elseif (Falcons isin $1-) set %a Atlanta
  694.   elseif (Ravens isin $1-) set %a Baltimore
  695.   elseif (Bills isin $1-) set %a Buffalo
  696.   elseif (Panthers isin $1-) set %a Carolina
  697.   elseif (Bears isin $1-) set %a Chicago
  698.   elseif (Bengals isin $1-) set %a Cincinnati
  699.   elseif (Browns isin $1-) set %a Cleveland
  700.   elseif (Cowboys isin $1-) set %a Dallas
  701.   elseif (Broncos isin $1-) set %a Denver
  702.   elseif (Lions isin $1-) set %a Detroit
  703.   elseif (Packers isin $1-) set %a Green Bay
  704.   elseif (Texans isin $1-) set %a Houston
  705.   elseif (Colts isin $1-) set %a Indianapolis
  706.   elseif (Jaguars isin $1-) set %a Jacksonville
  707.   elseif (Chiefs isin $1-) set %a Kansas City
  708.   elseif (Dolphins isin $1-) set %a Miami
  709.   elseif (Vikings isin $1-) set %a Minnesota
  710.   elseif (Patriots isin $1-) set %a New England
  711.   elseif (Saints isin $1-) set %a New Orleans
  712.   elseif (GIANTS isin $1-) set %a N.Y. Giants
  713.   elseif (JETS isin $1-) set %a N.Y. Jets
  714.   elseif (Raiders isin $1-) set %a Oakland
  715.   elseif (Eagles isin $1-) set %a Philadelphia
  716.   elseif (Steelers isin $1-) set %a Pittsburgh
  717.   elseif (Chargers isin $1-) set %a San Diego
  718.   elseif (Seahawks isin $1-) set %a Seattle
  719.   elseif (49ers isin $1-) set %a San Francisco
  720.   elseif (Rams isin $1-) set %a ST. Louis
  721.   elseif (Buccaneers isin $1-) set %a Tampa Bay
  722.   elseif (Titans isin $1-) set %a Tennessee
  723.   elseif (Redskins isin $1-) set %a Washington
  724.  
  725.   elseif (rice isin $1-) set %a Team Rice
  726.   elseif (sanders isin $1-) set %a Team Sanders
  727.   elseif (jr isin $1-) set %a Team Rice
  728.   elseif (ds isin $1-) set %a Team Sanders
  729.  
  730.   else return $1-
  731.  
  732.   return %a
  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,%opt = <> $remove($1-,> <,><,$chr(9)) <>,%n = 2
  759.     ; using $gettok() I checked the text in front of '>' (chr 62)
  760.     ; then the second $gettok checks the text behind '<' (chr 60)
  761.     ; so I'm extracting anything between >text<
  762.     WHILE ($gettok($gettok(%opt,%n,62),1,60)) {
  763.       ; take each peice of text and add it to the same variable
  764.       %strip = %strip $ifmatch
  765.       %strip = $replace(%strip,&quot;,")
  766.       ; increase the variable so the while statement can check the next part
  767.       INC %n
  768.     }
  769.     ; now that the loop has finished we can return the stripped html code
  770.     RETURN $xchr(%strip)
  771.   }
  772. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement