Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- ;script !NHL Script
- ;version 09NOV2014
- ;author mruno
- ;email mruno@ircN.org
- ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- ;
- ;
- ;to disable team colors, change alias -l NHL.team.colors return 0
- ;to enable team colors, change alias -l NHL.team.colors return 1
- ;
- ;to enable !scorealert, change alias -l NHL.scorealert.enable return 1
- ;to disable !scorealert, change alias -l NHL.scorealert.enable return 0
- ;
- ;######################################################
- ;
- alias -l NHL.team.colors return 0
- alias -l NHL.scorealert.enable return 1
- ;
- ;######################################################
- ;
- ;
- alias -l set.correct.network {
- if ($1) {
- var %loop 0
- while ($scon(0) > %loop) {
- inc %loop
- if ($scon(%loop).network == $1) {
- scon %loop
- break
- }
- }
- }
- }
- on 1:PART:#:{
- if ($hget(NHL.get.scores.NHL.alert,$+($nick,.,$network,.,$chan))) {
- hdel NHL.get.scores.NHL.alert $+($nick,.,$network,.,$chan)
- msg $nick Your NHL ScoreAlert has been deleted for parting.
- }
- }
- on 1:JOIN:#:if ($timer(NHL.get.scores.NHL.remove.alert. $+ $+($nick,.,$network,.,$chan))) .timerNHL.get.scores.NHL.remove.alert. $+ $+($nick,.,$network,.,$chan) off
- on 1:KICK:#:if ($hget(NHL.get.scores.NHL.alert,$+($nick,.,$network,.,$chan))) .timerNHL.get.scores.NHL.remove.alert. $+ $+($nick,.,$network,.,$chan) 1 120 hdel NHL.get.scores.NHL.alert $+($nick,.,$network,.,$chan)
- on 1:QUIT:if ($hget(NHL.get.scores.NHL.alert)) hdel -w NHL.get.scores.NHL.alert $nick $+ .*
- on 1:NICK:{
- if ($hget(NHL.get.scores.NHL.alert,$+($nick,.,$network,.,$chan))) {
- hadd NHL.get.scores.NHL.alert $newnick $+ . $+ $chan $hget(NHL.get.scores.NHL.alert,$+($nick,.,$network,.,$chan))
- hdel NHL.get.scores.NHL.alert $+($nick,.,$network,.,$chan)
- }
- }
- on 1:TEXT:?scorealert*:#:{
- if (!$NHL.scorealert.enable) return
- if ($2 != NHL) {
- .timerscorealertNHL 1 2 .notice $nick For NHL scorealerts, Type !scorealert NHL <team>
- halt
- }
- if ($3 == off) {
- if ($hget(NHL.get.scores.NHL.alert $+($nick,.,$network,.,$chan))) hdel NHL.get.scores.NHL.alert $+($nick,.,$network,.,$chan)
- .notice $nick Deleted your ScoreAlert.
- return
- }
- if ($4 == off) {
- if ($hget(NHL.get.scores.NHL.alert,$+($nick,.,$network,.,$chan))) || ($nick isop $chan) {
- if ($team.lookup($3)) {
- if ($hget(NHL.get.scores.NHL.alert,$+($nick,.,$network,.,$chan))) {
- hdel NHL.get.scores.NHL.alert $+($nick,.,$network,.,$chan)
- .notice $nick Deleted your ScoreAlert for $3
- return
- }
- if ($nick isop $chan) {
- var %a = 0
- while (%a < $hfind(NHL.get.scores.NHL.alert,* $+ $team.lookup($3) $+ *,0,w).data) {
- inc %a
- if ($gettok($hfind(NHL.get.scores.NHL.alert,* $+ $team.lookup($3) $+ *,%a,w).data,2,46) == $chan) {
- hdel NHL.get.scores.NHL.alert $hfind(NHL.get.scores.NHL.alert,* $+ $team.lookup($3) $+ *,%a,w).data
- .notice $nick Deleted ScoreAlert for $3
- return
- }
- }
- }
- }
- else .notice $nick Invalid team name.
- }
- return
- }
- else {
- if (%NHL.get.scores.NHL.ON) || ($hget(NHL.get.scores)) {
- .timerNHL. $+ $nick 1 3 .notice $nick Please try again in 1 minute.
- if (!$timer(NHL.get.scores.NHL.Timeout)) .timerNHL.get.scores.NHL.Timeout 1 15 NHL.get.scores.NHL.Timeout 1
- halt
- }
- if ($3) {
- if ($team.lookup($3)) {
- if ($hget(NHL.get.scores.NHL.alert,$+($nick,.,$network,.,$chan))) .notice $nick Your current scorealert $paren($gettok($v1,1,187)) will be overwritten.
- set %NHL.get.scores.NHL.TEMP.info scorealert
- set %NHL.get.scores.NHL.TEMP.search $team.lookup($3)
- set %NHL.get.scores.NHL.TEMP.chan $chan
- set %NHL.get.scores.NHL.TEMP.nick $nick
- NHL.get.scores
- }
- else .notice $nick Invalid team name.
- }
- else .notice $nick Please specify a team.
- }
- }
- on 1:TEXT:?NHL*:#:{
- set %NHL.get.scores.NHL.TEMP.chan $chan
- set %NHL.get.scores.NHL.TEMP.nick $nick
- if (%NHL.get.scores.NHL.ON) || ($hget(NHL.get.scores)) {
- .timerNHL.spam. $+ nick 1 3 .notice %NHL.get.scores.NHL.TEMP.nick Please try again in 1 minute.
- if (!$timer(NHL.get.scores.NHL.Timeout)) .timerNHL.get.scores.NHL.Timeout 1 15 NHL.get.scores.NHL.Timeout 1
- }
- else {
- if ($2 == all) || ($2 == final) || ($2 == current) || ($2 == upcoming) || ($2 == now) set %NHL.get.scores.NHL.TEMP.info $iif($2 == now,current,$2)
- elseif ($2 == Sunday) || ($2 == Monday) || ($2 == Tuesday) || ($2 == Wednesday) || ($2 == Thursday) || ($2 == Friday) || ($2 == Saturday) || ($2 == Today) || ($2 == Tomorrow) || ($2 == Yesterday) {
- set %NHL.get.scores.NHL.TEMP.info search
- if ($2 == today) set %NHL.get.scores.NHL.TEMP.search $asctime($ctime,dddd)
- elseif ($2 == tomorrow) set %NHL.get.scores.NHL.TEMP.search $asctime($calc(86400 + $ctime),dddd)
- elseif ($2 == yesterday) set %NHL.get.scores.NHL.TEMP.search $asctime($calc($ctime - 86400),dddd)
- else set %NHL.get.scores.NHL.TEMP.search $2
- }
- elseif ($team.lookup($2)) {
- set %NHL.get.scores.NHL.TEMP.info search
- set %NHL.get.scores.NHL.TEMP.search $ifmatch
- }
- elseif (search isin $2) {
- if ($3) {
- if ($3 == today) {
- ;if ($3 == Sunday) || ($3 == Monday) || ($3 == Tuesday) || ($3 == Wednesday) || ($3 == Thursday) || ($3 == Friday) || ($3 == Saturday) || ($3 == Today) || ($3 == Tomorrow) || ($3 == Yesterday) {
- set %NHL.get.scores.NHL.TEMP.info search
- if ($3 == today) set %NHL.get.scores.NHL.TEMP.search $asctime($ctime,dddd)
- elseif ($3 == tomorrow) set %NHL.get.scores.NHL.TEMP.search $asctime($calc(86400 + $ctime),dddd)
- elseif ($3 == yesterday) set %NHL.get.scores.NHL.TEMP.search $asctime($calc($ctime - 86400),dddd)
- else set %NHL.get.scores.NHL.TEMP.search $3
- }
- elseif ($team.lookup($3)) {
- set %NHL.get.scores.NHL.TEMP.info search
- set %NHL.get.scores.NHL.TEMP.search $team.lookup($3)
- }
- else { .notice $nick Invalid search item. Use a team name or city. | halt }
- }
- }
- elseif ($2) { .notice $nick Invalid option or team name. Try $1 Search <team> or $1 Current or $1 Final or $1 Upcoming | halt }
- if (!$2) {
- .timer 1 3 .notice $nick You can also use the following options: Current, Final, or Search <team>. Example: $1 Search Bulls
- .timer 1 3 .notice $nick Or you can have scores messaged to the channel by using: !ScoreAlert NHL <team>
- }
- if (!%NHL.get.scores.NHL.TEMP.info) set %NHL.get.scores.NHL.TEMP.info $iif($2,$2,all)
- set %NHL.get.scores.NHL.TEMP.chan $chan
- set %NHL.get.scores.NHL.TEMP.nick $nick
- NHL.get.scores
- }
- }
- alias NHL.get.scores.NHL.msg {
- if (%NHL.get.scores.NHL.TEMP.chan) msg %NHL.get.scores.NHL.TEMP.chan $1-
- }
- alias NHL.get.scores {
- if (%NHL.get.scores.NHL.TEMP.nick) .notice %NHL.get.scores.NHL.TEMP.nick !NHL by mruno gathering data, please wait...
- if ($sock(NHL.get.scores)) sockclose NHL.get.scores
- set -u45 %NHL.get.scores.NHL.ON 1
- if (!$hget(NHL.get.scores)) hmake NHL.get.scores
- sockopen NHL.get.scores scores.covers.com 80
- .timerNHL.get.scores.NHL.Timeout 1 30 NHL.get.scores.NHL.Timeout
- }
- alias NHL.get.scores.NHL.Timeout {
- if (%NHL.get.scores.NHL.TEMP.info != alert.check) && (!$1) NHL.get.scores.NHL.msg Error: The NHL request timed out. Please try again later. :(
- NHL.get.scores.NHL.Close
- }
- alias NHL.get.scores.NHL.alert.check {
- if (!$hget(NHL.get.scores.NHL.options)) hmake NHL.get.scores.NHL.options
- if (!$hget(NHL.get.scores.NHL.options,alert.check)) hadd NHL.get.scores.NHL.options alert.check 1
- else {
- if ($hget(NHL.get.scores.NHL.options,alert.check) > 2) && (!%NHL.get.scores.NHL.ON) {
- ;check for updated scores
- set %NHL.get.scores.NHL.TEMP.info alert.check
- hadd NHL.get.scores.NHL.options alert.check 0
- NHL.get.scores
- }
- else hinc NHL.get.scores.NHL.options alert.check
- }
- if (!$hget(NHL.get.scores.NHL.alert,0).item) {
- .timerNHL.get.scores.NHL.alert off
- hfree NHL.get.scores.NHL.alert
- hfree NHL.get.scores.NHL.options
- }
- }
- alias NHL.get.scores.NHL.scorealert {
- if (!$1) return
- if (!$hget(NHL.get.scores.NHL.alert)) hmake NHL.get.scores.NHL.alert
- if ($hget(NHL.get.scores.NHL.alert,%NHL.get.scores.NHL.TEMP.nick)) NHL.get.scores.NHL.msg %NHL.get.scores.NHL.TEMP.nick $+ $chr(44) You can only can track one NHL team at a time.
- else {
- ;team»Current»Today»Now»Oakland at Denver»Pre-game »null:null
- hadd NHL.get.scores.NHL.alert %NHL.get.scores.NHL.TEMP.nick $+ . $+ %NHL.get.scores.NHL.TEMP.chan $+($gettok($1-,1,187),$chr(187),$gettok($1-,7,187))
- NHL.get.scores.NHL.msg 15,1 NHL Now monitoring:12 $gettok($1-,5,187) Score:12 $replace( $+ $gettok($1-,7,187),:,$chr(32) to $chr(32),null,0)
- ;.notice %NHL.get.scores.NHL.TEMP.nick If you leave this channel, score alerts will be disabled.
- if (!$timer(NHL.get.scores.NHL.alert)) .timerNHL.get.scores.NHL.alert 0 60 NHL.get.scores.NHL.alert.check
- }
- }
- alias NHL.get.scores.NHL.End {
- var %a = 0, %item, %items, %team1, %team2, %data
- ;scorealert
- if ($hget(NHL.get.scores.NHL.alert)) {
- while ($hget(NHL.get.scores.NHL.alert,0).item > %a) {
- inc %a
- set %item $hget(NHL.get.scores.NHL.alert,%a).item
- set %data $hget(NHL.get.scores.NHL.alert,%a).data
- var %newdata $hget(NHL.get.scores,$hfind(NHL.get.scores,* $+ $gettok(%data,1,187) $+ *,1,w).data)
- if (%newdata) {
- if ($gettok(%newdata,1,187) == final) {
- ;msg final score here
- ;check and see if score alert is still needed
- ;Current»Today»Now»Oakland at Denver»Pre-game »null:null
- var %sep $iif(vs isin $gettok(%newdata,4,187),vs,at)
- var %team1 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%newdata,4,187),1- $+ $calc($findtok($gettok(%newdata,4,187),%sep,1,32) - 1),32))
- var %team2 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%newdata,4,187),$calc($findtok($gettok(%newdata,4,187),%sep,1,32) + 1) $+ -,32))
- if (%team isin %team1) var %team0 %team1
- else var %team0 %team2
- set %team1 $remove($strip(%team1),[,],)
- set %team2 $remove($strip(%team2),[,],)
- var %teams, %winner
- if ($gettok($replace($gettok(%newdata,5,187),null,0),1,58) > $gettok($replace($gettok(%newdata,5,187),null,0),2,58)) {
- set %teams $+ %team1 $+ at %team2 $+
- set %winner $strip(%team1)
- }
- elseif ($gettok($replace($gettok(%newdata,5,187),null,0),1,58) < $gettok($replace($gettok(%newdata,5,187),null,0),2,58)) {
- set %teams %team1 at %team2 $+
- set %winner $strip(%team2)
- }
- else set %teams %team1 at %team2
- var %rand $rand(1,15)
- .timerScoreAlert. $+ $gettok(%item,2,46) $+ . $+ $replace(%Teams,$chr(32),.) 1 %rand msg $gettok(%item,2,46) 15,1 NHL 4Final: %teams 12Score:2 $replace( $+ $gettok(%newdata,5,187),:,$chr(32) to $chr(32),null,0)
- .msg $gettok(%item,1,46) 15,1 NHL 4Final: %teams 12Score:2 $replace( $+ $gettok(%newdata,5,187),:,$chr(32) to $chr(32),null,0)
- hdel NHL.get.scores.NHL.alert %item
- }
- else {
- if ($gettok(%newdata,6,187) != $gettok(%data,2,187)) {
- var %sep $iif(vs isin $gettok(%newdata,4,187),vs,at)
- var %team1 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%newdata,4,187),1- $+ $calc($findtok($gettok(%newdata,4,187),%sep,1,32) - 1),32))
- var %team2 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%newdata,4,187),$calc($findtok($gettok(%newdata,4,187),%sep,1,32) + 1) $+ -,32))
- if (%team isin %team1) var %team0 %team1
- else var %team0 %team2
- set %team1 $remove($strip(%team1),[,],)
- set %team2 $remove($strip(%team2),[,],)
- var %teams
- if ($gettok($replace($gettok(%newdata,6,187),null,0),1,58) > $gettok($replace($gettok(%newdata,6,187),null,0),2,58)) set %teams $+ %team1 $+ at %team2 $+
- elseif ($gettok($replace($gettok(%newdata,6,187),null,0),1,58) < $gettok($replace($gettok(%newdata,6,187),null,0),2,58)) set %teams %team1 at $+ %team2 $+
- else set %teams %team1 at %team2
- .timerScoreAlert. $+ $gettok(%item,2,46) $+ . $+ $replace(%Teams,$chr(32),.) 1 $rand(1,10) msg $gettok(%item,2,46) 4[!ScoreAlert] 15,1 NHL %teams 12 New Score:2 $replace( $+ $gettok(%newdata,6,187),:,$chr(32) to $chr(32),null,0) 14 Status:3 $gettok(%newdata,5,187)
- hadd NHL.get.scores.NHL.alert %item $gettok(%data,1,187) $+ $chr(187) $+ $gettok(%newdata,6,187)
- }
- }
- }
- }
- }
- if (%NHL.get.scores.NHL.TEMP.info == alert.check) {
- if ($hget(NHL.get.scores)) hfree NHL.get.scores
- unset %NHL.get.scores*
- sockclose NHL.get.scores
- return
- }
- if (%NHL.get.scores.NHL.TEMP.info == scorealert) && (%NHL.get.scores.NHL.TEMP.search) {
- if ($hget(NHL.get.scores,$hfind(NHL.get.scores,*current* $+ %NHL.get.scores.NHL.TEMP.search $+ *,1,w).data)) {
- NHL.get.scores.NHL.scorealert %NHL.get.scores.NHL.TEMP.search $+ $chr(187) $+ $ifmatch
- .notice %NHL.get.scores.NHL.TEMP.nick Your ScoreAlert will be disabled if you leave %NHL.get.scores.NHL.TEMP.chan or by typing 12!ScoreAlert NHL off
- }
- else NHL.get.scores.NHL.msg %NHL.get.scores.NHL.TEMP.nick $+ $chr(44) please choose an NHL game that is currently playing. $iif($hfind(NHL.get.scores,*upcoming* $+ %NHL.get.scores.NHL.TEMP.search $+ *,1,w).data,%NHL.get.scores.NHL.TEMP.search plays on12 $gettok($hget(NHL.get.scores,$ifmatch),2,187) at $gettok($hget(NHL.get.scores,$ifmatch),3,187))
- }
- ;team search
- if (%NHL.get.scores.NHL.TEMP.info == search) && (%NHL.get.scores.NHL.TEMP.search) {
- var %a = 0, %item, %items, %team0, %team1, %team2, %team = %NHL.get.scores.NHL.TEMP.search
- set %item $hget(NHL.get.scores,$hfind(NHL.get.scores,* $+ %team $+ *,1,w).data)
- if (!%item) set %item $hget(NHL.get.scores,$hfind(NHL.get.scores,* $+ $left(%team,3) $+ *,1,w).data)
- if (!%item) {
- NHL.get.scores.NHL.msg Sorry, there are no NHL games found for: %team :(
- NHL.get.scores.NHL.Close
- return
- }
- if (%team == Sun) || (%team == Sunday) || (%team == Mon) || (%team == Monday) || (%team == Tue) || (%team == Tuesday) || (%team == Wed) || (%team == Wednesday) || (%team == Thu) || (%team == Thursday) || (%team == Fri) || (%team == Friday) || (%team == Sat) || (%team == Saturday) || (%team == Today) || (%team == Tomorrow) || (%team == Yesterday) {
- ;Day Search
- set %abbr $left(%team,3)
- var %a = 0, %games, %temp
- while ($hfind(NHL.get.scores,* $+ %abbr $+ *,0,w).data > %a) {
- inc %a
- if (%a == 1) NHL.get.scores.NHL.msg 15,1 NHL $gettok(%item,2,187) $+ :
- set %temp $gettok($hfind(NHL.get.scores,* $+ %abbr $+ *,%a,w).data,2,46)
- if ($len(%temp) == 1) set %temp 0 $+ %temp
- set %games $addtok(%temp,%games,32)
- }
- set %games $sorttok(%games,32)
- set %a 0
- var %game
- while ($gettok(%games,0,32) > %a) {
- inc %a
- set %game NHL. $+ $iif($left($gettok(%games,%a,32),1) == 0,$right($gettok(%games,%a,32),1),$gettok(%games,%a,32))
- set %item $hget(NHL.get.scores,%game)
- if ($gettok(%item,1,187) == Upcoming) NHL.get.scores.NHL.upcoming %item
- elseif ($gettok(%item,1,187) == Final) {
- NHL.get.scores.NHL.final %item
- }
- elseif ($gettok(%item,1,187) == Current) {
- NHL.get.scores.NHL.current %item
- }
- }
- ;end of loop
- }
- elseif ($gettok(%item,1,187) == upcoming) {
- set %team %NHL.get.scores.NHL.TEMP.search
- var %sep $iif(vs isin $gettok(%item,4,187),vs,at)
- set %team1 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),1- $+ $calc($findtok($gettok(%item,4,187),%sep,1,32) - 1),32))
- set %team2 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),$calc($findtok($gettok(%item,4,187),%sep,1,32) + 1) $+ -,32))
- if (%team isin %team1) set %team0 %team1
- else set %team0 %team2
- var %consensus
- if ($chr(37) isin $remove($gettok(%item,7,187),$chr(32))) {
- if ($remove($gettok(%item,7,187),$chr(32)) == $remove($gettok(%item,9,187),$chr(32))) set %consensus Dead Even
- 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)))
- 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)))
- }
- NHL.get.scores.NHL.msg 15,1 NHL %team0 14Record:12 $iif($gettok($gettok(%item,$iif($gettok(%team,0,32) == 1,4,4-5),187),1,32) isin $strip(%team0),$gettok(%item,6,187),$gettok(%item,$iif(%consensus,8,7),187))
- NHL.get.scores.NHL.msg 14Next game:12 $gettok(%item,4,187) 14 $paren( $+ $gettok(%item,2,187) @ $gettok(%item,3,187) $+ 14) $iif(%consensus,14Consensus: %consensus)
- }
- elseif ($gettok(%item,1,187) == final) {
- var %sep $iif(vs isin $gettok(%item,4,187),vs,at)
- set %team1 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),1- $+ $calc($findtok($gettok(%item,4,187),%sep,1,32) - 1),32))
- set %team2 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),$calc($findtok($gettok(%item,4,187),%sep,1,32) + 1) $+ -,32))
- if (%team isin %team1) set %team0 %team1
- else set %team0 %team2
- set %team1 $remove($strip(%team1),[,],)
- set %team2 $remove($strip(%team2),[,],)
- var %teams
- 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 $+
- 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 $+
- else set %teams %team1 at %team2
- NHL.get.scores.NHL.msg 15,1 NHL %team0 Last game:12 $gettok(%item,2,187)
- NHL.get.scores.NHL.msg %teams - Score: $replace($gettok(%item,5,187),null,0,:,$chr(32) to $chr(32)) - $paren(12FINAL)
- }
- elseif ($gettok(%item,1,187) == current) {
- set %team1 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),1- $+ $calc($findtok($gettok(%item,4,187),%sep,1,32) - 1),32))
- set %team2 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),$calc($findtok($gettok(%item,4,187),%sep,1,32) + 1) $+ -,32))
- if (%team isin %team1) set %team0 %team1
- else set %team0 %team2
- set %team1 $remove($strip(%team1),[,],)
- set %team2 $remove($strip(%team2),[,],)
- var %teams
- 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 $+
- 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 $+
- else set %teams %team1 at %team2
- NHL.get.scores.NHL.msg 15,1 NHL %team0 14Currently playing: $replace($gettok(%item,4,187),at,14@)
- NHL.get.scores.NHL.msg 14Score:12 $replace($gettok(%item,6,187),null,0,:,$chr(32) to $chr(32)) 14Status:12 $gettok(%item,5,187) $iif(%NHL.get.scores.NHL.TEMP.GameStatus,- %NHL.get.scores.NHL.TEMP.GameStatus)
- }
- }
- if (%NHL.get.scores.NHL.TEMP.info == all) || (%NHL.get.scores.NHL.TEMP.info == current) {
- ;gathers all the CURRENT games
- while (%a < $hget(NHL.get.scores,0).item) {
- inc %a
- set %item $hget(NHL.get.scores,%a).item
- if ($gettok($hget(NHL.get.scores,%item),1,187) == Current) set %items $addtok(%items,%item,44)
- }
- ;echoes all the CURRENT games
- ;Current»Today»Now»Oakland at Denver»Pre-game »null:null
- set %a 0
- set %item
- if (%items) {
- NHL.get.scores.NHL.msg 15,1 NHL Games 12currently playing:
- while (%a < $gettok(%items,0,44)) {
- inc %a
- ;if (%a == 1) NHL.get.scores.NHL.msg 15,1 NHL
- set %item $hget(NHL.get.scores,$gettok(%items,%a,44))
- NHL.get.scores.NHL.current %item
- }
- }
- else {
- if (%NHL.get.scores.NHL.TEMP.info == current) NHL.get.scores.NHL.msg There are currently no NHL games being played.
- }
- }
- if (%NHL.get.scores.NHL.TEMP.info == all) || (%NHL.get.scores.NHL.TEMP.info == final) {
- ;gathers all the FINAL games
- ;Final»Thursday September 19 2013»0»Kansas City at Philadelphia »26:16
- set %a 0
- set %item
- set %items
- while (%a < $hget(NHL.get.scores,0).item) {
- inc %a
- set %item $hget(NHL.get.scores,%a).item
- if ($gettok($hget(NHL.get.scores,%item),1,187) == FINAL) set %items $addtok(%items,%item,44)
- }
- ;echoes all the FINAL games
- set %a 0
- set %item
- if (%items) {
- while (%a < $gettok(%items,0,44)) {
- inc %a
- set %item $hget(NHL.get.scores,$gettok(%items,%a,44))
- ;if (%a == 1) NHL.get.scores.NHL.msg 15,1 NHL
- NHL.get.scores.NHL.final %item
- }
- }
- else {
- if (%NHL.get.scores.NHL.TEMP.info == final) NHL.get.scores.NHL.msg There are currently no NHL final games for this week.
- }
- }
- if (%NHL.get.scores.NHL.TEMP.info == all) || (%NHL.get.scores.NHL.TEMP.info == upcoming) {
- ; Upcoming»Monday September 23 2013»8:40p ET»Oakland at Denver» »1-1 (0-1 V) »36% »2-0 (1-0 H) »64%
- var %a = 1, %data, %last, %item, %total = 0
- while ($hget(NHL.get.scores,NHL. $+ %a)) {
- set %data $hget(NHL.get.scores,NHL. $+ %a)
- if (upcoming isin $gettok(%data,1,187)) {
- if (%last != $gettok(%data,2,187)) NHL.get.scores.NHL.msg 15,1 NHL $gettok(%data,2,187) $+ :
- inc %total
- NHL.get.scores.NHL.upcoming %data
- }
- set %last $gettok(%data,2,187)
- inc %a
- }
- if (!%total) && (%NHL.get.scores.NHL.TEMP.info == upcoming) NHL.get.scores.NHL.msg There are no more NHL upcoming games for this week.
- }
- .timerNHL.get.scores.NHL.Close 1 15 NHL.get.scores.NHL.Close
- }
- alias NHL.get.scores.NHL.final {
- if (!$1) return
- var %item = $1-, %team1, %team2
- var %sep $iif(vs isin $gettok(%item,4,187),vs,at)
- set %team1 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),1- $+ $calc($findtok($gettok(%item,4,187),%sep,1,32) - 1),32))
- set %team2 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),$calc($findtok($gettok(%item,4,187),%sep,1,32) + 1) $+ -,32))
- var %teams
- 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 $+
- 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 $+
- else set %teams %team1 14@ %team2
- NHL.get.scores.NHL.msg %teams 14 Score:12 $replace($gettok(%item,5,187),null,0,:,$chr(32) 14to12 $chr(32)) 14 Status:4 FINAL
- }
- alias NHL.get.scores.NHL.upcoming {
- if (!$1) return
- var %item $1-
- var %sep $iif(vs isin $gettok(%item,4,187),vs,at)
- var %team1 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),1- $+ $calc($findtok($gettok(%item,4,187),%sep,1,32) - 1),32))
- var %team2 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),$calc($findtok($gettok(%item,4,187),%sep,1,32) + 1) $+ -,32))
- var %consensus
- if ($chr(37) isin $remove($gettok(%item,7,187),$chr(32))) {
- if ($remove($gettok(%item,7,187),$chr(32)) == $remove($gettok(%item,9,187),$chr(32))) set %consensus Dead Even
- 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)))
- 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)))
- }
- NHL.get.scores.NHL.msg $gettok(%item,3,187) %team1 $paren($gettok($gettok(%item,6,187),1,32)) 14@ %team2 $paren($gettok($gettok(%item,$iif(%consensus,8,7),187),1,32)) $iif(%consensus,14 Consensus: %consensus)
- }
- alias NHL.get.scores.NHL.current {
- if (!$1) return
- var %item = $1-, %team1, %team2
- var %sep $iif(vs isin $gettok(%item,4,187),vs,at)
- set %team1 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),1- $+ $calc($findtok($gettok(%item,4,187),%sep,1,32) - 1),32))
- set %team2 $NHL.get.scores.NHL.teamcolors($gettok($gettok(%item,4,187),$calc($findtok($gettok(%item,4,187),%sep,1,32) + 1) $+ -,32))
- var %teams
- var %team1score $gettok($replace($gettok(%item,6,187),null,0),1,58)
- var %team2score $gettok($replace($gettok(%item,6,187),null,0),2,58)
- if (%team1score > %team2score) set %teams $+ %team1 14@ %team2
- elseif (%team1score < %team2score) set %teams %team1 14@ $+ %team2
- else set %teams %team1 14@ %team2
- NHL.get.scores.NHL.msg %teams 14 14Score: $replace($gettok(%item,6,187),null,0,:,$chr(32) to $chr(32)) 14 Status:3 $gettok(%item,5,187) $iif($gettok(%item,7,187),- $gettok(%item,7,187))
- }
- alias NHL.get.scores.NHL.Sorted {
- if ($1) {
- ;sorts items by putting all the dates in hash tables
- var %z = 0, %new
- while ($hget(NHL.get.scores,0).item > %z) {
- inc %z
- if (NHL. isin $hget(NHL.get.scores,%z).item) set %new $addtok(%new,$v2,44)
- }
- set %z 0
- var %data, %time, %data2, %all, %item
- while ($gettok(%items,0,44) > %z) {
- inc %z
- set %item $gettok(%items,%z,44)
- set %data $hget(NHL.get.scores,%item)
- set %new $gettok(%data,2,187) $+ . $+ $gettok(%data,3,187)
- set %data2 %new
- set %time $remove($gettok(%data2,2,46),p,a,et)
- set %time $calc($calc($gettok(%time,1,58) * 360) + $calc($gettok(%time,2,58) * 60))
- set %time $calc($ctime($gettok(%data2,1,46)) + %time)
- hadd NHL.get.scores %time $addtok($hget(NHL.get.scores,%time),%item,44)
- }
- var %z = 0
- set %new
- while ($hget(NHL.get.scores,0).item > %z) {
- inc %z
- if (NHL. !isin $hget(NHL.get.scores,%z).item) set %new $addtok(%new,$v2,44)
- }
- return $sorttok(%new,44,n)
- }
- }
- alias NHL.get.scores.NHL.Close {
- sockclose NHL.get.scores
- unset %NHL.get.scores.NHL.TEMP.*
- .timerhfree.NHL.get.scores 1 30 if ($hget(NHL.get.scores)) hfree NHL.get.scores
- }
- alias -l useragent {
- var %r $rand(1,11)
- if (%r == 1) return User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
- 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
- elseif (%r == 3) return User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)
- elseif (%r == 4) return User-Agent: Opera/9.20 (Windows NT 6.0; U; en)
- 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
- 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
- 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
- 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
- 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
- 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
- elseif (%r == 11) return User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0
- }
- on *:sockopen:NHL.get.scores: {
- sockwrite -nt $sockname GET /hockey-scores-matchups.aspx HTTP/1.1
- sockwrite -nt $sockname $useragent
- sockwrite -nt $sockname Host: scores.covers.com
- sockwrite -nt $sockname Accept-Language: en-us
- sockwrite -nt $sockname Accept: */*
- sockwrite -nt $sockname $crlf
- }
- on *:sockread:NHL.get.scores: {
- var %temp, %date, %item, %data
- if ($sockerr) {
- var %error
- if ($sockerr == 3) set %error Connection refused by remote host
- elseif ($sockerr == 4) set %error DNS lookup for hostname failed
- elseif ($sockerr > 0) set %error Unknown socket error ( $+ $sockerr $+ )
- echo -s NHL.get.scores: 4Socket Error: %error
- .timerNHL.get.scores.NHL.error 1 10 NHL.get.scores.NHL.msg 15,1 NHL Socket Error. Please try again later. :(
- .timerNHL.get.scores.NHL.close 1 15 NHL.get.scores.NHL.close
- halt
- }
- else {
- .timerNHL.get.scores.NHL.Timeout off
- sockread %temp
- ;STATUS»DATE»TIME»TEAMS»STATUS»SCORE(Away:Home)»Game Status
- ;new date for NHL games
- ;<h2><div ID="DayNav" class="date-nav"><a href="javascript:void(0);" onclick="javascript:ClientUpdateCalAndNav(9,'2014-2015',2014,11,7);">Fri, Nov 7</a> • <a><b>Sat, Nov 8</b></a> • <a href="javascript:void(0);" onclick="javascript:ClientUpdateCalAndNav(9,'2014-2015',2014,11,9);">Sun, Nov 9</a></div></h2>
- ;$wildtok(%test,nbsp;<a><b>*</b></a>,1,38)
- if (<h2><div ID="DayNav" class="date-nav"><a href="javascript:void(0);" onclick="javascript:ClientUpdateCalAndNav isin %temp) && (%date != $striphtml(%temp)) {
- set %NHL.get.scores.NHL.TEMP.DATE $remove($striphtml($wildtok(%test,nbsp;<a><b>*</b></a>,1,38)),nbsp;)
- }
- elseif (*<span class="activetab" id="In_Game_Status_6_*">Final</span>* iswm %temp) set %NHL.get.scores.NHL.TEMP.DATE Final
- else set %NHL.get.scores.NHL.TEMP.DATE Today
- ;if (<td colspan="2" class="scoreboard-left"><h2> isin %temp) && (%date != $striphtml(%temp)) set %NHL.get.scores.NHL.TEMP.DATE $remove($striphtml(%temp),$chr(44))
- if (*<td class="scoreboard-*">* iswm %temp) {
- if ($striphtml(%temp)) {
- if (!$hget(NHL.get.scores)) hmake NHL.get.scores
- ;In_Game_Status_6_
- unset %NHL.get.scores.NHL.TEMP.GameStatus
- set %item $striphtml(%temp)
- set %NHL.get.scores.NHL.TEMP.title $gettok($wildtok(%temp,*Title_6_*,1,60),2,62)
- if (Final isin %item) {
- ;Game Over
- set %NHL.get.scores.NHL.TEMP.STATUS Final
- hadd NHL.get.scores NHL. $+ $calc($hget(NHL.get.scores,0).item + 1) $+(Final,$chr(187),%NHL.get.scores.NHL.TEMP.DATE,$chr(187),0,$chr(187),$gettok($wildtok(%temp,*Title_6_*,1,60),2,62))
- }
- elseif (*AM ET* iswm %item) || (*PM ET* iswm %item) {
- ;Game Upcoming
- set %NHL.get.scores.NHL.TEMP.STATUS Upcoming
- hadd NHL.get.scores NHL. $+ $calc($hget(NHL.get.scores,0).item + 1) $+(Upcoming,$chr(187),%NHL.get.scores.NHL.TEMP.DATE,$chr(187),$replace($remove($gettok($wildtok(%temp,*span class="pretab">*,1,60),2,62),$chr(32)),pmET,p ET,amET,a ET),$chr(187),$gettok($wildtok(%temp,*Title_6_*,1,60),2,62),$chr(187))
- }
- else {
- ;Game is ON!
- set %NHL.get.scores.NHL.TEMP.STATUS Current
- hadd NHL.get.scores NHL. $+ $calc($hget(NHL.get.scores,0).item + 1) $+(Current,$chr(187),$asctime($ctime,dddd),$chr(187),Now,$chr(187),$gettok($wildtok(%temp,*Title_6_*,1,60),2,62),$chr(187),$gettok($wildtok(%temp,*In_Game_Status_6_*,1,60),2,62))
- }
- }
- }
- }
- ;if (*<td class="datac" id="*Score_6* iswm %temp) {
- if (<td class="datarcb isin %temp) {
- if (%NHL.get.scores.NHL.TEMP.STATUS == Current) || (%NHL.get.scores.NHL.TEMP.STATUS == Final) {
- var %i $hfind(NHL.get.scores,* $+ %NHL.get.scores.NHL.TEMP.title $+ *,1,w).data
- if (VisitScore isin %temp) {
- hadd NHL.get.scores %i $hget(NHL.get.scores,%i) $+($chr(187),$iif(!$striphtml(%temp),null,$remove($striphtml(%temp),$chr(32))),:)
- }
- elseif (HomeScore isin %temp) {
- hadd NHL.get.scores %i $hget(NHL.get.scores,%i) $+ $iif(!$striphtml(%temp),null,$remove($striphtml(%temp),$chr(32)))
- }
- }
- }
- if (%NHL.get.scores.NHL.TEMP.STATUS == Upcoming) && ($striphtml(%temp)) {
- var %i $hfind(NHL.get.scores,* $+ %NHL.get.scores.NHL.TEMP.title $+ *,1,w).data
- ;if (*<td class="data">*-* (*-* ?)</td>* iswm %temp) hadd NHL.get.scores %i $hget(NHL.get.scores,%i) $+($chr(187),$striphtml(%temp))
- if (*<td class="data">*(*)*</td>* iswm %temp) {
- hadd NHL.get.scores %i $hget(NHL.get.scores,%i) $+($chr(187),$striphtml(%temp))
- }
- if (*<td class="datac">*%</td>* iswm %temp) {
- ;consensus
- ;<td class="datac">68%</td>
- hadd NHL.get.scores %i $hget(NHL.get.scores,%i) $+($chr(187),$striphtml(%temp))
- }
- }
- .timerNHL.get.scores.NHL.End 1 3 NHL.get.scores.NHL.End
- }
- alias NHL.get.scores.NHL.teamcolors {
- if (!$1) return
- var %a
- if ($1- == Tampa Bay) set %a 0,3[ $v1 Lightning ]
- elseif (Montreal isin $1-) set %a 1,0[ $v1 Canadiens ]
- elseif (Detroit isin $1-) set %a 7,12[ $v1 Red Wings ]
- elseif (Boston isin $1-) set %a 12,0[ $v1 Bruins ]
- elseif (Ottawa isin $1-) set %a 4,1[ $v1 Senators ]
- elseif (Toronto isin $1-) set %a 1,4[ $v1 Maple Leafs ]
- elseif (Florida isin $1-) set %a 7,12[ $v1 Panthers ]
- elseif (Buffalo isin $1-) set %a 0,7[ $v1 Sabres ]
- elseif (Pittsburgh isin $1-) set %a 8,12[ $v1 Penguins ]
- elseif (N.Y. Islanders isin $1-) || (New York Islanders isin $1-) || (N. Y. Islanders isin $1-) || (NY Islanders isin $1-) set %a 7,3[ NY Islanders ]
- elseif (N.Y. Rangers isin $1-) || (New York Rangers isin $1-) || (N. Y. Rangers isin $1-) || (NY Rangers isin $1-) set %a 7,12[ NY Rangers ]
- elseif (Philadelphia isin $1-) set %a 1,11[ $v1 Flyers ]
- elseif (New Jersey isin $1-) set %a 1,7[ $v1 Devils ]
- elseif (Carolina isin $1-) set %a 1,11[ $v1 Hurricanes ]
- elseif (Washington isin $1-) set %a 7,2[ $v1 Capitals ]
- elseif (Dallas isin $1-) set %a 0,2[ $v1 Stars ]
- elseif (Columbus isin $1-) set %a 4,0[ $v1 Blue Jackets ]
- elseif (St. Louis isin $1-) set %a 10,1[ $v1 Blues ]
- elseif (Nashville isin $1-) set %a 8,2[ $v1 Predators ]
- elseif (Winnipeg isin $1-) set %a 15,1[ $v1 Jets ]
- elseif (Chicago isin $1-) set %a 7,10[ $v1 Black Hawks ]
- elseif (Minnesota isin $1-) set %a 11,14[ $v1 Wild ]
- elseif (Colorado isin $1-) set %a 11,7[ $v1 Avalanche ]
- elseif (Anaheim isin $1-) set %a 7,1[ $v1 Ducks ]
- elseif (Vancouver isin $1-) set %a 8,2[ $v1 Canucks ]
- elseif (Calgary isin $1-) set %a 8,12[ $v1 Flames ]
- elseif (San Jose isin $1-) set %a 8,12[ $v1 Sharks ]
- elseif (Los Angeles isin $1-) || (Los Angeles Kings isin $1-) || (L.A. Kings isin $1-) || (LA Kings isin $1-) || (L. A. Kings isin $1-) set %a 2,4[ Los Angeles Kings ]
- elseif (Arizona isin $1-) set %a 7,1[ $v1 Coyotes ]
- elseif (Edmonton isin $1-) set %a 6,15[ $v1 Oilers ]
- else {
- iecho 4ERROR UNKNOWN NHL TEAM: $1-
- return
- }
- if (!$team.colors) return 12 $+ $remove($strip(%a),[,]) $+
- else return %a
- }
- alias -l team.lookup {
- if (!$1) return
- var %a
- if (Tampa Bay isin $1-) set %a $v1
- elseif (Montreal isin $1-) set %a $v1
- elseif (Detroit isin $1-) set %a $v1
- elseif (Boston isin $1-) set %a $v1
- elseif (Ottawa isin $1-) set %a $v1
- elseif (Toronto isin $1-) set %a $v1
- elseif (Florida isin $1-) set %a $v1
- elseif (Buffalo isin $1-) set %a $v1
- elseif (Pittsburgh isin $1-) set %a $v1
- elseif (Philadelphia isin $1-) set %a $v1
- elseif (New Jersey isin $1-) set %a $v1
- elseif (N.Y. Islanders isin $1-) || (NY Islanders isin $1-) || (N. Y. Islanders isin $1-) || (New York Islanders isin $1-) set %a N.Y. Islanders
- elseif (N.Y. Rangers isin $1-) || (NY Rangers isin $1-) || (N. Y. Rangers isin $1-) || (New York Rangers isin $1-) set %a N.Y. Rangers
- elseif (Carolina isin $1-) set %a $v1
- elseif (Washington isin $1-) set %a $v1
- elseif (Dallas isin $1-) set %a $v1
- elseif (Columbus isin $1-) set %a $v1
- elseif (St. Louis isin $1-) set %a $v1
- elseif (Nashville isin $1-) set %a $v1
- elseif (Winnipeg isin $1-) set %a $v1
- elseif (Chicago isin $1-) set %a $v1
- elseif (Minnesota isin $1-) set %a $v1
- elseif (Colorado isin $1-) set %a $v1
- elseif (Anaheim isin $1-) set %a $v1
- elseif (Vancouver isin $1-) set %a $v1
- elseif (San Jose isin $1-) set %a $v1
- elseif (Los Angeles isin $1-) set %a $v1
- elseif (Arizona isin $1-) set %a $v1
- elseif (Edmonton isin $1-) set %a $v1
- elseif (Calgary isin $1-) set %a $v1
- elseif (Lightning isin $1-) set %a Tampa Bay
- elseif (Canadiens isin $1-) set %a Montreal
- elseif (Red Wings isin $1-) set %a Detroit
- elseif (Bruins isin $1-) set %a Boston
- elseif (Senators isin $1-) set %a Ottawa
- elseif (Maple Leafs isin $1-) set %a Toronto
- elseif (Panthers isin $1-) set %a Florida
- elseif (Sabres isin $1-) set %a Buffalo
- elseif (Penguins isin $1-) set %a Pittsburgh
- elseif (Flyers isin $1-) set %a Philadelphia
- elseif (Devils isin $1-) set %a New Jersey
- elseif (Hurricanes isin $1-) set %a Carolina
- elseif (Capitals isin $1-) set %a Washington
- elseif (Stars isin $1-) set %a Dallas
- elseif (Blue Jackets isin $1-) set %a Columbus
- elseif (Blues isin $1-) set %a St. Louis
- elseif (Predators isin $1-) set %a Nashville
- elseif (Jets isin $1-) set %a Winnipeg
- elseif (Black Hawks isin $1-) set %a Chicago
- elseif (Wild isin $1-) set %a Minnesota
- elseif (Avalanche isin $1-) set %a Colorado
- elseif (Ducks isin $1-) set %a Anaheim
- elseif (Canucks isin $1-) set %a Vancouver
- elseif (Sharks isin $1-) set %a San Jose
- elseif (Kings isin $1-) set %a Los Angeles
- elseif (Islanders isin $1-) set %a New York
- elseif (Rangers isin $1-) set %a New York
- elseif (Coyotes isin $1-) set %a Arizona
- elseif (Oilers isin $1-) set %a Edmonton
- elseif (Flames isin $1-) set %a Calgary
- else {
- iecho 4Error Unknown NHL team: $1-
- return $1-
- }
- return %a
- }
- alias -l paren if ($1) return ( $+ $1- $+ )
- ;==================================================================================
- ;Author : fubar
- ;Function: $striphtml identifier
- ; This identifier strips html code from a string of text.
- ; Good for using when retrieving webpages within mirc.
- ;==================================================================================
- ;
- ;This identifier strips html code from a string of text. Good for using when retrieving webpages within mirc.
- ;
- ;Usage: $striphtml(html code)
- alias -l Xchr {
- var %return $regsubex($regsubex($1-,/&#x([A-F0-9]{1,2});/g,$chr($base($regml(\n),16,10))),/&#([0-9]{2});/g,$chr(\1))
- return $replacecs(%return,–,,·,·,»,»,«,«,Ü,Ü,ü,ü,Á,Á,á,á,É,$&
- É,é,é,Í,Í,í,í,Ó,Ó,ó,ó,Ñ,Ñ,ñ,ñ,Ú,Ú,ú,ú, ,$chr(32),$&
- æ,æ,",")
- }
- alias -l striphtml {
- ; making sure there are parameters to work with
- IF ($1) {
- ; Setting my variables. The %opt is set kind of funky
- ; all it does is combine <two><brackets> into 1 <twobrackets>, fewer loops this way
- ; also stripped tab spaces
- VAR %strip
- var %opt <> $remove($1-,> <,><,$chr(9)) <>
- var %n 2
- ; using $gettok() I checked the text in front of '>' (chr 62)
- ; then the second $gettok checks the text behind '<' (chr 60)
- ; so I'm extracting anything between >text<
- WHILE ($gettok($gettok(%opt,%n,62),1,60)) {
- ; take each peice of text and add it to the same variable
- %strip = %strip $ifmatch
- %strip = $replace(%strip,",")
- ; increase the variable so the while statement can check the next part
- INC %n
- }
- ; now that the loop has finished we can return the stripped html code
- RETURN $xchr(%strip)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement