
vrtgn
Member-
Posts
61 -
Joined
Everything posted by vrtgn
-
What is your code? / What are you attempting? Have you checked typos? Do you know what a error 400 response is? Although there is not much documentation, these things can easily be searched up which is fundamental for a coder. Quick google search got me these links which might be of help to you: NPM module for selling items on steam (cannot guarantee its trust - use at your own risk) Steam Community Discussion (steam community discussion about the api) SCMBot (again whether this is trustworthy or not, i can't guarantee, use at your own risk)
-
Creating Specific offer from chat command
vrtgn replied to TextDynasty's topic in node-steam-tradeoffer-manager
Working out change is similar to the popular coin change problem, except you don't have infinite amount of each coin. Here's how I would do it: Convert the price to scrap. Then using the coin change problem work out the least amount of scrap needed. In this case your coins would be 1, 3, 9, and key price in scrap being scrap, rec, ref and key price in scrap respectively. Look up the coin change problem and develop a function to work out the change. It's hard but also good to develop your coding skills. I wouldn't recommend to steal someone else's code since you don't know what it's doing and at the end of the day if your bot gets scammed it is your fault for not knowing how your code works. -
Like I said before, what are you trying to achieve? Are you trying to simulate the friendMessage event?
-
Maintaining many npm packages is hard. If you want it to be solved, try making your own solution.
-
That's almost impossible, unless you have a very unique name. The reason it wouldn't work is because anyone can have the same username as anyone else. Unless you're talking about the login username. I don't think you can, because that's hidden from everyone apart from the owner of the account itself.
-
I'm not so sure about what you're trying to achieve or how you can handle multiple events. To send an event is called 'emitting'. So you can do: this.emit('event-name', event-params) What are you making and what are you trying to achieve? Give some more description. Learn more about events here.
-
Creating Current Stock and Stock Limit
vrtgn replied to Crptkc's topic in node-steam-tradeoffer-manager
How and where are your prices/items that you are buying or selling stored? If there in a JSON file, I would add a `maxStock` and `currentStock` in the file, so it would look something like this: "Team Captain": { "buy": ... ... "maxStock": 3, "currentStock" 1 } Then, in your process function: let amountInTrade = {} for (var i = 0; i < theirItemsNames.length; i++) { amountInTrade[theirItemsNames[i]].amount = (amountInTrade[theirItemsNames[i]] ? amountInTrade[theirItemsNames[i]] + 1 : 1) } ... if (prices[itemName].currentStock + amountInTrade[itemName] <= prices[itemName].maxStock) { // if the amount they are giving plus how much we have is smaller than or equal to maxStock // accept the offer } else { // decline } -
It works now! Thanks so much for your help. Solution:
-
thanks for your quick reply so like this? function getID(itemname, callback) { manager.getInventoryContents(440, 2 , true, function(err, inventory) { if (err) { console.log(err) return; } else { //console.log(inventory); for (var i = 0; i < inventory.length; i++) { if (inventory.market_hash_name === itemname) { callback(inventory.id); return; } } } }) when calling :getID("The Diamondback", function logID(id) {//do something with id})
-
Hello. I have the function below which gets an item id by calling the inventory, then seeing which item's name is correct and then returns the id, however when i return the ID, it does not show correctly: it shows undefined. I have tried both .assetid and .id But when i put in the function console.log(inventory.assetid) it logs the id, but when i call the function it doesnt return the id! Please halp thank you function getID(itemname) { manager.getInventoryContents(440, 2 , true, function(err, inventory) { if (err) { console.log(err) return; } else { //console.log(inventory); for (var i = 0; i < inventory.length; i++) { if (inventory.market_hash_name === itemname) { return inventory.id; } } } })
-
Hello. I am using the TF2 npm. What I want is when I message the bot on steam a specific message e.g. deleteAllCrates it should delete all the crates. I've coded the messaging part I just need it to get the ID's off all the crates and put them in an array so I can do tf2.deleteItem(array) ^ would this work btw? Thanks in advance.