Steam Game Information

By Arigateaux on Aug 20, 2014

Updates

  • Complete overhaul, now using the Steam API to access the information, along with binvars to retrieve it.
  • Added a couple extra features, including the ability to transform unicode into something readable
  • Added a timeout for 3 seconds to prevent spam

A socket script that allows you to show the game and price when people post steam links.

[25 Aug 22:57:56] <evi[L]Monkey> http://store.steampowered.com/app/1250/
[25 Aug 22:57:57] <@evilMonkey> Killing Floor - $4.99, Killing Floor 6-pack - $24.98, Killing Floor Bundle - $12.49, Tripwire Bundle - March 2014 - $99.99
[25 Aug 22:58:04] <evi[L]Monkey> http://store.steampowered.com/app/17410/
[25 Aug 22:58:04] <@evilMonkey> Mirror's Edge™ - $19.99

on $*:text:/store.steampowered.com/(sub|app)/(\w+)/Si:#:{
  if (%steamTimeout) halt
  %steamChan = $chan
  steam $1-
}

alias steam {
  set -u3 %steamTimeout $true
  if ($regex($1-, /(http://)?store.steampowered.com/(sub|app)/(\d+)/Si)) {
    sockclose steam
    sockopen steam store.steampowered.com 80
    sockmark steam $iif($regml(3), $regml(3), $regml(2))
  }
}

on *:sockopen:steam: {
  sockwrite -n steam GET /api/appdetails?appids= $+ $sock($sockname).mark HTTP/1.1
  sockwrite -n steam Host: store.steampowered.com
  sockwrite -n steam
}

on *:sockread:steam: {
  while ($sock($sockname).rq) {
    sockread &steam
    bwrite steam -1 -1 &steam
  }
  bread steam 0 $file(steam).size &steam2
  if ($bfind(&steam2, 0, {"packageid")) var %start = $v1
  if ($bfind(&steam2, 0, }])) var %end = $v1
  var %steam = $bvar(&steam2, %start - %end).text
  %steam = $regsubex(%steam, /["\{\}]/g, )
  var %n = 4
  while (1) {
    if ($gettok(%steam, %n, 44)) {
      var %game = $addtok(%game, $right($v1, -12), 44)
      inc %n 6
      continue
    }
    else break
  }
  if ($bfind(&steam2, 0, }}}})) {
    .remove steam
    sockclose $sockname
    %game = $replace(%game, $chr(44), $+($chr(44), $chr(32)))
    %game = $regsubex(%game, /\\u(\d+)/g, $chr($base(\1, 16, 10)))
    msg %steamChan %game
  }
}

Comments

Sign in to comment.
cptpan   -  Jun 18, 2015

This doesn't work for me.

Vegito  -  Jun 27, 2015

http://pastebin.com/1mNuHBzF

Try that one, kinda fixed it :P

Sign in to comment

uneek   -  Aug 31, 2014

I keep getting this error.

  • /set: line too long (line 30, steamGame.txt)
Arigateaux  -  Sep 01, 2014

What version of mIRC are you using and what link did you use, so I can try and duplicate the error.

Biggi  -  Feb 19, 2016

I got the same error, Using the newest version of mIRC. On this link: http://pastebin.com/1mNuHBzF it's line 41 which on both is: var %steam = $bvar(&steam2, %start - %end).text

Sign in to comment

Arigateaux   -  Aug 25, 2014

I've updated the script. Please feel free to play with it and test it for bugs. :)

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.