rycao18 Posted July 19, 2016 Report Posted July 19, 2016 I'm using the Doctor McKay library for login and trade starting, but I am then using seishun's steam-trade to automate trading. Here's my current code. client.on("tradeRequest", function(steamID, respond) { logger.info("Incoming Trade Request from " + steamID.getSteam3RenderedID()); respond(true); }) client.on("tradeStarted", function(steamID) { steamTrade.open(JSON.stringify(steamID)); }) steamTrade.on('offerChanged', function(added, item) { console.log('they ' + (added ? 'added ' : 'removed ')); console.log(item); for(var i = 0; i < steamTrade.themAssets.length; i++) { console.log(steamTrade.themAssets[i]); } }); When I log the item , the console prints out undefined and returns an error. (I assume this means the item is undefined?) Seishun told me that the reason this happens is because the tradeStarted event returns steamID as an object, not a string? I thought the JSON.stringify would convert this object to a string, but obviously I am mistaken? C:\Users\Richard\Desktop\Steam\NodeJS\GlitchedTurtleBot\node_modules\steam-trade\index.js:208 return self._themInventories[item.appid][item.contextid][item.assetid]; ^ TypeError: Cannot read property '2' of undefined at C:\Users\Richard\Desktop\Steam\NodeJS\GlitchedTurtleBot\node_modules\steam-trade\index.js:208:47 at Array.map (native) at SteamTrade._onTradeStatusUpdate (C:\Users\Richard\Desktop\Steam\NodeJS\GlitchedTurtleBot\node_modules\steam-trade\index.js:206:72) at Request._callback (C:\Users\Richard\Desktop\Steam\NodeJS\GlitchedTurtleBot\node_modules\steam-trade\index.js:244:10) at Request.self.callback (C:\Users\Richard\Desktop\Steam\NodeJS\GlitchedTurtleBot\node_modules\steam-trade\node_modules\request\request.js:187:22) at emitTwo (events.js:87:13) at Request.emit (events.js:172:7) at Request.<anonymous> (C:\Users\Richard\Desktop\Steam\NodeJS\GlitchedTurtleBot\node_modules\steam-trade\node_modules\request\request.js:1044:10) at emitOne (events.js:77:13) at Request.emit (events.js:169:7) Quote
Dr. McKay Posted July 19, 2016 Report Posted July 19, 2016 Use steamID.toString() instead of JSON.stringify. Quote
rycao18 Posted July 20, 2016 Author Report Posted July 20, 2016 Use steamID.toString() instead of JSON.stringify.Thanks so much <3 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.