All pastes #111169 Raw Edit

Untitled

public text v1 · immutable
·published 2006-08-02 06:08 UTC
rendered paste body
alias qu return $+(",$1,")

alias updatewr {
  set %btmatchbot
  if ($me ison #BT-Match) {
    if (^]-BT-MaTcH-[^ ison #BT-Match) {
      %btmatchbot = ^]-BT-MaTcH-[^
      write -c $qu($logdir_]-BT-MaTcH-[_.log)
    }
    else if (]-BT-MaTcH-[ ison #BT-Match) {
      %btmatchbot = ]-BT-MaTcH-[
      write -c $qu($logdir]-BT-MaTcH-[.log)
    }
    else {
      echo -ae $+(,$color(info)) Error: The BT-Match bot appears to be offline.
      halt
    }
    echo -s BOT is %btmatchbot
    log on %btmatchbot
    .timermsgbot -m 1 1500 .msg %btmatchbot !rec show
    .timerstartcon 1 20 rec2html.txt
  }
  else {
    echo -ae $+(,$color(info)) Error: You must be on #BT-Match to update the list!
  }
}

alias rec2html.txt {
  if ($isfile(BTWR.html)) write -c BTWR.html
  echo -a Starting conversion...
  set %recticks $ticks
  hmake recstats 100
  var %log, %c, %l
  if (%btmatchbot == ^]-BT-MaTcH-[^) %log = $qu($logdir_]-BT-MaTcH-[_.log)
  else if (%btmatchbot == ]-BT-MaTcH-[) %log =  $qu($logdir]-BT-MaTcH-[.log)
  %i = $lines(%log)
  window -h @lst | window -h @rec | window -h @stat
  loadbuf @lst %log
  while (%i) {
    %c = $line(@lst,%i)
    if ($regex(%c,/(?:http|www)/)) {
      !.echo -q $regsub(%c,/~\^\](.+)\[\^~/S,,%c)
      hinc recstats $gettok($regml(1),4,32)
      aline @rec $gettok($mid($regml(1),3-),1-7,32)
    }
    dec %i
  }
  filter -ct 3 32 @rec @rec
  %i = $hget(recstats,0).item
  while (%i) {
    %c = $hget(recstats,$hget(recstats,%i).item)
    aline @stat $hget(recstats,%i).item - $iif($len(%c) == 1,$+(0,%c),%c)
    dec %i
  }
  filter -ctue 3 32 @stat @stat
  rec2html.html
}

alias rec2html.html {
  write BTWR.html <html><head><title>BunnyTrack World Records</title><style> $crlf $&
    td,th $chr(123) font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; $chr(125) $crlf $&
    p $chr(123) font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #FFFFFF; $chr(125) $crlf $&
    tr.ctd $chr(123) background-color: #99CCFF; $chr(125) $crlf tr.ctd:hover $chr(123) background-color: #66CCFF; $chr(125) $crlf $&
    a $chr(123) text-decoration: none; color: #000000; $chr(125) a:hover $chr(123) text-decoration: underline; $chr(125) $crlf $&
    .nav $chr(123) font-size: 10px; $chr(125)
  write BTWR.html </style></head><body bgcolor=" $+ $chr(35) $+ 336699"><a name="top"></a><div align="center"> $crlf $&
    <img src="http://bunnytracks.com/images/btmatch.png" width="120" height="120"><br><p> $crlf $&
    <font style="font-size: 14px; font-weight: bold;"> $&
    <a href="irc://irc.quakenet.org/BT-MaTcH" style="color: #FFFFFF;">#BT-MaTcH</a> World Record List</font> $crlf $&
    <br>Click on a name to view that player's records<br>Click on a map to view a screenshot</p></div><center>
  write BTWR.html <table width="20%" border="0" cellspacing="1" cellpadding="3" bgcolor="#000000"> $crlf $&
    <tr><th bgcolor="#6699CC" colspan="2">Statistics</th></tr> $crlf $&
    <tr class="ctd"><td width="15%">Total Records</td><td width="5%" align="center"> $+ $line(@rec,0) $+ </td</tr> $crlf $&
    <tr class="ctd"><td width="15%">Ranked Players</td><td width="5%" align="center"> $+ $hget(recstats,0).item $+ </td</tr> $crlf $&
    </table><p></p>
  write BTWR.html <table border="0" width="100%"><tr><td colspan="1">&nbsp;</td> $crlf$&
    <td colspan="1"><font size="3" color="#FFFFFF">Player Sorted</font></td> $crlf $&
    <td colspan="1"><font size="3" color="#FFFFFF">Map Sorted</font></td></tr> $crlf $&
    <tr> $crlf <td width="30%" valign="top"> $crlf
  write BTWR.html <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#000000"> $crlf $&
    <tr><td bgcolor="#6699CC" width="5%" align="right"><b>Rank</b></td> $crlf $&
    <td bgcolor="#6699CC" width="90%"><b>Player</b></td> $crlf $&
    <th bgcolor="#6699CC" width="5%">Records</th></tr>
  rec2html.stat
}

alias rec2html.stat {
  var %i = 1, %l = $line(@stat,0), %c
  while (%i <= %l) {
    %c = $line(@stat,%i)
    write BTWR.html <tr class="ctd"><td width="5%" align="right"> $+ %i $+ .</td> $crlf $&
      <td width="90%"><a $+(href=",$chr(35),$gettok(%c,1,32),">) $+ $gettok(%c,1,32) $+ </a></td> $crlf $&
      <td width="5%" align="center"> $+ $&
      $iif($left($gettok(%c,3,32),1) == 0,$right($gettok(%c,3,32),1),$gettok(%c,3,32)) $+ </td></tr>
    inc %i
  }
  rec2html.rec
}

alias rec2html.rec {
  var %i = 1, %l = $hget(recstats,0).item, %ii, %ll, %c, %count, %d
  write BTWR.html </table></td><td width="35%" valign="top"> $crlf $&
    <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#000000"> $crlf
  filter -ct 1 32 @stat @stat
  while (%i <= %l) {
    %d = $line(@stat,%i)
    write BTWR.html <tr><td bgcolor="#6699CC" colspan="3"> $crlf $&
      <table border="0" width="100%"><tr><td width="70%"><b><a $+(name=",$gettok(%d,1,32),"></a>) $&
      $+ $gettok(%d,1,32) $+($chr(40),$hget(recstats,$gettok(%d,1,32)),$chr(41)) $&
      $+ </b></td><td width="30%" align="right"><span class="nav">[<a href="javascript:history.go(-1)">Back</a> $&
      $+ /<a href="#top">Top</a>]</span></td></tr></table></td></tr>
    %count = 0
    if (%i == 1) { 
      %ii = 1
      %ll = $hget(recstats,$gettok(%d,1,32))
    }
    else {
      %ll = $calc(%ii + $hget(recstats,$gettok(%d,1,32)) - 1)
    }
    while (%ii <= %ll) {
      %c = $line(@rec,%ii)
      inc %count
      write BTWR.html <tr class="ctd"><td width="5%" align="right"> $+ %count $+ .</td> $crlf $&
        <td width="85%"><a href=" $+ $gettok(%c,7,32) $+ "> $+ $gettok(%c,1,32) $+ </a></td> $crlf $&
        <td width="10%"> $+ $gettok(%c,5,32) $+ </td></tr>
      inc %ii
    }
    inc %i
  }
  write BTWR.html </table></td><td valign="top" width="35%" align="left"> $crlf
  filter -ct 1 32 @rec @rec
  write BTWR.html <table border="0" cellspacing="1" cellpadding="3" bgcolor="#000000"><tr> $crlf $&
    <td bgcolor="#6699CC" width="5%" >&nbsp;</td> $crlf $&
    <td bgcolor="#6699CC" width="55%" ><b>Map</b></td> $crlf $&
    <td bgcolor="#6699CC" width="30%" align="center"><b>Record Holder</b></td> $crlf $&
    <td bgcolor="#6699CC" width="10%" align="center"><b>Time</b></td></tr>
  %i = 1
  %l = $line(@rec,0)
  while (%i <= %l) {
    %c = $line(@rec,%i)
    write BTWR.html <tr class="ctd"><td width="5%" align="right"> $+ $+(%i,.) $+ </td> $crlf $&
      <td width="55%"><a $+(href=",$gettok(%c,7,32),">) $+ $gettok(%c,1,32) $+ </a></td> $crlf $&
      <td width="30%" align="center"> $+ $gettok(%c,3,32) $+ </td> $&
      <td width="10%"align="center"> $+ $gettok(%c,5,32) $+ </td></tr>
    inc %i
  }
  %c = $calc($ticks - %recticks)
  if ($len(%c) > 3) %c = $bytes(%c)
  else %c = 0. $+ %c
  write BTWR.html </table></tr></table><br><br><p>Page generated in %c $+ s on $fulldate $&
    <br><font color="#800000">mIRC 6.03 blows.</font></p></center></body></html>
  window -c @lst | window -c @rec | window -c @stat
  hfree recstats | unset %recticks
  log off %btmatchbot
  unset %btmatchbot
  echo -a Conversion completed - $mircdirBTWR.html $+($chr(40),%c,s,$chr(41))
}