Jump to content
McKay Development

Recommended Posts

Posted

Hi Doc, hi everybody,

 

I have been trying to code a simple game idler for CS:GO, and I dug into Steam-card-farmer's code to customize it as simply as possible. So far, the code I have is :

 

// Reload every hour through an external "forever" call
setTimeout(function () {
process.exit(0);
}, 1000*3600*1);

// Requires
var SteamUser = require('steam-user')
var SteamTOTP = require('steam-totp');

// Instance
var client = new SteamUser();

// Secret personal data : klonaway
var accountName = "myAccount";
var password = "myPassword";
var sharedSecret = "mySharedSecret";
var identitySecret = "myIdentitySecret";

// Preparing log on options
var logOnOptions = {
  'accountName': accountName,
  'password': password,
  'twoFactorCode': SteamTOTP.generateAuthCode(sharedSecret)
};

// Sign into Steam
client.logOn(logOnOptions);

client.on('loggedOn', function(details) {  
    console.log("Successfully logged on Steam as " + accountName);
    client.webLogOn();
    client.once('webSession', function(sessionID, cookies) {
        client.gamesPlayed({
            "game_id": 730,
        });
    });
});

From the console, it seems to work fine, but I cant't get any of the thousands of card drops awaiting to actually drop. Any insight into what I must have missed ?

 

Thanks a lot for any hint and happy botting !

 

Posted

A few things:

  • There's no need to wait for webSessions to tell Steam you're running a game
  • You can use client.gamesPlayed([730]); which is a bit simpler and allows steam-user to add some additional data when helpful
  • You might want to set yourself as online (setPersona) so you can see on your Steam profile whether you're actually in-game or not
  • Card drops can take a while. How long did you wait?
  • 2 weeks later...
Posted (edited)

Thanks Doc !

 

I implemented your advice, and now everything is working smoothly !

For anyone willing to run a very simple idling bot, here is the code I use so far :

// Reload every 2 hours
setTimeout(function () {
	process.exit(0);
}, 1000*3600*2);

// Requires
var SteamUser = require('steam-user')
var SteamTOTP = require('steam-totp');

// Instance
var client = new SteamUser();

// Secret personal data : klonaway
var accountName = "yourAccount";
var password = "yourPassword";
var sharedSecret = "yourSharedSecret";
var identitySecret = "yourIdentitySecret";

// Preparing log on options
var logOnOptions = {
	'accountName': accountName,
	'password': password,
	'twoFactorCode': SteamTOTP.generateAuthCode(sharedSecret)
};

// Sign into Steam
client.logOn(logOnOptions);

client.on('loggedOn', function(details) {
    
    console.log("Successfully logged on Steam as " + accountName);

	client.webLogOn();

	client.setPersona(1);

	client.gamesPlayed([730]);

});

The bot exits programmatically every 2 hours, and the "forever" javascript file below reloads it when it dies. I use this dirty trick with all my Steam bots to ensure the bot works almost permanently, despite the many Steam bugs and oddities ;-)

var forever = require('forever-monitor');

var child = new (forever.Monitor)('./idlerLKS.js', {
    max: 100000,
    silent: false
});

child.on('exit', function () {
    console.log('Forever has programmatically exited after 100000 restarts');
});

child.start();

Hope it helps someone.

Happy botting !

Edited by klonaway
  • 1 month later...

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...