
TextDynasty
Member-
Posts
144 -
Joined
-
Last visited
Everything posted by TextDynasty
-
cannot declined the wrong offer
TextDynasty replied to TextDynasty's topic in node-steam-tradeoffer-manager
Hi Adma, sorry for that. but i have some questions... My bot keeps declining my offer even i offer the correct amount of metals. manager.on("newOffer", function(offer) { var metal = 0 var key = 0 var BuyKey = (offer.itemsToReceive.forEach(function(item) { if (item.name == "Mann Co. Supply Crate Key") key++ })); var FromRef1 = (offer.itemsToGive.forEach(function(item) { if (item.name == "Refined Metal") metal += 9 if (item.name == "Reclaimed Metal") metal += 3 if (item.name == "Scrap Metal") metal++ })); if (BuyKey && FromRef1) { if (metal = key * buykeyprice) { offer.accept(function(err) { if (err) console.log(err); else console.log("They are selling " + key + " keys for " + buykeyprice * key + " refined metal."); console.log(colors.red("Accepting the trade offer.")); console.log(colors.green("Trade offer accepted.")); }); }} else { console.log("Trade offer not validated. Declining"); console.log("They offered " + key + " keys and " + metal + " refined metals. ") offer.decline(function(err) { if (err) console.log(err); }); } }); When I sent a correct offer, it declines it ( my buying price is 198 ) Trade offer not validated. Declining They offered 1 keys and 198 refined metals. The calculation of metals works fine and it show it is correct amount but it keeps declining it. -
My bot keeps declining my offer even i offer the correct amount of metals. manager.on("newOffer", function(offer) { var metal = 0 var key = 0 var BuyKey = (offer.itemsToReceive.forEach(function(item) { if (item.name == "Mann Co. Supply Crate Key") key++ })); var FromRef1 = (offer.itemsToGive.forEach(function(item) { if (item.name == "Refined Metal") metal += 9 if (item.name == "Reclaimed Metal") metal += 3 if (item.name == "Scrap Metal") metal++ })); if (BuyKey, FromRef1) { if (metal = key * buykeyprice) { offer.accept(function(err) { if (err) console.log(err); else console.log("They are selling " + key + " keys for " + buykeyprice * key + " refined metal."); console.log(colors.red("Accepting the trade offer.")); console.log(colors.green("Trade offer accepted.")); }); }} else { console.log("Trade offer not validated. Declining"); console.log("They offered " + key + " keys and " + metal + " refined metals. ") offer.decline(function(err) { if (err) console.log(err); }); } }); When I sent a correct offer, it declines it ( my buying price is 198 ) Trade offer not validated. Declining They offered 1 keys and 198 refined metals.The calculation of metals works fine and it show it is correct amount but it keeps declining it. Thanks McKay
-
thanks for reply. i changed the comma to && but it didn't work too. : ( offers.on('newOffer', function (offer) { manager.on("newOffer", function(offer) { var metal = 0 var key = 0 var BuyKey = (offer.itemsToReceive.forEach(function(item) { if (item.name == "Mann Co. Supply Crate Key") key++ })); var FromRef1 = (offer.itemsToGive.forEach(function(item) { if (item.name == "Refined Metal") metal += 9 })); var FromRec1 = (offer.itemsToGive.forEach(function(item) { if (item.name == "Reclaimed Metal") metal += 3 })); var FromScrap1 = (offer.itemsToGive.forEach(function(item) { if (item.name == "Scrap Metal") metal++ })); if (BuyKey && FromRef1 && FromRec1 && FromScrap1) { sell = metal buy = key * buykeyprice if (sell == buy) { offer.accept(function(err) { if (err) console.log(err); else console.log("They are selling " + key + " keys for " + buy + " refined metal."); console.log(colors.red("Accepting the trade offer.")); console.log(colors.green("Trade offer accepted.")); }); } if (sell != buy){ console.log("Trade offer not validated. Declining"); console.log("They offered " + key + " keys and " + metal + " refined metals. ") offer.decline(function(err) { if (err) console.log(err); }); }} }) });
-
Hi McKay, Do you know any problems in my script? It didn't seems working. Thanks a lot. offers.on('newOffer', function (offer) { manager.on("newOffer", function(offer) { var metal = 0 var key = 0 var BuyKey = (offer.itemsToReceive.forEach(function(item) { if (item.name == "Mann Co. Supply Crate Key") key++ })); var FromRef1 = (offer.itemsToGive.forEach(function(item) { if (item.name == "Refined Metal") metal += 9 })); var FromRec1 = (offer.itemsToGive.forEach(function(item) { if (item.name == "Reclaimed Metal") metal += 3 })); var FromScrap1 = (offer.itemsToGive.forEach(function(item) { if (item.name == "Scrap Metal") metal++ })); if (BuyKey, FromRef1, FromRec1, FromScrap1) { sell = metal buy = key * buykeyprice if (sell == buy) { offer.accept(function(err) { if (err) console.log(err); else console.log("They are selling " + key + " keys for " + buy + " refined metal."); console.log(colors.red("Accepting the trade offer.")); console.log(colors.green("Trade offer accepted.")); }); } if (sell != buy){ console.log("Trade offer not validated. Declining"); console.log("They offered " + key + " keys and " + metal + " refined metals. ") offer.decline(function(err) { if (err) console.log(err); }); }} }) });
-
i tried this way but it didn't increase the value of "currency" and "key" var currency = 0 var key = 0 var BuyKey = (offer.itemsToReceive.every(function(item) { return item.name == "Mann Co. Supply Crate Key"; key++ })); var FromRef1 = (offer.itemsToGive.every(function(item) { return item.name == "Refined Metal"; currency += 9 }));
-
I mean count multiple currency, such as count scrap metal and refined metal to buy a key.
-
Hi Is there any ways that we can count multiple different items in the trade offer? Thanks for helping
-
Hi everyone. My bot works fine now but it seems didn't declined wrong offers. Anyone can help me would be very nice. My code: offers.on('newOffer', function (offer) { manager.on("newOffer", function(offer) { var onlyKeys1 = (offer.itemsToReceive.every(function(item) { return item.name == "Mann Co. Supply Crate Key"; })); var onlyRef1 = (offer.itemsToGive.every(function(item) { return item.name == "Refined Metal"; })); var onlyKeys2 = (offer.itemsToGive.every(function(item) { return item.name == "Mann Co. Supply Crate Key"; })); var onlyRef2 = (offer.itemsToReceive.every(function(item) { return item.name == "Refined Metal"; })); if (onlyKeys1, onlyRef1) { keyAmount = offer.itemsToReceive.length refAmount = offer.itemsToGive.length == keyAmount * buyprice if (keyAmount == refAmount) { console.log("They are selling " + keyAmount + " keys for " + buyprice * keyAmount + " refined metal."); console.log("Accepting the trade offer."); offer.accept(function(err) { if (err) console.log(err); else console.log("Trade offer accepted."); }); } } if (onlyKeys2, onlyRef2) { keyAmount = offer.itemsToGive.length refAmount = offer.itemsToReceive.length == keyAmount * sellprice if (keyAmount == refAmount) { console.log("They are buying " + keyAmount + " keys for " + sellprice * keyAmount + " refined metal."); console.log("Accepting the trade offer."); offer.accept(function(err) { if (err) console.log(err); else console.log("Trade offer accepted."); }); } } else console.log("Trade offer not validated. Declining"); offer.decline(function(err) { if (err) console.log(err); }); } }) });
-
Thanks very much. I found where is my problem. Thanks adma. : ) Have a nice day
-
Question Count Items in trade offer
TextDynasty replied to TextDynasty's topic in node-steam-tradeoffer-manager
sorry my bad. offers.on('newOffer', function (offer) { manager.on("newOffer", function(offer) { var onlyKeys = (offer.itemsToReceive.every(function(item) { return item.name == "Mann Co. Supply Crate Key"; })); var onlyRef = (offer.itemsToGive.every(function(item) { return item.name == "Refined Metal"; })); if (onlyKeys, onlyRef) { keyAmount = offer.itemsToReceive.length refAmount = offer.itemsToGive.length console.log("Received trade offer containing " + keyAmount + " keys, accepting"); if (keyAmount == refAmount * 21) offer.accept(function(err) { if (err) console.log(err); }); } else { console.log("Trade offer contains non key items. Declining"); offer.decline(function(err) { if (err) console.log(err); }); } }) }); i tried something like this but it doesn't accept my offer. any ideas? -
i tried something like this but it doesn't accept my offer. any ideas? offers.on('newOffer', function (offer) { manager.on("newOffer", function(offer) { var onlyKeys = (offer.itemsToReceive.every(function(item) { return item.name == "Mann Co. Supply Crate Key"; })); var onlyRef = (offer.itemsToGive.every(function(item) { return item.name == "Refined Metal"; })); if (onlyKeys, onlyRef) { keyAmount = offer.itemsToReceive.length refAmount = offer.itemsToGive.length console.log("Received trade offer containing " + keyAmount + " keys, accepting"); if (keyAmount == refAmount * 21) offer.accept(function(err) { if (err) console.log(err); }); } else { console.log("Trade offer contains non key items. Declining"); offer.decline(function(err) { if (err) console.log(err); }); } }) });
-
Thanks for the reply but may I know to how to count ref before accepting the offer? For example, the bot will buy keys for 22 ref each? Thanks.
-
My bot now only accept donation. Anyone know how to script it to make it accept key trades and count items?
-
Hi. I want to know how to count items in trade offer to make trade offer more useful i've tried this code but it didn't seems working var item_from_me ={ "appid": 440, "contextid": 2, "amount": 1,"assetid": "5148534535", "item.name": "Refined Metal"} var item_from_them ={ "appid": 440, "contextid": 2, "amount": 1,"assetid": "5158673853", "item.name": "Mann Co. Supply Crate Key"}offers.on('newOffer', function (offer) { if (offer > 0) { offers.getOffers({ get_received_offers: 1, active_only: 1, time_historical_cutoff: Math.round(Date.now() / 1000) }, function(error, body) { if(body.response.trade_offers_received) { body.response.trade_offers_received.forEach(function(offer) { if (offer.trade_offer_state == 2) { console.log(offer); console.log('Recieved trade offer: ' + offer.tradeofferid); if (offer.items_to_give === item_from_me * 22 && offer.items_to_recieve === item_from_them) { offers.acceptOffer({tradeOfferId: offer.tradeofferid}); console.log("Offer accepted"); if (offer.steamid_other !== admin) { steam.sendMessage(admin, offer.steamid_other + " just donated!"); } } else { offers.declineOffer({tradeOfferId: offer.tradeofferid}); console.log("Offer declined"); } } }); } }); }
-
just asking will this works? var item_from_me ={ "appid": 440, "contextid": 2, "amount": 21, "currencyid": "5002"} var item_from_them ={ "appid": 440, "contextid": 2, "amount": 1, "currencyid": "5021"}offers.on('newOffer', function (offer) { if (offer > 0) { offers.getOffers({ get_received_offers: 1, active_only: 1, time_historical_cutoff: Math.round(Date.now() / 1000) }, function(error, body) { if(body.response.trade_offers_received) { body.response.trade_offers_received.forEach(function(offer) { if (offer.trade_offer_state == 2) { console.log(offer); console.log('Recieved trade offer: ' + offer.tradeofferid); if (offer.items_to_give === item_from_me && offer.items_to_recieve === item_from_them) { offers.acceptOffer({tradeOfferId: offer.tradeofferid}); console.log("Offer accepted"); if (offer.steamid_other !== admin) { steam.sendMessage(admin, offer.steamid_other + " just donated!"); } } else { offers.declineOffer({tradeOfferId: offer.tradeofferid}); console.log("Offer declined"); } } }); } }); }});