-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Bot creation using the Launcher
Since the client code for Agar gets obfuscated and the useful variable names keep changing between each updates, it became much needed to add a layer between the bot code and the client code.
This layer is what I call the "Launcher".
Here is the template code if you want to make a bot that only follows the player's mouse. It takes the player's mouse in the screen coordination system and converts it into the game's coordinate system:
window.botList = window.botList || [];
function QuickBot() {
this.name = "An Unnamed Cell";
this.keyAction = function(key) {w};
this.displayText = function() {return [s];};
this.mainLoop = function() {
return [screenToGameX(getMouseX()),
screenToGameY(getMouseY())];
};
}
window.botList.push(new QuickBot());
window.updateBotList();
You can name your bot using "this.name". It's best to also include the version number, that way it's easier to debug problems and make sure everyone is on the same version.
If you want to add special features to your bot with key press toggles, you can use "this.keyAction" and then check for key codes.
If you want to display text, use "this.displayText". This function should return a list of strings.
The bot logic goes into "this.mainLoop". This function returns an array with the destination value within the absolute game coordinate system.
TO BE CONTINUED! dun dun dun