Advertisement
mruno

!nfl 27NOV2014 Turkey Day Edition! - Not working

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