FANDOM


m (Wiki link converter)
m (Job queue grapper (Non-fail edition))
 
Line 283: Line 283:
 
}
 
}
 
alias comid if ($+($1,$com(0))) return $v1
 
alias comid if ($+($1,$com(0))) return $v1
  +
alias parseAsync {
  +
.comopen $comid(x) msxml2.xmlhttp
  +
noop $com($v1,open,1,bstr,get,bstr,$+( [ $regsubex($2,/%s/g,$chr(44) $ $+ $calc(\n +2) $chr(44)) ] ),bool,0)
  +
noop $comcall($v1,noop $!com($1,responseText,2) $(|,) $1 $!com($1).result $(|,) .comclose $!1,send,1)
  +
}
 
 
 
; ----------------------------------------
 
; ----------------------------------------
Line 293: Line 298:
 
 
 
on *:text:!jobqueue:*: {
 
on *:text:!jobqueue:*: {
;var %jq_website = $gettok($remove($iif($2,$2,www.wowwiki.com),<nowiki>http://</nowiki>),1,47)
+
;var %jq_website = $gettok($remove($iif($2,$2,www.wowwiki.com),http://),1,47)
 
var %jq_website = www.wowwiki.com
 
var %jq_website = www.wowwiki.com
 
set %jq_update_start $ctime
 
set %jq_update_start $ctime
noop $parseAsync(signal jq_stats $iif($chan,$chan,$nick) $ctime,<nowiki>http://%s/api.php?action=query&meta=siteinfo&siprop=statistics&format=xml</nowiki>,%jq_website)
+
noop $parseAsync(signal jq_stats $iif($chan,$chan,$nick) $ctime,http://%s/api.php?action=query&meta=siteinfo&siprop=statistics&format=xml,%jq_website)
 
}
 
}
 
on *:text:!jq:*: {
 
on *:text:!jq:*: {
 
var %jq_website = www.wowwiki.com
 
var %jq_website = www.wowwiki.com
 
set %jq_update_start $ctime
 
set %jq_update_start $ctime
noop $parseAsync(signal jq_stats $iif($chan,$chan,$nick) $ctime,<nowiki>http://%s/api.php?action=query&meta=siteinfo&siprop=statistics&format=xml</nowiki>,%jq_website)
+
noop $parseAsync(signal jq_stats $iif($chan,$chan,$nick) $ctime,http://%s/api.php?action=query&meta=siteinfo&siprop=statistics&format=xml,%jq_website)
 
}
 
}
 
on *:SIGNAL:jq_stats: {
 
on *:SIGNAL:jq_stats: {
msg $1 The WoWWiki job queue length is currently $gettok($3-,20,34)
+
msg $1 The WoWWiki job queue length is currently $gettok($3-,18,34)
 
}
 
}

Latest revision as of 20:04, November 1, 2009

Purpose Edit

Spam various IRC channels on freenode and Quakenet.

About me Edit

I'm programmed in the very sexy mIRC scripting language Smiley

What can I do? Edit

  • !al <continent> <realm> <nickname>
    Creates a link to the armory with those parameters. Please write realm names in full, inclusive of special characters (Spaces, apostrophes)
    Cooldown: 1 minute per request, and 10 minutes per link.
  • !ap <bracket> <points> for points calculator
    Calculates your arena points based on your teams rating.
  • !chanstats
    Updates the current stat page of the channel, and/or displays link of the current channel's stat page.
  • !seen <nick>
    Check when newsbot last saw <nick>, and what his/hers last words were. (DISABLED)

Network specials Edit

Freenode Edit

  • !jobqueue
    Downloads the jobqueue size from Special:Statistics, and displays it in the active channel.
    Can be supplied with an URL, but isn't reliable.
  • !wwstats
    Same as !chanstats.
  • Wiki links
    Convert a a wiki link; [[Illidan Stormrage]] into a clickable link.

Quakenet Edit

  • N/A

To do, but will probably never happen because i slack too much - yet i play WoW and watch Anime :/ Edit

  • Addon Search
  • Armory Parsing
  • WoWDB Search

Code snippets Edit

Bot Code Edit

Wiki link converter Edit

; Script by [cZ]cow
; Modified by Dotted
; Much luv to Daveoh 

on $*:text:/\[\[(?!#)(.+?)]]|\{\{(?!#)(.+?)}}/g:#,?,=:{
  if ($istok(#aocwiki #sporewiki #wowwiki,$chan,32)) {
    if (infobot !isin $nick) {
      var %wiki_url = $&
        $iif($chan == #aocwiki,aoc.wikia.com/wiki/, $&
        $iif($chan == #sporewiki,spore.wikia.com/wiki/, $&
        $iif($chan == #wowwiki,www.wowwiki.com/, $&
        en.wikipedia.org/wiki/)))
      var %x = 1,%n
      while ($regml(%x)) {
        %n = $addtok(%n,$chr(32) $iif($left(%wiki_url,3) != www,http:// $+ %wiki_url,%wiki_url) $+ $iif($chr(123) == $mid($1-,$calc($regml(%x).pos -1),1),Template:) $+ $replace($regml(%x),$chr(32),_),44)
        inc %x
      }
      msg $chan $nick meant: %n
    }
  }
}

Arena point calculator (DEPRECATED) Edit

; Script by Dotted

; This script is dual-licensed under the GPL,
; version 2 or (at your option) any later version.
; See http://www.gnu.org/licenses/gpl.txt for more details.

on *:TEXT:!ap*:#: {
  var %ts = $2
  var %x = $3

  if ($istok(2vs2 3vs3 5vs5 2v2 3v3 5v5 2 3 5,%ts,32)) {
    if (%x != $null) {
      var %tsp = $iif($istok(2vs2 2v2 2,%ts,32),76,$iif($istok(3vs3 3v3 3,%ts,32),88,$iif($istok(5vs5 5v5 5,%ts,32),100,Error)))
          
      if (%x > 1500) && (%x <= 3901) {
        var %y = $int($calc($calc(1511.26 / (1 + 1639.28 * (2.71828 ^ (-0.00412 * %x )))) * %tsp / 100 ))
        notice $nick $+ : $iif(%y => 5000,5000,$iif(%y <= 0,0,%y)) Arena Points!
      }
      elseif (%x > 0) && (%x <= 1500) {
        var %y = $int($calc($calc(0.22 * %x + 14) * %tsp / 100 ))
        notice $nick $+ : $iif(%y => 5000,5000,$iif(%y <= 0,0,%y)) Arena Points!
      }
      else { notice $nick Team Rating out of bounds. }
    }
    else {
      notice $nick You didn't specify a team rating.
    }
  }
  else {
    notice $nick You didn't specify a valid team size.
    notice $nick Valid team sizes: 2vs2, 3vs3. 5vs5, 2v2, 3v3. 5v5, 2, 3, and 5.
  }
}

Arena point calculator Quakenet edition w/ PMs (DEPRECATED) Edit

; Script by Dotted

; This script only works on networks with /cnotice support like Quakenet.

; This script is dual-licensed under the GPL,
; version 2 or (at your option) any later version.
; See http://www.gnu.org/licenses/gpl.txt for more details.

on *:TEXT:!ap*:*: {
  if ($me isreg $chan) {
    if (!%ap_mode_error_msg)  {
      msg $chan Due to a limitation to the Quakenet network, i will need voice to work! $iif($nick isop $chan,Please voice me $nick,$nick contact one of $chan $+ 's operators to get me voiced.)
      set -u600 %ap_mode_error_msg true
    }
  }
  else {
    var %ts = $2
    var %x = $3
    if ($istok(5versus5 3versus3 2versus2 5on5 3on3 2on2 5o5 3o3 2o2 3on3 2vs2 3vs3 5vs5 2v2 3v3 5v5 2 3 5,%ts,32)) {
      if (%x != $null) {
        var %tsp = $iif($istok(2versus2 2on2 2o2 2vs2 2v2 2,%ts,32),76,$iif($istok(3versus3 3on3 3o3 3vs3 3v3 3,%ts,32),88,$iif($istok(5versus5 5on5 5o5 5vs5 5v5 5,%ts,32),100,Error)))

        if (%x > 1500) && (%x <= 3901 ) {
          var %y = $int($calc($calc(1511.26 / (1 + 1639.28 * (2.71828 ^ (-0.00412 * %x )))) * %tsp / 100 ))
          if ($chan) {
            cnotice $nick $chan $nick $+ : $iif(%y => 5000,5000,$iif(%y <= 0,0,%y)) Arena Points!
          }
          else {
            msg $nick $iif(%y => 5000,5000,$iif(%y <= 0,0,%y)) Arena Points!
            close -m $nick
          }
        }
          elseif (%x > 0) && (%x <= 1500) {
            var %y = $int($calc($calc(0.22 * %x + 14) * %tsp / 100 ))
            if ($chan) {
              cnotice $nick $chan $nick $+ : $iif(%y => 5000,5000,$iif(%y <= 0,0,%y)) Arena Points!
            }
            else {
              msg $nick $iif(%y => 5000,5000,$iif(%y <= 0,0,%y)) Arena Points!
              close -m $nick
            }
          }
          else {
            if ($chan) { cnotice $nick $chan Team Rating out of bounds. }
            else {
              msg $nick Team Rating out of bounds.
              close -m $nick
            }
          }
        }
      }
      else {
        if ($chan) { cnotice $nick $chan You didn't specify a team rating. }
        else {
          msg $nick You didn't specify a team rating.
          close -m $nick
        }
      }
    }
    else {
      if ($chan) {
        cnotice $nick $chan You didn't specify a valid team size.
        cnotice $nick $chan Valid team sizes: 2versus2, 3versus3, 5versus5, 2on2, 3on3, 5on5, 2o2, 3o3, 5o5, 2vs2, 3vs3, 5vs5, 2v2, 3v3, 5v5, 2, 3, and 5.
      }
      else {
        msg $nick You didn't specify a valid team size.
        msg $nick Valid team sizes: 2versus2, 3versus3, 5versus5, 2on2, 3on3, 5on5, 2o2, 3o3, 5o5, 2vs2, 3vs3, 5vs5, 2v2, 3v3, 5v5, 2, 3, and 5.
        close -m $nick
      }
    }
  }
}

Armory link creator Edit

; Script by Dotted

; Only for use on QuakeNet, or networks that support /cnotice.

; This script is dual-licensed under the GPL,
; version 2 or (at your option) any later version.
; See http://www.gnu.org/licenses/gpl.txt for more details.

on *:TEXT:!al*:*: {
  var %first = $remtok(%s,-1,32), %last = $gettok($1-,-1,32)
  if ($2 == EU) {
    if ($deltok($3-,-1,32) == $null) { cnotice $nick $chan You did not provide a realmname, please do so and try again | halt }
    elseif ($gettok($3-,-1,32) == $null) { cnotice $nick $chan You did not provide a nickname, please do so and try again | halt }

    tokenize 32 $1 $regsubex($2-6,/(\s|^)(.)(\S*)/g,\1$upper(\2) $+ $lower(\3)) $7-

    if ($chan) { cnotice $nick $chan $gettok($3-,-1,32) $+ ' $+ $iif($right($gettok($3-,-1,32),1) != s,s) Armory Profile: http://armory.wow-europe.com/character-sheet.xml?r= $+ $replace($deltok($3-,-1,32),$chr(32),$chr(43)) $+ &n= $+ $gettok($3-,-1,32) }
    else { msg $nick $gettok($3-,-1,32) $+ ' $+ $iif($right($gettok($3-,-1,32),1) != s,s) Armory Profile: http://armory.wow-europe.com/character-sheet.xml?r= $+ $replace($deltok($3-,-1,32),$chr(32),$chr(43)) $+ &n= $+ $gettok($3-,-1,32) }
  }
  elseif ($2 == US) {
    if ($deltok($3-,-1,32) == $null) { cnotice $nick $chan You did not provide a realmname, please so and try again | halt } 
    elseif ($gettok($3-,-1,32) == $null) { cnotice $nick $chan You did not provide a nickname, please so and try again | halt }

    tokenize 32 $1 $regsubex($2-6,/(\s|^)(.)(\S*)/g,\1$upper(\2) $+ $lower(\3)) $7-

    if ($chan) { cnotice $nick $chan $gettok($3-,-1,32) $+ 's Armory Profile: http://armory.worldofwarcraft.com/character-sheet.xml?r= $+ $replace($deltok($3-,-1,32),$chr(32),$chr(37) $+ 20) $+ &n= $+ $gettok($3-,-1,32) }
    else { msg $nick cnotice $nick $chan $gettok($3-,-1,32) $+ 's Armory Profile: http://armory.worldofwarcraft.com/character-sheet.xml?r= $+ $replace($deltok($3-,-1,32),$chr(32),$chr(37) $+ 20) $+ &n= $+ $gettok($3-,-1,32) }
  }
  elseif ($2 != EU) || ($2 != US) || {
    if ($chan) {
      cnotice $nick $chan You did not provide a valid region name.
      cnotice $nick $chan Current valid regions: EU, US
    }
    else {
      msg $nick You did not provide a valid region name.
      msg $nick Current valid regions: EU, US
    }
  }
  else {
    if ($chan) {
      cnotice $nick $chan It seems an error occured, or you din't use the right parameters:
      cnotice $nick $chan Please use !al <continent> <realmname> <nickname>
    }
    else {
      msg $nick It seems an error occured, or you din't use the right parameters:
      msg $nick Please use !al <continent> <realmname> <nickname>
    }
  }
}

Job queue grabber (Failure edition) Edit

alias wiki_jobqueue {
  if ($sock(wiki_jobqueue)) { sockclose wiki_jobqueue }
  sockopen wiki_jobqueue %jobqueue_host 80
}
alias wiki_jobqueue_jps {
  if (%jobqueue_ttl) && (%jobqueue_host == www.wowwiki.com) {
    var %jobqueue_time_difference = $calc(%jobqueue_time_new - %jobqueue_time_old)
    var %jobqueue_difference      = $calc(%jobqueue_old - %jobqueue_new)
    var %jobqueue_jps             = $calc(%jobqueue_difference / %jobqueue_time_difference)
    var %jobqueue_ttl_var         = $int($calc(%jobqueue_new / %jobqueue_jps))
    set -u [ $+ [ %jobqueue_ttl_var ] ] %jobqueue_ttl %jobqueue_ttl_var

    return doing $chr(126) $+ $round(%jobqueue_jps,2) jobs/s, done in aproxx. $duration(%jobqueue_ttl) $+ .
  }
}
;this event is triggered on the moment the sockets is opened
on *:sockopen:wiki_jobqueue:{
  ;to tell the server which file you want to receive
  sockwrite -n $sockname GET %jobqueue_address HTTP/1.1
  sockwrite -n $sockname Host: %jobqueue_host
  sockwrite -n $sockname User-Agent: [NewsBot]
  sockwrite -n $sockname Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
  sockwrite -n $sockname Accept-Language: en
  sockwrite -n $sockname Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  sockwrite -n $sockname Keep-Alive: 300
  sockwrite -n $sockname Connection: Keep-Alive
  sockwrite -n $sockname Cookie: __utma=24527932.1806465100.1178387585.1178387585.1178387585.1; __utmb=24527932; __utmc=24527932; __utmz=24527932.1178387585.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
  sockwrite -n $sockname Cache-Control: max-age=0
  sockwrite -n $sockname $crlf
}
on *:sockread:wiki_jobqueue:{
  if ($sockerr > 0) return
  sockread %temp
  if (job queue isin %temp) {
    set %jobqueue_old %jobqueue_new
    set %jobqueue_new $remove($gettok(%temp,5,60),b>,$chr(44))
    set %jobqueue_time_old %jobqueue_time_new
    set %jobqueue_time_new $ctime
    msg %wiki_chan The %jobqueue_host job queue length is currently %jobqueue_new $wiki_jobqueue_jps
  }
}
on *:TEXT:!jobqueue*:#: {
  set %wiki_chan $chan
  if ($2 != $null) {
    set %jobqueue_host $gettok($remove($2,http://),1,47)
    set %jobqueue_address $remove($gettok($2,2-,47),%jobqueue_host)
    wiki_jobqueue %jobqueue_host %jobqueue_address
  }
  else {
    set %jobqueue_address /Special:Statistics 
    set %jobqueue_host www.wowwiki.com
    wiki_jobqueue %jobqueue_host %jobqueue_address
  }
}

Job queue grapper (Non-fail edition) Edit

; Parser from http://www.mircscripts.org/comments.php?cid=4009
alias parse {
  .comopen xml msxml2.xmlhttp
  var %x $com(xml,open,1,bstr,get,bstr,$+( [ $regsubex($1,/%s/g,$chr(44) $ $+ $calc(\n +1) $chr(44)) ] ),bool,-1) $&
    $com(xml,send,1) $com(xml,responseText,2),%x $com(xml).result
  .comclose xml
  return %x
}
alias comid if ($+($1,$com(0))) return $v1
alias parseAsync {
  .comopen $comid(x) msxml2.xmlhttp
  noop $com($v1,open,1,bstr,get,bstr,$+( [ $regsubex($2,/%s/g,$chr(44) $ $+ $calc(\n +2) $chr(44)) ] ),bool,0)
  noop $comcall($v1,noop $!com($1,responseText,2) $(|,) $1 $!com($1).result $(|,) .comclose $!1,send,1)
}

; ----------------------------------------
; Job Queue
;
; This script is dual-licensed under the GPL,
; version 2 or (at your option) any later version.
; See http://www.gnu.org/licenses/gpl.txt for more details.
; ----------------------------------------

on *:text:!jobqueue:*: {
  ;var %jq_website = $gettok($remove($iif($2,$2,www.wowwiki.com),http://),1,47)
  var %jq_website = www.wowwiki.com
  set %jq_update_start $ctime
  noop $parseAsync(signal jq_stats $iif($chan,$chan,$nick) $ctime,http://%s/api.php?action=query&meta=siteinfo&siprop=statistics&format=xml,%jq_website)
}
on *:text:!jq:*: {
  var %jq_website = www.wowwiki.com
  set %jq_update_start $ctime
  noop $parseAsync(signal jq_stats $iif($chan,$chan,$nick) $ctime,http://%s/api.php?action=query&meta=siteinfo&siprop=statistics&format=xml,%jq_website)
}
on *:SIGNAL:jq_stats: {
  msg $1 The WoWWiki job queue length is currently $gettok($3-,18,34)
}
Community content is available under CC-BY-SA unless otherwise noted.