Skip to content

Instantly share code, notes, and snippets.

@AndrewCraswell
Last active December 25, 2015 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save AndrewCraswell/7032272 to your computer and use it in GitHub Desktop.
Save AndrewCraswell/7032272 to your computer and use it in GitHub Desktop.
Simple bot for CoderClicker: http://coderclicker.meteor.com/ How to use: Paste the following into the JavaScript console in your browser and run it. To start the bot type: "CodeBot.start();" to stop it do: "CodeBot.stop();" (or just reload the page). This gist was fashioned from: https://gist.github.com/jeresig/6720127 and https://github.com/pat…
CodeBot = {
start: function() {
var self = this;
self.spendAll = function() {
var score = this.toFixed(Number(Meteor.users.findOne({_id:Meteor.userId()}).profile.score));
$(".details").append('<input type="button" id="' + score + '" class="buy btn span4">');
$("#" + score).click();
}
self.toFixed = function(x) {
if (Math.abs(x) < 1.0) {
var e = parseInt(x.toString().split('e-')[1]);
if (e) {
x *= Math.pow(10,e-1);
x = '0.' + (new Array(e)).join('0') + x.toString().substring(2);
}
} else {
var e = parseInt(x.toString().split('+')[1]);
if (e > 20) {
e -= 20;
x /= Math.pow(10,e);
x += (new Array(e+1)).join('0');
}
}
return x;
}
this.clickInterval = setInterval(function(){
$(".code.btn").click();
}, 1);
self.buyInterval = setInterval(function(){
self.spendAll();
}, 1000);
},
stop: function() {
clearInterval(this.clickInterval);
clearInterval(this.buyInterval);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment