ders Posted September 4, 2016 Report Posted September 4, 2016 So my end goal is to get the item market_names from a trade, get the price of each item using steamlytics, add it together, then compare itemsToGive and itemsToReceive and have the bot accept the trade based on whether its + or -. First is what im trying to do possible using tradeoffer-manager and steamlytics? My problem is I cant figure out a way to get just the market names of each item. Im able to get 1 if im only sending one item. It seems like itemsToGive and itemsToReceive return an array that has each item as an object with the info about the items as properties of the object.What do I need to do to get the specific "market_name" property out of the array? Ive tried various for and foreach loops but nothing im doing is giving me the output Im wanting. Any guidance or a way of doing this thats easier than im making? Quote
Dr. McKay Posted September 4, 2016 Report Posted September 4, 2016 Did you set a language in the constructor? If you don't, there will be no descriptions (including market_name) present. If you do, then market_name will be a property of each object in the arrays. Quote
ders Posted September 4, 2016 Author Report Posted September 4, 2016 (edited) Did you set a language in the constructor? If you don't, there will be no descriptions (including market_name) present. If you do, then market_name will be a property of each object in the arrays.Yes I did, my problem is accessing multiple instances of it. 1 single item works fine any more than that and it just spits out the first one it looks at. Edited September 5, 2016 by ders Quote
Dr. McKay Posted September 4, 2016 Report Posted September 4, 2016 Well, you're only accessing item 0 of the array. You want to use a loop of some kind, or forEach. Please google this is you don't understand it, it's a fundamental concept. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.