Querying the api for information about a set of characters (Basic)
by
, 08-21-2014 at 11:33 AM (17200 Views)
UPDATE: As of 5/1/2016 this script no longer works. If/when I update it I will place a link here.
I am a spreadsheet fanatic. I "invented" spreadsheets with a paper game I played as a child, and designing spreadsheets for any game I spend a lot of time on is a big chunk of the fun for me. I think it comes from the same part of my brain that enjoys endless tweaking of my multiboxing setup.
At a minimum, I like to have current information about a characters level, ilevel, and professions, and now that this information is available in the api I decided to work on automatically retrieving it. I was inspired by Beeq's (much more impressive) php pages to develop a way to update the basic information about all of my characters and thought I'd share in case anyone else was sick of updating their records by hand.
I decided to use perl because it is the language I script in, but unlike other computer languages that I am familiar with, I never took any kind of class, I am entirely arbitrarily self taught based on what I think I might want to do and google. It is entirely possible, nay likely, that this script is 3 times as long as it needs to be. This is one of my first times using subroutines, for example.
This script uses perl (I use strawberry perl) and the LWP library (for parsing and retrieving web content).
Below you will find a link to a zip file that contains the perl script itself, the csv file where you type your characters (I've included ten of mine, so you can get a feel for how it works) and a copy of the example output.
Notes on use: To use just change the names of the characters in the MyCharacters.csv file to your own. If you are in the EU you need to change the $usoreu variable to say "eu". The Account column is for your own use, it is not used in the query, so feel free to use actual account names/numbers or however you think of them (I just think of them as accounts 1-5, although 1 and 2 actually have names from being pre-bnet accounts and 3-5 are numbers like 71920901#1. I know some people prefer accounts A-E). For servers with a space in the name either Server-Name or Server Name seem to work just fine.
Example Input:
Example Output:
Files: let me know if this link doesn't work for you
PS. If you know how to make this blog show the full sized files please let me know! Sorry for the blur.
Connect With Us