I have created a document that allows me to see what current prices are for what I am interested in at the time. For this document I have various pages that are aimed for a specific skill. Each document has algorithms for dictating what is the best way to earn money. Basically you put in how much money you are willing to risk and it will say - based on current prices - you will make this much money.
Now that may not seem to complicated, and it probably isn't "that" complicated. But at the time I had thought about what kind of information I would have liked to have seen. One of the things that bugged me the most about Runescape was that they didn't give enough detail about the grand exchange. (The grand exchange is the place where all members try to buy or sell items across all worlds.) A couple of iterations later I tried to store the information that I had gathered from Runescape.com. I had to drop the idea not because I was doing it wrong, but because the browser couldn't support the memory it took to load the data.
I am currently tracking 91 items in Runescape. They are the items I think I can make the most money on.
The google docs api requires you to create something that is more API oriented. So I created something that would be used over and over. It could also be used by multiple people by using Google's general caching system. The way it works is, it will go out and find the item's price data. Once it does, it saves it to Google's public cache. (The public cache is shared between anyone trying to use Google Doc's Spreadsheet. This means that if I am the first one to use the api, then everyone else will see the data I see for at least a specified time. I had to do this because Runescape has a limit on their api. You can only make so many requests per second to their system before it stops responding to any of them. I was first thinking that maybe I could start implementing a HEAD request system to find out when they last updated their response. I have only recently found out that their "last updated response" variable says epoch time. Which means their entire api system has been consistently crap. I have ran into various problems with their api that I have needed to sort out. It has been rather a big growing pain; but I have been able to manage it.)
One of the various problems with their api is the fact they don't return raw data types. Instead they seem to like the idea of strings. Strings aren't all bad until you want to do mathematical calculations on them. So I created a parser that would take that data and use REGEX to parse the price data out of items and set them back to the original objects' price. Some of the things they would return is
I don't mean to boast and place myself on a pedestal but I am proud of what I have accomplish. I am proud of the fact that I saw a problem and found a solution through code. I really like coding and think it can be very useful but sometimes it isn't the answer to everything. Doing it brute force can be the better solution.
It was fun to do and it was definitely a challenge to get all the features I wanted done.
So maybe at this point you might be asking, where is the sheet. I dont play Runescape, but I want to see this piece. At this point I would like to say that I am in the process of moving it over to the new Google Spreadsheets. I have found that the preprocessing is 10x faster than the older version on the newer Google Spreadsheets. So for right now you can see the old version. Docs [Clicky]
Anyways, this is one of the many things that drive me nuts during the day. I constantly think about these things to try to improve them.
I hope this article was informative. If it wasn't, ask a question below and I will try to answer it. ;D
Not all the code in this article is a perfect representation of what is working in production code. Most of this code has been modified for presentation.
Subscribe to Rizowski's Blog
Get the latest posts delivered right to your inbox