Jump to content
McKay Development

Recommended Posts

Posted (edited)

Hey

 

I wanted to create a bot that farms hours on a few games and if I (player) start let's say CS:GO. The bot will give an error:

Logged into Steam
Boosting our hours on chosen games ...
Set state to Snooze
// starting CS:GO here
{ Error: LoggedInElsewhere
    at SteamUser._handleLogOff (C:\Users\Admin\node_modules\steam-user\components\logon.js:400:11)
    at SteamUser._handlers.(anonymous function) (C:\Users\Admin\node_modules\steam-user\components\logon.js:380:7)
    at SteamUser._handleMessage (C:\Users\Admin\node_modules\steam-user\components\messages.js:235:30)
    at emitThree (events.js:136:13)
    at CMClient.emit (events.js:217:7)
    at CMClient._netMsgReceived (C:\Users\Admin\node_modules\steam-user\node_modules\steam-client\lib\cm_client.js:323:8)
    at CMClient.handlers.(anonymous function) (C:\Users\Admin\node_modules\steam-user\node_modules\steam-client\lib\cm_client.js:603:8)
    at CMClient._netMsgReceived (C:\Users\Admin\node_modules\steam-user\node_modules\steam-client\lib\cm_client.js:305:24)
    at emitOne (events.js:116:13)
    at TCPConnection.emit (events.js:211:7) eresult: 6 }

This is the bot's code:

var colors = require("colors");
const SteamUser = require("steam-user");
const client = new SteamUser();

const logOnOptions = {
	accountName: "u",
	password: "p",
};

autoRelogin = true;	//correct?

client.logOn(logOnOptions);
client.on("loggedOn", () => {
	console.log("Logged into Steam".green);
	
	client.gamesPlayed(["Boosting Hours", 20, 70, 50, 9480, 300, 40, 130, 10, 730]);
	console.log("Boosting our hours on chosen games ...".yellow);
	
	client.setPersona(SteamUser.Steam.EPersonaState.Snooze);
	console.log("Set state to Snooze".blue);
});

client.on('error', function (err) {
	console.log(err);
	client.gamesPlayed(["Boosting Hours", 20, 70, 50, 9480, 300, 40, 130, 10, 730]);
});

I'm not sure if I need to use the autoRelogin boolean. I do know I need to handle the error. Not sure how to.

So my thought now was to just add the gamesPlayed function again to start those games when the errors appear.

 

But my thought of creating the bot was:

// Farm bot
1. Log in on the account
2. Run a check if the account is already playing game(s) (with interval, so it constantly checks)
3. If it is playing a game -> do nothing
4. If it is not playing any games -> start idling a list of games
5. Also handle the LoggedInElsewhere?

I'm learning C++ atm. And this is how I start my projects. Writing down what I want my program to do. And turn the text into code.

I just can't with JS. Simply because I don't understand the language that well.

 

Trust me, I don't like being spoonfed but I just can't code from scratch with JS. If anyone is planning to spoonfeed me. Do know I'd love some explaination. Otherwise I cannot learn from it.

 

Best regards

Ruben.

Edited by ruben1
Posted

You can't play games on the same account in more than one location. Once you launch a game on another instance, the first one will be booted from Steam. I think you've figured this out.

 

When the error event is emitted, your bot is no longer connected to Steam. You'll need to log back on if you want to remain connected.

 

You can use playingState to see if you're in-game elsewhere. So, for example, if you wanted to launch your games only if the account isn't currently in use, you'd want to set a timer (setTimeout) once you're logged on for say 5 seconds, and if you get playingState telling you that you're in-game elsewhere, cancel the timer. Once the timer elapses, launch your games.

  • 2 years later...
Posted

That's a different issue. You can only have one logon instance playing a game at the same time, but if you get booted off with error LoggedInElsewhere from simply logging in and not launching a game, then modify logonID in the steam-user logOn method, which will update that obfuscated_private_ip field. Steam only allows one logon session from the same public IP with the same private IP, presumably to boot off ghost sessions if the client crashes or something.

This has the side-effect of booting any other session off of Steam if you have two computers on the same public IP with network adapters that share the same private IP, even if that's not the adapter Steam uses to actually access the internet. If Steam happens to choose the wrong adapter and that IP is shared between two computers, only one of them will be able to log on at the same time. This can happen if you're running VirtualBox, Hyper-V, or some other hypervisor on both machines and you have a VM-internal network interface on both machines with the same IP.

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...