Top

Quake Live Stats


mIRC Code

Please Register to submit score.
Bookmark and Share
Average Score  10.0 (of 1 scores)
Date Added  Mar 25, 2009
Last Updated  Aug 19, 2010
Tags  live  quake  socket  stats 

Description

This is a script which obtains user stats from the Quake Live website (quakelive.com) and notices them to the user. (This can be changed to message the channel instead, read 3rd paragraph.)

Usage: !ql <player name>

The way in which these stats are presented can be easily changed from the alias at the top of the script (msgformat) which includes a list of formatting tags, an example and a default output. Simply change what the alias returns in order to change the format.

Also, you can change it to either message the channel or notice the user in the alias "msgmethod" below the first one. Change it to either "return msg" or "return notice".

Below is an explanation of the different formatting tags:

  • :clan: - clan tag
  • :playername: - player's name
  • :country: - the country of the player
  • :registered: - the date the player registered
  • :timeplayed: - the amount of time the player has spent playing Quake Live
  • :lastgame: - how long ago the player's last game was
  • :wins: - the number of times the player has won a game
  • :losses: - the number of times the player has lost a game
  • :wlr: - the ratio between wins and losses
  • :quits: - the number of games the player quit a match before it ended
  • :gamescompleted: - the number of games the player has finished
  • :frags: - the number of frags the player has obtained
  • :deaths: - the number of times the player has died
  • :fdr: - the ratio between frags and deaths
  • :hits: - the number of shots which have hit another player
  • :shots: - the total number of shots fired by the player
  • :accuracy: - the percent of shots which hit another player

Grab the Code

;Created by Daveoh (#DAVEOH @ QuakeNet)
alias -l qlchans {
  ;you can replace this with a list of channels which this script will only work on (i.e. #chan1,#chan2,#chan3) otherwise keep it at $chr(35) to work on all channels
  return $chr(35)
}
alias -l msgmethod {
  ;this determines whether stats will be messaged to the channel or noticed to the user
  ;this can be either "msg" or "notice" (without quotes) after the return
  return notice
}
alias -l msgformat {
  ;available tags: :clan: :playername: :country: :registered: :timeplayed: :lastgame: :wins: :losses: :wlr: :quits: :gamescompleted: :frags: :deaths: :fdr: :hits: :shots: :accuracy:
  ;example for use of all tags: :clan: :playername:: Country: :country: / Registered: :registered: / Time Played: :timeplayed: / Last Game: :lastgame: / Wins/Losses (Ratio): :wins:/:losses: (:wlr:) / Quits: :quits: / Games Completed: :gamescompleted: / Frags/Deaths (Ratio): :frags:/:deaths: (:fdr:) / Hits/Shots (Accuracy): :hits:/:shots: (:accuracy:)
  ;return :clan: :playername:: / Time Played: :timeplayed: / Last Game: :lastgame: / Wins/Losses (Ratio): :wins:/:losses: (:wlr:) / Frags/Deaths (Ratio): :frags:/:deaths: (:fdr:) / Accuracy: :accuracy:
  return :clan: :playername:: Country: :country: / Registered: :registered: / Time Played: :timeplayed: / Last Game: :lastgame: / Wins/Losses (Ratio): :wins:/:losses: (:wlr:) / Quits: :quits: / Games Completed: :gamescompleted: / Frags/Deaths (Ratio): :frags:/:deaths: (:fdr:) / Hits/Shots (Accuracy): :hits:/:shots: (:accuracy:)
}
on *:TEXT:!ql*:$($qlchans):{
  if ($1 == !ql) && ($regex($2,/\S/)) {
    if (!%qlspam) {
      unset %ql.*
      set %ql.nick $nick
      set %ql.user $2
      set %ql.chan $chan
      if ($sock(quakelive)) { sockclose quakelive }
      sockopen quakelive quakelive.com 80
    }
    set -u5 %qlspam 1
  }
  elseif (!%qlhelp) {
    msg $chan Usage: !ql <username>
    set -u20 %qlhelp 1
  }
}
on *:SOCKOPEN:quakelive:{
  var %s = sockwrite -tn $sockname
  %s GET /profile/summary/ $+ %ql.user HTTP/1.0
  %s Host: www.quakelive.com
  %s User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6 (.NET CLR 3.5.30729)
  %s Accept: */*
  %s Accept-Language: en-gb,en;q=0.5
  ;%s Accept-Encoding: gzip,deflate
  %s Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  %s Connection: close
  %s X-Requested-With: XMLHttpRequest
  %s Referer: http://www.quakelive.com/
  %s $crlf
}
on *:SOCKREAD:quakelive:{
  sockread -fn &temp
  while ($sockbr) {
    var %temp = $bvar(&temp,1-).text , %nohtml = $htmlfree(%temp)
    if ($window(@temp)) { echo -t @temp %temp }
    if (sorry_content isin %temp) { ql.resp load | sockclose $sockname | return }
    if (prf_player_name isin %temp) { set %ql.player $remove(%nohtml,$chr(9)) | if (%ql.player == Unknown Player) { ql.resp unknown | sockclose $sockname | return } }
    if (playerflag isin %temp) { set %ql.country $gettok(%temp,-2,34) }
    if (*Member Since:* iswm %temp) { set %ql.registered $gettok(%nohtml,3-,32) }
    if (*Time Played:* iswm %temp) { set %ql.timeplayed $gettok(%nohtml,3-,32) }
    if (%ql.lastgame.nextline) { set %ql.lastgame %nohtml | unset %ql.lastgame.nextline }
    if (*Last Game:* iswm %temp) { set %ql.lastgame.nextline 1 }
    ;if (*Total Games:* iswm %temp) { set %ql.totalgames $remove($gettok(%nohtml,3,32),-->) }
    if (*Wins:* iswm %temp) { set %ql.wins $gettok(%nohtml,2,32) }
    if (*Losses / Quits:* iswm %temp) { set %ql.losses $gettok(%nohtml,4,32) | set %ql.quits $gettok(%nohtml,6,32) | set %ql.wlr $round($calc(%ql.wins / %ql.losses),2) | set %ql.gamescompleted $calc(%ql.wins + %ql.losses) }
    ;if (*Wins / Losses / DNFs:* iswm %temp) { set %ql.wins $gettok(%nohtml,6,32) | set %ql.losses $gettok(%nohtml,8,32) | set %ql.quits $remove($gettok(%nohtml,10,32),-->) | set %ql.wlr $round($calc(%ql.wins / %ql.losses),2) | set %ql.gamescompleted $calc(%ql.wins + %ql.losses) }
    if (*Frags / Deaths:* iswm %temp) { set %ql.frags $gettok(%nohtml,5,32) | set %ql.deaths $gettok(%nohtml,7,32) | set %ql.fdr $round($calc($remove(%ql.frags / %ql.deaths,$chr(44))),2) }
    if (*Hits / Shots:* iswm %temp) { set %ql.hits $gettok(%nohtml,5,32) | set %ql.shots $gettok(%nohtml,7,32) | set %ql.accuracy $int($calc($remove(%ql.hits / %ql.shots,$chr(44)) * 100)) $+ % }
    if (Clan: isin %temp) || (%ql.getclan == 1) { set %ql.clan $gettok(%nohtml,2,32) | ql.resp ok | sockclose $sockname | return }
    if (Accuracy: isin %temp) { set %ql.getclan 1 }
    sockread -fn &temp
  }
}
alias ql.resp {
  if ($1 == load) {
    $iif($msgmethod == msg,msg %ql.chan,notice %ql.nick) Sorry, the site is currently experiencing high load and your request cannot be processed.
    set -u10 %ql.spam 1
    return
  }
  if ($1 == ok) {
    $iif($msgmethod == msg,msg %ql.chan,notice %ql.nick) $replace($$msgformat,:clan:,%ql.clan,:playername:,%ql.player,:country:,%ql.country,:registered:,%ql.registered,:timeplayed:,%ql.timeplayed,:lastgame:,%ql.lastgame,:wins:,%ql.wins,:losses:,%ql.losses,:wlr:,%ql.wlr,:quits:,%ql.quits,:gamescompleted:,%ql.gamescompleted,:frags:,%ql.frags,:deaths:,%ql.deaths,:fdr:,%ql.fdr,:hits:,%ql.hits,:shots:,%ql.shots,:accuracy:,%ql.accuracy)
    unset %ql.*
  }
  if ($1 == unknown) {
    $iif($msgmethod == msg,msg %ql.chan,notice %ql.nick) Unknown player, %ql.user
    unset %ql.*
  }
}
alias htmlfree { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;) | return %x }

Comments

  (2)  RSS
bigtony
Comments: 1
 
mIRC Snippet:  Quake Live Stats
Posted Jul 28, 2009
What is the process you need to load this? Does it have to be saved as an .mrc file then loaded into mirc (/load -rs qlstats.mrc), is it an .INI or .TXT?

Thanks?
jawz
Comments: 1
 
mIRC Snippet:  Quake Live Stats
Posted 15 days ago
Great script. Been using it for a while and it does the job. Thanx!

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  

Bottom