Need help in Javascript (Google sheets)
Don’t take the modulo 100 for the gold.
Thank you very much Darthmaim for your reply !
So Do I need to remove just “% 100” on the “var gold” or do I need to remove the full line and juste keep “var gold” ? :o (I’m sorry, my question is, I think, stupid, but I tried several times to remove some parts of this function and it doesn’t work…)
And now, I have another problem, about my function “GetItemBuyValue”, I saw a lot of different code for this one, so I tried it all but, on the Google sheets, it’s written "Error, can’t read “max_offer_unit_price” and what I don’t understand is, this the line that everybody use to get the item max offer.
So Actually, I’m using the line which is on my pastebin. But I tried those lines too:
function getItemBuyValue(itemID) {
var myUrl = “https://api.guildwars2.com/v2/commerce/listings/” + escape(itemID);
var jsonData = UrlFetchApp.fetch(myUrl);
var jsonString = jsonData.getContentText();
var jsonObject = JSON.parse(jsonString);
if (jsonObject.buys.length === 0) {
return 0;
}
var adjustedValue = (jsonObject.buys[jsonObject.buys.length-1].unit_price / 100);
return adjustedValue;
}
And if I use those lines, on the Google sheet, I don’t get “Error, can’t read max_offer_unit_price” (of course, this is not written on the script that’s why) but it’s written false information like “0,01” for the max offer price for Volcanus for example.
If someone could help me a little bit (again… >_<)
See here the new pastebin: http://pastebin.com/Z4UygwSc
EDIT: I found my error but to have the full price in gold / silver / copper, thanks again Darthmaim !
But I still have error the function to get the max offer… And now I have an error about the function to get item name with ID (but it was working yesterday so maybe an issue with gw2 server ?)
EDIT 2: I found my second error after XXX hours on (to get max offer) ! Even if… now i can’t get item name with the get item function with the ID… But this function still working with gw2spidy.
(edited by Kishar.3762)
Hey there. I created a webpage a few months back for calculating your bank worth:
http://pvp.guru/bank
I think the following web component has the stuff you need(look at the source):
http://pvp.guru/elements/paper-adder.html
Hey Light !
Thank you very much for your reply ! You did a great job
I took a look on the source page, your javascript is “much clear” than mine, I prefer yours. The problem with mine is I’m asking to the API for each function I want, the best thing is to ask one time and get full informations, like yours.
I’ll so change my script to follow the base of what you did. Thanks again for your reply, you help me a lot ^^