Surely many of the hack-readers and owners of Raspberry Pi have an account on Steam, whose library is filled with a considerable number of games bought on sales on this very Steam. But sometimes it happens that neither the time nor the desire to play these games is not, but I would like to get from them at least some benefit other than having a beautiful game icon in the list of games.
What is all this for?
- For sale. Each collectible card costs money. The price tag of the card varies from 1 rub. up to 15 rubles for ordinary, and 10-50 rubles. for metal (rare) cards. Cards can be sold to other Steam users through the marketplace, thereby earning on other games, or content for games.
- To the collection. Many Steam users collect game icons from these cards, to enhance the level of Steam, well, or for the aesthetic pleasure of the icons.
For more information about the cards and icons Steam can be read here .
And here is the Raspberry Pi?
There are many ways to idling Steam cards. Each of the methods has its pros and cons. However, almost all of them need a permanent Steam client, which gives us some inconvenience in the uptime issue. Also, some of the ways the user needs to intervene to switch games in which the cards fall out. Here we will consider a fully automated method that does not require large computing power and that would work 24/7 until all the cards fall out. Raspberry Pi is great for this! In addition, this is another reason to shake off the dust from your mini-computer and allow it to work for us.
')
It is a little about advantages and opportunities of this method:
- Does not require a Steam client
- Automatic game switching. If all the cards of a particular game have fallen out, then the next game is turned on.
- Steam does not put the status of "in the game." None of the friends on Steam will see the process go
- Stable. You can turn on and forget about the script until all the cards fall out.
Training
It is assumed that you have already installed and configured the OS in Raspberry Pi, as well as everything you need to work with it. On Habré already enough articles, which describes the detailed preparation for the Raspberry Pi, so here we will not analyze it.
Some of the articles that will help you configure the Raspberry Pi:
Installing node.js and its components
For our “Steam Idle Machine” to work, node.js and some modules for it are needed, such as
node-steam ,
request ,
forever . But first things first.
First we need to compile and install the latest version of node.js:
wget http://nodejs.org/dist/v0.12.5/node-v0.12.5.tar.gz tar xvf node-v0.12.5.tar.gz cd node-v0.12.5 ./configure make sudo make install
Compilation will take some time. At the Raspberry Pi 2's power without overclocking, the compilation took about 4-5 hours.
Next, we check if everything turned out well:
node -v npm -v
Next, install the node.js modules we need:
sudo npm install steam@0.6.8 -g sudo npm install request -g sudo npm install forever -g
Hooray! Now node.js is ready to go.
Install and run the script
Create a folder for our project and put there a symbolic link and the script itself:
cd ~ sudo mkdir steamidle cd steamidle sudo ln -s /usr/local/lib/node_modules ~/steamidle sudo nano steamidle.js
And insert it there:
var args = process.argv.slice(2); var fs = require('fs'); var steam = require('steam'); var request = require('request'); var sentryFile = 'sentryfile'; var sentry = undefined; if (fs.existsSync(sentryFile)) { sentry = fs.readFileSync(sentryFile); } function updateSentry (buffer) { console.log(buffer); fs.writeFile(sentryFile, buffer); } function createIdler(userinfo, timer){ var bot = new steam.SteamClient(); userinfo.bot = bot; bot.on('loggedOn', function() { canTrade = false; console.log('Logged in ' + userinfo.username); }); bot.on('sentry', updateSentry); bot.on('error', function(e) { console.log(userinfo); console.log(e); }); function startIdle(){ var req = request.defaults({jar: userinfo.jar}); req.get('http://steamcommunity.com/my/badges/', function (error, response, body) { if (body) { var b = body.match(/<a class="btn_green_white_innerfade btn_small_thin" href="steam:\/\/run\/(\d+)">/); if (b) { console.log(userinfo.username); console.log("Idling game " + b[1]); bot.gamesPlayed([b[1]]); } } var now = new Date(); console.log(now.getHours()+':'+now.getMinutes()+':'+now.getSeconds()); }); } bot.on('webSessionID', function (sessionID) { userinfo.jar = request.jar(), userinfo.sessionID = sessionID; bot.webLogOn(function(cookies) { cookies.forEach(function(cookie) { userinfo.jar.setCookie(request.cookie(cookie), 'http://steamcommunity.com'); userinfo.jar.setCookie(request.cookie(cookie), 'http://store.steampowered.com'); userinfo.jar.setCookie(request.cookie(cookie), 'https://store.steampowered.com'); }); userinfo.jar.setCookie(request.cookie("Steam_Language=english"), 'http://steamcommunity.com'); startIdle(); setInterval(function(){startIdle();}, timer); }); }); bot.logOn({ accountName: userinfo.username, password: userinfo.password, authCode: userinfo.authCode, shaSentryfile: sentry }); } createIdler({ username: ' ',
Pay attention to the last lines of the code. Here we will have to enter the data account Steam. First you need to enter only the username and password. Then save the file and run it:
node steamidle.js
The program will try to log in, but without success, because we need authCode because of SteamGuard. When trying to log in without authCode, Steam will send it to your inbox. Find the letter with the code in your mail and write the code in the script. Uncomment the comma and line below, save the file and run the script again.
If you did everything right, you will see about the same thing as in the image above. Congratulations! "Steam Idle Machine" functions as it should. Now open the script file again and comment out the comma and authCode as before. We won't need them anymore when we next start. Account data is stored in the folder with our project in the file
sentryfile
By the way, to run the script, it is best to use the forever module.
forever start steamidle.js
There is something else...
Unfortunately, there is a bug in the script and I could not fix it. After a few hours, the script suddenly stopped switching games. What caused this - I do not understand. I came up with a very barbaric solution to this problem. Put in cron restart the script every 2 hours.
crontab -e
Insert the line there:
0 */2 * * * /usr/local/bin/node /usr/local/bin/forever restart ~/steamidle/steamidle.js
Conclusion
Finally I would like to say that this method is safe, like any other. Of course, it would be foolish to deny the possible risks, but, nevertheless, not a single case of account blocking due to idl was recorded. I would be very happy with valuable additions to my article, as well as indications of my mistakes, if any.
Thank you for attention!