Back to work JavaScript experiment

TF2 Market Experiment

A script I wrote in 2013, and the blog post people still find.

JavaScriptAsync programming
When
2013
Status
Stopped. The write-up is still online.
Original Team Fortress 2 screenshot showing 18 new items acquired, with item 18 displayed as a Mann Co. Supply Crate Key.
My original screenshot from the project: 18 new items acquired, with a Mann Co. Supply Crate Key on screen.

How it started

When Steam’s Community Market was new, I got curious about how it worked. Some Team Fortress 2 items showed up way below the usual price, and buying one turned into a race. So me, being a web developer with too much time on my hands, decided to take a swing at it. I dug through the market’s browser code (it was well done and easy to follow, thanks Valve!) and wrote a JavaScript experiment that watched listings and tried to buy anything under a price I picked.

I wrote it all up in Anatomy of an Auto-Buying Script, published October 15, 2013. The Internet Archive still has it.

I used Ghost for that blog, and enjoying it led to another project: Yokai, a hosting service that set up Ghost blogs for people who signed up.

What I learned from it

My first version waited for each response before doing anything else. That was slow, so I rewrote it around asynchronous requests and callbacks. It would send a request and deal with the answer whenever it came back, while the next request was already on its way.

The script also kept track of listings it had already checked, handled prices and fees, and used converted currency values when they were available. Any purchase could lose the race, so reading the response mattered as much as sending the request.

It was a small amount of JavaScript, but it taught me a lot about asynchronous programming and about reading someone else’s web app.

Why I stopped

I stopped running it after I learned it broke Steam’s terms. The article shared an incomplete example that doesn’t work, on purpose, to explain the idea. There’s no bot or buying tool here.

The post lived a lot longer than the script did. People found it, asked how things worked, and left comments on my Steam profile. Some of those comments are still there more than ten years later.

The original article has my explanation from back then, including the decision to shut it down.