LabVIEW Tutorial: Game Discounts

Last week I created a small project uses some more advanced LabVIEW code that searches user inputted games on Steam and then returns the discount for each game entered. I wrote it as a code walk-through to explain some more advanced LabVIEW code including event structures, HTTP GET requests and Regular Expressions, and altering LabVIEW Front Panel controls using property nodes and invoke nodes! You can find the Instructable on the project here which goes more in-depth on how the code works so that you can learn to write your own LabVIEW code. Check out the block diagram below! The white blocks are subVIs that I made, which are detailed below.

block diagram

Time for a brief overview of the code and how it works. If you’re looking for a more in-depth explanation, remember to check out my Instructable linked above.

The code has three major sequences. First, you enter an array of game names that you are interested in checking. These names are then searched using an HTTP GET request along with the Steam API and the top result of the search is found in the information from the request and returned. For instance, if you typed mgsv (Metal Gear Solid 5), a search would be done on “mgsv” and the top result would be Metal Gear Solid 5! This search also gives the “App ID” which is the specific ID assigned to every game on steam. Each search returns a ton of information in a giant string so after using the HTTP GET request I wrote algorithms using regular expressions to parse the information and return only the useful information.

first subvi block

In the second phase, the names are returned to an indicator that pops up using a property node to control the visibility. This indicator has the names of the games returned from the search and asks the user if these are correct. If they are, the code moves to the last sequence, but if they are not correct, a message is displayed for the user and the VI is aborted.

doooope

In the last sequence, the code takes the App ID that we got from the first sequence and does an HTTP GET request on that specific game. The results are then parsed and the discount for that game is returned!

get discounts block

This is an easy way to get the discounts for your game without having to go to the steam store and manually searching for your game and looking it up yourself. Moving forward with this VI, you could have it run every day or even import games from your wishlist and check the discounts from all the games on your wishlist. LabVIEW even includes useful tools for emailing or texting you that you could use to send messages about the games that are on sale.

Be the 1st to vote.

Leave a Reply

Your email address will not be published. Required fields are marked *