-
Posts
4 -
Joined
-
Last visited
Profile Information
-
Gender
Male
MrKirby's Achievements
-
Async problems using "getUserInventoryContents"
MrKirby replied to MrKirby's topic in node-steam-tradeoffer-manager
Thanks for the quick response, but it is not what I am looking for, I think. Whenever it is busy 'getting' a user's inventory, it should freeze a code block (like a normal callback function could do). But I have no clue on how to run a callback on the "getUserInventoryContents" functoin. EDIT: var j = 10; for(var i=0;i<j;i++) { console.log("testing... " + i) manager.getUserInventoryContents(config.accounts.steamid64[i],753, 6, true, (err, inventory) => { if (err) { console.log(err); return; } else if (err == null ) { console.log("Inventory length bot " +inventory.length+" | steamID "+ config.accounts.steamid64[i]); //etc. etc. This will output: testing... 0 testing... 1 testing... 2 etc. testing... 9 Inventory length bot 100 | steamID 12345678901234567890 //random ID Inventory length bot 100 | steamID 12345678901234567890 //random ID Inventory length bot 100 | steamID 12345678901234567890 //random ID etc. Inventory length bot 100 | steamID 12345678901234567890 //random ID Inventory length bot 100 | steamID 12345678901234567890 //random IDNow, how can I make it output this: testing... 0 Inventory length bot 100 | steamID 12345678901234567890 //random ID testing... 1 Inventory length bot 100 | steamID 12345678901234567890 //random ID testing... 2 Inventory length bot 100 | steamID 12345678901234567890 //random ID etc. Thanks in advance -
I am having issues with calling this function. I think it has something to do with the function waiting a little while. I have searched for callback etc. on the internet and I found a lot but I have no clue how to use them on the code... Question How do I use sync callback on the function: "getUserInventoryContents" This is what I have now: manager.getUserInventoryContents(config.accounts.steamid64[i],753, 6, true, (err, inventory) => { if (err) { console.log(err); return; } else if (err == null) { //The rest of the code I thought that this would work... I am not the best in node, basically just started... but hope you could help me
-
MrKirby started following Async problems using "getUserInventoryContents"
-
Dr. McKay reacted to a post in a topic: How to get your own name in console (and other users (optional))
-
Question How to get your own name in console (and other users (optional))
MrKirby replied to MrKirby's topic in node-steam-user
After some time having trouble with it (as I am new), I got it to work! Thanks so much dude! for everyone else wondering.. I used this: client.on('friendMessage', function(steamID, message) { friendID = [steamID]; client.getPersonas(friendID, function(getName) { var x = getName[friendID]; var friendName = x.player_name; console.log("[FriendlyMessage] " + friendName + ": " + message); } }); Brackets could be wrong because my code didn't stop there and I am correcting it within the text editor I do have another question and I don't know if I should ask it here? But, what are the numbers for friendrelationships?? I know 2 is friend request send to me. But where can I find it.. because I am having trouble finding everything... EDIT: After actually turning my brain on.. I checked within the files of your node and found a file with the numbers.... Shit I'm stupid... Thanks anyway!! GREAT SHIT DUDE!!! -
Hey, I started using Node.js and javascript a short time ago. I was trying to display my own username in console after logon. And if that worked, I'd try for others. I was hoping if you could help me. This is my code: client.on('loggedOn', function() { console.log("[Steam-BOT] Logged in as " + client.steamID); var botSteamID = [client.steamID]; var clientName = client.getPersonas(botSteamID); }); So I thought this was the way to go but, clientName stays unidentified. I do not know what I am doing wrong Thanks in advance!