Hello fellow Reddit users!
I am currently using a spreadsheet on Google Docs that helps me craft and sell stuff in a game called Guild Wars 2.
The spreadsheet runs with help of a jQuery script - I think since I am new to this stuff - to an API of a website that updates the the price of the sell orders in real-time.
Now it is fine the way it is but with the API, I would really love to expand some things.
Currently this is the code:
// function to return the current sell value for an item (designated by // the item’s ID number) from GW2Spidy's API formatted with copper in // the tens and hundreds places function getItemSellValue(itemID) { // base URL for the API that will return JSON for the itemID supplied var myUrl = "http://ift.tt/1l6QFxh" + escape(itemID);
// fetches the information from the URL in an HTTPResponse var jsonData = UrlFetchApp.fetch(myUrl);
// now we convert that response into a string so that we can use it var jsonString = jsonData.getContentText();
// now, we turn it into a Javascript object for easier handling // *note: I also remove the "result" wrapper object so we can // use direct calls on the objects parameters var jsonObject = JSON.parse(jsonString).result;
// now I divide the value by 100 in order to format it more like // currency. (ie. 126454, which equals 12 gold, 64 silver, // and 54 copper will now be displayed as // 1264.54) var adjustedValue = (jsonObject.min_sale_unit_price / 100);
// finally we return the adjusted min sell value return adjustedValue;
}
Straightforward and myself understood what he did! But I also would love to get a function that would give me the follow:
- Name
- result_item_max_offer_unit_price
- result_item_min_sale_unit_price
- crafting_cost
Using this "http://ift.tt/1jM265a" - this would give me a separate list of ID of Items different from http://ift.tt/1l6QFxh
I have no idea what to do, it is simple? Can someone put a simple code or tell me how to do it? Do I need to create a new script and having those two at the same time?
Also this is the page of the API: http://ift.tt/1R9LgYk
And the page of the tutorial/code:http://ift.tt/1jM27WB
Thank you for your time!
Epic visual tool
Epson 5030UB 2D/3D 1080p 3LCD Projector
No comments:
Post a Comment