mistathiccums Posted March 13, 2022 Report Posted March 13, 2022 (edited) How do I add someone else's items to a trade offer? I know how to add my items, but how do I add my items? I've tried changing offer.addTheirItems, but it doesn't seem to work. All it does is give me an error ``` function sendKeysSell(link, amt) { try { manager.loadPartnerInventory(440, 2, true, (err, inventory) => { if (err) { console.log(err); return; } let offer = manager.createOffer(link); let keys = inventory.filter(item => item.market_name == 'Mann Co. Supply Crate Key'); let keyAmt = keys.slice(0, amt); offer.addTheirItems(keyAmt); offer.send((err, status) => { if(err) { console.log(err); } else{ console.log(status) } }); }); } catch (err) { } } function clearFile() { fs2.truncate('data.txt', 0, function(){ console.log('\nDATA.TXT FILE CLEARED\n') }); } ``` Edited March 13, 2022 by mistathiccums forgot some text Quote
Dr. McKay Posted March 13, 2022 Report Posted March 13, 2022 You have to load your partner's inventory and add items from their inventory. Quote
mistathiccums Posted March 13, 2022 Author Report Posted March 13, 2022 do i also have to load my inventory? even if I don't want to add any of my items function sendKeysSell(link, amt) { try { offerSell.loadPartnerInventory(440, 2, true, (err, inventory) => { if (err) { console.log(err); return; } let offerSell = manager.createOffer(link); let keys = inventory.filter(item => item.market_name == 'Mann Co. Supply Crate Key'); let keyAmt = keys.slice(0, amt); offerSell.addTheirItems(keyAmt); offerSell.send((err, status) => { if(err) { console.log(err); } else{ console.log(status) } }); }); } catch (err) { } } // This still isn't working, I'm not sure what else to do. The only thing i can think of is that there are untradeable items in that inventory, and that the bot is selecting the untradeable items resulting in an error, how to fix? Quote
Dr. McKay Posted March 13, 2022 Report Posted March 13, 2022 No, you only need to load an inventory that you want to add items from. You don't even technically need to load it if you already know the IDs of the items you want. There's not a lot I can do to help you with an error if you don't tell me what the error is. Quote
mistathiccums Posted March 13, 2022 Author Report Posted March 13, 2022 So I have this function called "sendKeysBuy" that works perfectly fine, but the second function "sendKeysSell", it give me this error " ReferenceError: offer is not defined at sendKeysSell (C:\Users\Eberh\Desktop\programs\bots\EnvyMarket Trade Bot\BACKUP 3.12.22.15.42\trade_accepter_bot.js:212:3) at Timeout._onTimeout (C:\Users\Eberh\Desktop\programs\bots\EnvyMarket Trade Bot\BACKUP 3.12.22.15.42\trade_accepter_bot.js:118:6) at listOnTimeout (node:internal/timers:559:17) at processTimers (node:internal/timers:502:7) " function sendKeysBuy(link, amt) { try { manager.loadInventory(440, 2, true, (err, inventory) => { if (err) { console.log(err); return; } let offer = manager.createOffer(link); let keys = inventory.filter(item => item.market_name == 'Mann Co. Supply Crate Key'); let keyAmt = keys.slice(0, amt); offer.addMyItems(keyAmt); offer.send((err, status) => { if(err) { //console.log(err); } else{ //console.log(status) } }); }); } catch (err) { } } function sendKeysSell(link, amt) { try { offer.loadPartnerInventory(440, 2, true, (err, inventory) => { if (err) { console.log(err); return; } var offer = manager.createOffer(link); let keys = inventory.filter(item => item.market_name == 'Mann Co. Supply Crate Key'); let keyAmt = keys.slice(0, amt); offer.addTheirItems(keyAmt); offer.send((err, status) => { if(err) { console.log(err); } else{ //console.log(status) } }); }); } catch (err) { console.log(err); } } Quote
Dr. McKay Posted March 13, 2022 Report Posted March 13, 2022 You need to call manager.createOffer before you try to call loadPartnerInventory on that offer. Quote
mistathiccums Posted March 13, 2022 Author Report Posted March 13, 2022 Then i get the error "TypeError: callback is not a function" Quote
Dr. McKay Posted March 13, 2022 Report Posted March 13, 2022 Please check the docs. loadPartnerInventory doesn't have a tradableOnly argument. 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.