Last active
December 25, 2015 20:08
-
-
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…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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